- Index
- » Programming
- » Modelica Language
- » Unpredictable behaviour when...
Unpredictable behaviour when protected blocks are present
Unpredictable behaviour when protected blocks are present
I came across into a model that, when simplified, becomes the one reported below.
I really don't know where the keyword "protected" that is in that model came from.
However this gives rise to unpredictablke results.
In fact, if we run from OMEdit the model "testFactor", we see that uGen.Wel correctly saturates to 140.
If we change factor to 1.0 and rebuild and rerun the model, uGen.Wel correctly saturates to 100.
But let us now do this:
1) put factor= 1.4,
2) build and run the model testFactor => uGen.Wel correctly saturates to 140
3) in the variables browser of OMedit change factor from 1.4 to 1.0
4) re-run the model using the Re-simulate button
5) => uGen.Wel saturates to 140 (in dymola it saturates to 100, instead).
Now the questions are:
1) are these models correct or they should give rise to a warning or an error?
2) what is the correct behaviour? OM's or Dymola's or some other?
MC
Code:
package testText
block AsmaUgen
parameter Modelica.SIunits.AngularVelocity WeMax(start=314.15);
Modelica.Blocks.Interfaces.RealOutput Wel;
Modelica.Blocks.Interfaces.RealInput Wm;
protected
Modelica.Blocks.Nonlinear.Limiter limiter(uMin=0, uMax=WeMax);
equation
connect(limiter.u, Wm);
connect(Wel, limiter.y);
end AsmaUgen;
model testFactor
parameter Real factor=1.4;
AsmaUgen uGen(WeMax=factor*100);
Modelica.Blocks.Sources.Ramp ramp1(height=200, duration=1);
equation
connect(ramp1.y, uGen.Wm);
end testFactor;
end testText;
- ceraolo
- 147 Posts
- Index
- » Programming
- » Modelica Language
- » Unpredictable behaviour when...