Open casella opened 2 days ago
Test model:
model M
parameter Real x_start = 2;
annotation(
Icon(
graphics = {
Text(
origin = {18.445, 40.975},
extent = {{-38.445, -30.975}, {38.445, 30.975}},
textString = DynamicSelect("%x_start", String(x))
)
}
)
);
end M;
I think it's allowed. (System Modeler supports this by showing the value of x_start
in the icon).
I also think this make sense.
I think there is actually no contradiction here.
"%x_start"
is a literal expression, so this works as a first argument of DynamicSelect.
At the same time, https://specification.modelica.org/maint/3.6/annotations.html#text explains the text macros (emphasis mine):
There are a number of common macros that can be used in the text, and they should be replaced when displaying the text
So, in my mind
DynamicSelect
is evaluated to produce (e.g.) the string "%x_start"
Text
annotation%x_start
is interpolated to 2
.
Section 18.6.5.5 defines the meaning of Text annotations including "%" in textString, in particular
while Section 18.6.6, which defines DynamicSelect, reads:
Consider now the following annotation:
where
x_start
is a parameter. On the one hand,"x_start"
is a literal String expression. On the other hand, it clearly refers to a parameter value, so it's not really literal.How should this case be interpreted?