Saarland University
Lehrstuhl für Automatisierungstechnik

Welcome Guest ( Log In | Register )

> Advanced record structure for parameters
post Dec 6 2010, 10:54 AM
Post #1


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

I want to build a system by handling parameters through record structure.
A good example is provided in the online tutorial (
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,
NbCylinder=3, cylinderParameters={TEST.CylinderParameter(
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 model contains the models and records structure discussed here.
Thanks for your comments.

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

Posts in this topic

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: 16th November 2019 - 10:06 PM