- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Termination Time
Page Start Prev 1 Next End
Termination Time
Termination Time
Apr-23-14 07:43:34
Hi,
I created a simple model in which i have a cylindrical tank open at one end. (I know the tank volume) The flow rate is the parameter. My model is such that it terminates when tank volume = flow rate * time. (I used the terminate() condition). Is there any way to store this termination time in a variable?
Re: Termination Time
Apr-23-14 07:49:39
Perhaps the following works for you:
Code:
model M
discrete Real r(start=0, fixed=true);
equation
when time>0.5 then
terminate("end");
end when;
when terminal() then
r = time;
end when;
end M;
I get the expected output:
Code:
$ ./M -output=r
[/home/martin/tmp/a.mo:5:5-5:21:writable]
stdout | info | Simulation call terminate() at time 0.500000
| | | | Message : end
time=0.50000000015000567455,r=0.50000000015000567455
- sjoelund.se
- 1700 Posts
Page Start Prev 1 Next End
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Termination Time
There are 0 guests and 0 other users also viewing this topic