I suspect, based on my own testing, that this is due
several a bugs in how EA writes Modelica code...
To understand what's happening, you really need to
take a look at the Modelica code generatedby EA when you press '
Solve' or '
Validate' in the '
Configure SysML Simulation' window.
In SysML, the natural way to work with vector quantities (1-d arrays) is to declare multiplicity on a parameter.
In EA, this means setting '
Property > Multiplicity > Upper bound' to a value greater than 1 (or potentially
*) for an aribtrary upper bound.
But if you do this,
EA messes up the syntax for Modelica definitions...In your example, the
correct definition for your 'ChooseVector' <<constraint>> would be:
class ChooseVector;
Real pX[3];
Real pY[3];
Real p[3];
equation
p = if (Type==X1) then pX else pY;
end ChooseVector;However, if you specify SysML multiplicity on the parameter,
EA instead generates this:
class ChooseVector;
RealU005B3U005D pX;
RealU005B3U005D pY;
RealU005B3U005D p;
equation
p = if (Type==X1) then pX else pY;
end ChooseVector;...it's messing up in two ways:
- It substitutes Unicode codes rather than using an ASCII square bracket ( U005B = [, in unicode)
- It uses SysML notation, by putting the dimension next to the type definition (Real in this case), rather than matching the Modelica syntax and placing the dimension next to the variable.
If instead you take your appoach, of using the SysPhS stereotypes, by setting:
- MultidimensionalElement.dimension = 3
- Part.Lower Value = 3
- Part.Upper Value = 3
...then
EA just ignores these settings and produces...
class ChooseVector;
Real pX;
Real pY;
Real p;
equation
p = if (Type==X1) then pX else pY;
end ChooseVector;Which is why you see the error you do: Modelica thinks
pX,
pY and
p are single-valued parameters and can't assign a three valued vector.