- Index
- » Programming
- » Modelica Language
- » Result of a variable as a start value...
Result of a variable as a start value in the next simulation.
Result of a variable as a start value in the next simulation.
I have created a model that will simulate evaporation from water droplets and I want the droplet temperature of the last time step to be the start value for the droplet temperature in the first time step on the next simulation. A kind of iteration. The droplet temperature in the first time step shall be equal to the dew-point of the gas (that surrounds the droplet) in the last time step.
This could be done manually by making a guess of the final temperature and then simulate over and over again, till the difference between the guessed value and the result is small enough.
Is there a way to use the value of a variable in the last time step to be the start value for the next simulation, by writing code or by using some of the components in MSL?
Thanks in advance.
Re: Result of a variable as a start value in the next simulation.
By writing your equation using the droplet temperature variable, the simulator will keep taking the most current value. You have to free your mind from the classic programming model. In Modelica, you write down the equations, provide initial values and let the compiler do the rest for you, free of charge :-)
Re: Result of a variable as a start value in the next simulation.
I must admit that I have had some hard time to overcome the the way of think in classic programing and maby I just need to reboot my brain
This is how I´m thinging:
dropletTemperature(first time step) = dewPointTemperature(last time step)
When the compiler is about to calculate the first time step, how can it know the value of the dew-point variable in the last time step?
- Index
- » Programming
- » Modelica Language
- » Result of a variable as a start value...