I use a lot of parameter annotations when developping components, in order to make them user-friendly, especially the Dialog(enable=...)
. However, when a parameter is disabled, it just prevents the user from modifying it afterwards, but it does not affect the value that may have been set beforehand. Here’s an example:
model toto
parameter Boolean isComplexModel=true;
parameter Boolean isDynamicModel=false annotation (Dialog(enable=isComplexModel));
equation
// Mass and energy balance equations
if isDynamicModel and isComplexModel then
[...]
else
[...]
end if;
// Other part of the code
if isComplexModel then
[...]
end if;
end toto;
In this example, the dynamic equations are used only if isDynamicModel=true
, which should be available only if isComplexModel=true
. However, I could set isDynamicModel=true
and then isComplexModel=false
in the instance. That’s why I need to specify if isDynamicModel and isComplexModel
.
Therefore, is there a way to modify (or at least reset) the value of a parameter when it is disabled?
2