- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Trouble using built-in variable time...
Page Start Prev 1 Next End
Trouble using built-in variable time in functions
Trouble using built-in variable time in functions
Jul-29-10 16:30:28
Hello!
I have a problem which is best illustrated by the following example:
Code:
function time_dependent_function
output Real i;
algorithm
i := time;
end time_dependent_function;
fclass test
Real x;
equation
x = time_dependent_function();
end test;
When building the simulator for that class, the following error occures:
Code:
Error: Error building simulator. Buildlog: g++ -I"C:\OpenModelica1.5.0\/include/omc" -msse2 -mfpmath=sse -I. -o funktionstest.exe funktionstest.cpp -L"C:/Users/Hannes Edinger/workspace/OIB_RL6/OIB_RL6/../OIB_RL6/OENORM_B8110_6" -lsim -L"C:\OpenModelica1.5.0\/lib/omc" -lc_runtime -lf2c -linteractive -lsendData -lQtNetwork-mingw -lQtCore-mingw -lQtGui-mingw -luuid -lole32 -lws2_32
In file included from funktionstest.cpp:14:
funktionstest_functions.cpp: In function `time__dependent__function_rettype _time__dependent__function()':
funktionstest_functions.cpp:34: error: cannot convert `time_t ()(time_t*)' to `modelica_real' in assignment
mingw32-make: *** [funktionstest] Error 1
I think the crux of the matter is the part "cannot convert `time_t ()(time_t*)' to `modelica_real' in assignment".
How to deal with that?
Regards,
Hannes
- edes
- 38 Posts
Re: Trouble using built-in variable time in functions
Jul-29-10 16:40:32
You can't access time from within a function in Modelica. You need to pass it as an argument if you want to use it.
- sjoelund.se
- 1700 Posts
Re: Trouble using built-in variable time in functions
Jul-29-10 17:04:52
Ah - Didn't know that (obviously). Thanks a lot!
- edes
- 38 Posts
Page Start Prev 1 Next End
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Trouble using built-in variable time...
There are 0 guests and 0 other users also viewing this topic