Why Attributes min, max in Dymola/Modelica doesn't work?

Viewed 365

I'm trying to limit the value using 'min', 'max' attributes like this way below.

SI.Angle thetta_out(start=0, min=0, max=31.4)

But min and max attributes are not working. The value is varying with no constraint and only start values's working as i set.

Can someone figure out what's the problem?

I'don't want to make a logic to handle this problem like if- statement because this makes the system slow and twisted.

2 Answers

You need to activate the check manually in

Simulation Setup -> Debug

looking like this:

Min/Max assertion settings

If I remember correctly, the reason for the setting being inactive by default is related to the decrease in performance when activating it, combined with the fact that it is often not necessary to have it.

For a more precise description you can have a look at the Dymola Manual 1, Section 5.6.8 "Bound checking for variables" which gives some more detailed explanation. This is also the source for the above screenshot.

min and max values are only used as hints, not as hard limits. In Dymola you can set flags to enforce it as hard limit, go to Edit, Options, Flags, then search for "min":

Advanced.AssertNonLinearInsideMinMax = true;

It is probably sufficient to set Advanced.AssertNonLinearInsideMinMax = true;. As an alternative to the Flag editor GUI you can also set the flags from the command window.

Related