Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Questions on an introductory DAEs system

Questions on an introductory DAEs system

Dear all,

I am learning Modelica in order to model DAEs systems and to do this I am using the book of Prof. Fritzon.
I am a student and DAE and Modelica are completely new for me so, maybe, you may find my questions mindless but I really need to understand better these basic concepts. So, I want to thank in advance the one who will answer to my questions.
In particular, I am modeling the following example of a Pendulum.

model Pendolum
parameter Real m=1, g=9.81, L=0.5;
Real F;
Real x(start=0.5), y(start=0);
Real vx, vy;

equation

m*der(vx)=-(x/L)*F;
m*der(vy)=-(y/L)*F-m*g;
der(x)=vx;
der(y)=vy;
x^2+y^2=L^2;

end Pendolum;

There are some points that are not very clear to me. I listed them below:

1) Why the following warning message appears? What does it means? Is there a way to remove it?

[1] 19:28:43 Translation Warning
Assuming fixed start value for the following 2 variables:
         $STATESET1.x:VARIABLE(start = /*Real*/($STATESET1.A[1]) * $START.vy + /*Real*/($STATESET1.A[2]) * $START.vx fixed = false )  type: Real
         $STATESET2.x:VARIABLE(start = /*Real*/($STATESET2.A[1]) * $START.x + /*Real*/($STATESET2.A[2]) * $START.y fixed = false )  type: Real

2) As the system is described by 2nd order diff eqs. and the state variables are: x(t), y(t) and F(t), what I expect is to have also initial conditions on the first derivatives (i.e. velocities of x and y) and on F but in the example I just have initial conditions just on the position (x(t) and y(t). Is this my thought wrong? If yes, why?

3) Do you have any materials (maybe with some examples) to suggest me in order to better understand how DAEs work?

I am so sorry for all these questions,

Thank you so much!

Very best Regards,

Gabri

Edited by: Gabri - Jan-20-20 00:45:35

Re: Questions on an introductory DAEs system

Just after a very fast reading, please do not take it for completely sure:
The message is just telling that the program has taken fixed start values for two variables.
You can't give fixed start values for x and y, as they are related by the equation: x^2+y^2=L^2 and L is fixed, the value of one of them forces the other. So the correct way is:
Real x(start=0.5, fixed=true),  y;
The same is valid for vx and vy, but take into account that at x=-0.5 or x=0.5, the only valid value for vx is 0. So in this case:
Real vx(start=0, fixed=true), vy;
If you want other start values for vx it should be with other values of x.

Re: Questions on an introductory DAEs system

Hi CTG,

thank you so much for your help.

I have tried this solution but the following 2 issues occur:

1) in the 'Messages Browser' I have the following warning:

08:53:32 Translation Warning
Iteration variables with default zero start attribute in equation system with analytic Jacobian:
         y:DUMMY_STATE()  type: Real

What does it means?

2) In the 'simulation output' window I have the following message written in red:

Failed to solve linear system of equations (no. 26) at time 0.000000, system is singular for U[3, 3].
The default linear solver fails, the fallback solver with total pivoting is started at time 0.000000. That might raise performance issues, for more information use -lv LOG_LS.
Matrix singular!

By the way the simulation 'end successfully'. Pasted below the lines which are right after the above error message:

The initialization finished successfully without homotopy method.
### STATISTICS ###
timer
events
solver: dassl
The simulation finished successfully.

Why do I have this message even if the simulation ends successfully?

Thank you so much!


Re: Questions on an introductory DAEs system

Hi Gabri,
I'm receiving no message, in the Message Browser, when runing the code with OpenModelica 1.14.1 on Windows 10. I think that the translation warning is only telling that y has no start value given, but as it is not needed no problem here.
I'm also receiving the same message in the output window. I'm sorry, but I can't give you any information here. Are messages that I get also from time to time, and that I think are related with the solver, and really I do not take care about this.

I attach the code with the annotation of the experiment and flags used:
model Pendolum
  parameter Real m = 1, g = 9.81, L = 0.5;
  Real F;
  Real x(start = 0.5, fixed = true), y;
  Real vx(start = 0, fixed = true), vy;
equation
  m * der(vx) = -x / L * F;
  m * der(vy) = (-y / L * F) - m * g;
  der(x) = vx;
  der(y) = vy;
  x ^ 2 + y ^ 2 = L ^ 2;
  annotation(
    experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002),
    __OpenModelica_commandLineOptions = "--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian -d=initialization   ",
    __OpenModelica_simulationFlags(lv = "LOG_STATS", outputFormat = "mat", s = "dassl"));
end Pendolum;

And good luck with Modelica, it is an amaizing tool !

There are 0 guests and 0 other users also viewing this topic
You are here: