- Index
- » Programming
- » Modelica Language
- » Getting time
Getting time
Getting time
Hello ,
i want to get the time of the simulation when the event is appened.
For example:
i have the variable x(t) that goes from 0 to 2 and i want to get the time when x =1.5.
I write on modelica this code.
when x == 1.5 then
T = time;
end when;
This code doesn't work.
Where am i failing?
Tnks
Re: Getting time
Hi,
try
Code:
when x >=1.5 then
T = time;
end when;
Using the "==" on real number will result in a Translation Warning. Maybe thats why it doesn't work.
- Arinomo23
- 120 Posts
Re: Getting time
Tnks for answered. In the end i resolve with a timer wich start when the condition x==1.1 is sodisfied using a boolean variable.
I don't used:
when x>= 1.1 then
T=Time;
end when ;
because the time variable T will updaiting time by time for every second that x will be over than 1.1.
- Index
- » Programming
- » Modelica Language
- » Getting time