Saarland University
Lehrstuhl für Automatisierungstechnik

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Advanced record structure for parameters
gillesp
post Dec 6 2010, 10:54 AM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 18-October 10
Member No.: 130,775



Hi,
I want to build a system by handling parameters through record structure.
A good example is provided in the online tutorial (https://www.modelica.org/events/Conference2003/Modelica03-AdvancedTutorialExercises.pdf).
However in my case I would like to build more complicated structure. For instance a group of NbEngines engines containing different numbers of pistons:


model MultipleEngines
parameter MultipleEnginesParameters multiEnginesParameter;

end MultipleEngines;

record MultipleEnginesParameters
"Parameters of the whole group of engines"
parameter Integer NbEngines "number of engines";
parameter EngineParameters[NbEngines] engineParameters;

end MultipleEnginesParameters;

record EngineParameters "Parameters of an engine"
parameter Integer NbCylinder=3 "The engine is made up of NbCylinder cylinders";
parameter CylinderParameter[NbCylinder] cylinderParameters;
end EngineParameters;



record CylinderParameter "Parameters of a cylinder"
parameter Modelica.SIunits.Length cylinderLength "Length of the cylinder";
end CylinderParameter;


and the model which is supposed to use the MultipleEngines model:

model Trial
MultipleEngines multipleEngines(multiEnginesParameter(NbEngines=2,
engineParameters={TEST.EngineParameters(NbCylinder=2,
cylinderParameters={TEST.CylinderParameter(cylinderLength=1),
TEST.CylinderParameter(cylinderLength=2)}),TEST.EngineParameters(
NbCylinder=3, cylinderParameters={TEST.CylinderParameter(
cylinderLength=1.5),TEST.CylinderParameter(cylinderLength=2.5),
TEST.CylinderParameter(cylinderLength=3.5)})}))
annotation (Placement(transformation(extent={{-18,2},{38,40}})));
end Trial;



It works just fine when I check Trial model and the number of cylinders is a fixed value, said for instance 3 cylinders in each engine (see below) however I can not make it work with the previous example [NbCylinder]:

record EngineParameters "Parameters of an engine"
parameter Integer NbCylinder=3 "The engine is made up of NbCylinder cylinders";
parameter CylinderParameter[3] cylinderParameters;
end EngineParameters;


When I check the model Trial I get the following warning:
Current version of Dymola can only handle array of components with fixed size.
But component _out. engineParameters. cylinderParameters had non-fixed array dimensions [NbCylinder].
All variables used in size expressions must be declared as constants or parameters.


Whereas the array dimensions is declared as a parameter.
How could I fix this problem an keeping the possibility to have different numbers of cylinders in each engine?
The TEST.mo model contains the models and records structure discussed here.
Thanks for your comments.
GP


Attached File(s)
Attached File  TEST.mo ( 1.58k ) Number of downloads: 495
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 19th November 2019 - 02:39 AM