How to get the inital value of a variable ?

Discussion about the use of Simantics System Dynamics
Post Reply
mathew1105
Posts: 4
Joined: March 28th, 2017, 9:59 pm

How to get the inital value of a variable ?

Post by mathew1105 » April 29th, 2017, 9:07 pm

Hi i am trying to get the vale of an auxiliary variable and save it in another variable so the variable gets that value for the rest of the simulation.

Does anybody know how to do it?

thank you
Tuomas Miettinen
Site Admin
Posts: 31
Joined: March 11th, 2013, 3:14 pm

Re: How to get the inital value of a variable ?

Post by Tuomas Miettinen » May 2nd, 2017, 11:29 am

You can get the initial value with the delay function. E.g.,
Aux1 = time + 1
Aux2 = delay(Aux1, stopTime)
gives Aux2 = 1 thru the whole simulation.

Can't tell how to do that in the middle of the simulation, but since the Sysdyn model is compiled to a Modelica model, there might be some Modelica functions to do that which the OpenModelica forum might be able to answer.
mathew1105
Posts: 4
Joined: March 28th, 2017, 9:59 pm

Re: How to get the inital value of a variable ?

Post by mathew1105 » May 2nd, 2017, 6:35 pm

Thank you very much that worked perfectly
Post Reply