Use the result values from previous simulation result as guess values for next simulation in Dymola
Asked Answered
S

2

6

Initialization could be very cumbersome and easily lead to divergence. A simple strategy is to run the simulation when building a part of the whole system and use the simulation results to modify guess values. Here is what I got in the PPT from Francesco Casella and the book from Daniel Bouskela.

enter image description here

enter image description here

I found that I could use an option in Dymola as follows, but instead of using the initialization result, I wanna use the result when reaching a steady state. So I'd like to use a python script to extract the result from the .mat result file, then modify the iteration variables automatically. But the key problem is that I don't know when I add more components in my model, the iteration variable set of existing components would change, I don't know what kind of effect would this causes. Anyone got opinion on this issue, welcome to answer this question.

So my question is where should I find the python

enter image description here

enter image description here

Statute answered 8/12, 2019 at 14:40 Comment(0)
D
4

You can use the end values (= steady state) of the simulation result in order to create a new initialization (Dymola Manual 1, section 2.5.12) . If the component names are the same in the sub system model and the total model, you can run the script created in the subsystem model on the larger system model as well. But you have to check if your models have initial equations that hinder an initialization from the outside (see section 4.2 in https://2012.international.conference.modelica.org/proceedings/html/pdf/ecp12076927_KruegerMehlhaseSchmitz.pdf)

Dumbbell answered 12/12, 2019 at 14:35 Comment(4)
Thank you very much for your advice, I checked the chapter 2 in Dymola manual 1, it seems there is no section 2.5.12, the section name of 2.5 is "Building a mechanical model", and there is no sub-section. I am using Dymola 2019 FD01 could you tell which version of the help manual you are using?Statute
And regarding the advice of using initialization script, I have tried to build the subsystem first, and then use the "save start values in model" option in the "Simulation" menu, but even the subsystem works fine, and I store the iteration variables into the component, after integrating into the whole model, there is still could be a divergence, I am guessing that maybe in the bigger model, the iteration variables chosen by Dymola could be different. So what is your method of dealing with this kind of situation?Statute
I am using Dymola 2020X, maybe you could update your Dymola? in the 2019FD manual you can find it in chapter 5.5.12. After creating your script, you have to translate the model, run the script and then start the simulation.Dumbbell
Note that variables with start-values "higher up" have priority to be selected, so it seems unlikely that a sub-model with start-values would not use those start-values - unless you deliberately connect it to another sub-model with start-values of higher of the same or higher priority. (I.e. basically setting start-values for that other sub-model.)Lakesha
P
2

It should also be possible to initialize it steady state. Instead of providing initial values for a state x and fixing it, you can provide initial equations for the derivatives such as der(x) = 0;

With that setup activate Save Initial Results and you should be good to go.

Peaslee answered 17/12, 2019 at 10:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.