Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: DerDybel on September 05, 2023, 10:36:52 pm
-
Hello,
I am relatively new to Enterprise Architect and SysML and have started doing parametric analyses using the interface of EA to openmodelica. This works quite well with 1D variables (eg.: x=1) but I seem to be unable to get the simulation to work with 3D vectors (e.g.: x=(1,2,3)).
Here is how my model and simulation are set up:
BDD:
(https://i.imgur.com/P5b2BYC.jpg)
Parametric Diagram of "Block Needing Vetcor" Block:
(https://i.imgur.com/geAgTC8.jpg)
IBD of "Vector Simulation Context" Block
(https://i.imgur.com/SD77XhY.jpg)
When I run the simulation with values "1" and "0" for X and Y respectively, everything works fine. When I use (1,1,1) and (0,0,0) instead, I get the following error:
Error: Tuple expressions may only occur on the left side of an assignment or equation with a single function call on the right side. Got the following expression: (1, 1, 1). (Expression: " BlockNeedingVector Property1(pY=(0,0,0),pX=(1,1,1),Type="X1") annotation(Documentation(info = ""), Placement(visible = true, transformation( origin = {-70, -221}, extent = {{0, 0}, { 335, 402}}))); ")
What am I doing wrong? The type "Real" should cover vectors as well and even renaming parameters to indicate "extra dimensions" doesn't work (i.e.: pX --> pX[3]).
Thank you in advance.
-
Update: I recognised my mistake in declaring arrays with "()" instead of the correct form "{}". However, in doing so I only managed to shift the error somewhere else.
If the input is declared like this pX={1,1,1} then the following error is displayed:
Error: Type mismatch in binding ‘pX = {1, 1, 1}‘, expected array dimensions [], got [3]. (Expression: " parameter Real pX annotation(Documentation(info = ""), Placement(visible = true, transformation( origin = {-81, -180}, extent = {{0, 0}, { 85, 32}}))); ")
Fair enough, in modelica arrays need to be declared like this: pX[3]={1,1,1}. However, when this is implemented the constraint formula no longer recognises the parameters as inputs ("Not Required Parameters"), no matter how the parameters are used in the formula
(https://i.imgur.com/oWgzSaW.png)
(https://i.imgur.com/mME5yXg.png)
Consequently, the error message says that the variable could not be found in the scope of the block "Block Needing Vector".
-
Another Update (but still no solution):
I changed the parameters to SysPhs Constants and Variables and was able to use multiplicity and the SysPhs "Multidimensional Element" Stereotype to specify them as vectors:
(https://i.imgur.com/4yLYTHp.png)
(https://i.imgur.com/Zu9lHoj.png)
However, even though it now seemingly looks right in the Sim, modelica still doesn't get it:
(https://i.imgur.com/NbEPoiY.png)
(https://i.imgur.com/mB6PLy6.png)
Anyone have any suggestions?