Initial values - use of attribues start and fixed

3 posts / 0 new
Last post
janpeter
Offline
Joined: 2010-09-11
Initial values - use of attribues start and fixed

Hi,

I have set up a system that I know well from before and try to reproduce simulation results with JModelica. The system is non-linear and have 4 states and can actually easily be written in state space form, which I did.

I gave start values for the states but and run a simulation.
The results looked quite similar to what expected. The transient looked the same, but at least one variable had different steady state value. Further, the initial transient looked funny since the start value I had given was not really used.

Reading the book by Tiller I find that the start value is taken as "initial guess" of what the initial condition should be. Only if fixed is set to true, the initial value for that variable will bet set and to the start value. When I sett all the four state variables with fixed=true, I got correct initial transient and the steady states became correct (there is an integrator that gave a bias).

In my case I new the answer before I simulate and was prepared to look for errors but usually you do not know, of course.

1) Reading Tillers book chapter 13 explains very briefly the difficulties with initial values.
Where should I read to learn more for "basic user needs"?

2) Is a reasonable rule of thumb to set all state variables with the attribute fixed=true?
provided the system is on state space from.

3) Is there anything in the text output after compilation or after simulation that is a warning flag?

4) In my case I actually thought I needed to scale the variables and that was the source of problems.
Is there anything in the output text that indicates that variables should be scaled?

I realize that the initialzation is far more tricky than I thought for DAE. One aspect is that Modelica encourage you to specify inital conditions locally in each component, while one need to consider the integrated system to make a complete analysis of how initializations should be done.

Would appreciate some basic guiding and a ref where I can read more.

Thanks

jakesson
Offline
Joined: 2009-03-14
Hi Jan Peter!   You are right

Hi Jan Peter!
 
You are right - DAE initialization is a very tricky subject. Also, different tools use different approaches which may give different results. I assume that you use the JMU format for simulation, which requires the user to set the fixed attributes manually. If you use the FMU format for simulation, there is an algorithm that automatically imposes the fixed-attribute to be true for states, if it is not conflicting with fixed attributes for algebraic variables. To answer you questions:
 
1) The paper https://www.modelica.org/events/Conference2002/papers/p02_Mattsson.pdf gives an overview of the difficulties.
2) Yes.
3) If you set the argument 'compiler_log_level' to 'i' in the function jmodelica.fmi.compile_fmu you will get a lot of diagnostics, also diagnostics about selection of initial conditions.
4) See section 8.7 in the user's guide for details. In general it is very hard to detect automatically that the model needs to be scaled since it depends on the algorithm. Generally, simulation algorithms are more robust to scaling than optimization algorithms.
 
Best
/Johan

janpeter
Offline
Joined: 2010-09-11
Thanks for your answer! I

Thanks for your answer!
I will take a good look at the paper by Sven-Erik Mattsson et al.
So far I have used JMU, i.e. from jmodelica.compiler import ModelicaCompiler.

Jan Peter

Login or register to post comments