Element
Elements are parts of models. An Element is an instance of a model. It can be passed as an argument to a model for implementing aggregation relationship. It can also be defined in a model for implementing composition relationship. An Element can be defined or declared as follow:
<Element> ::=
<DefinedElement>
|
<DeclaredElement>
Defined element
When they are local to a Model, Elements are defined according to the following syntax:
<DefinedElement> ::=
<name> : <ModelName>( <listOfArgValues> ) <ModelOption> ;
with
<ModelOption> ::=
|
redefine
Declared element
When they are passed as arguments of the Model, elements are declared according to the following syntax:
<DeclaredElement> ::=
<name> :<ModelSignature>;
Model signature
Each Model has a signature. Signatures allow the user to define several models with the same name, different contents as soon as theirs signatures are different. A signature is declared according to the following syntax:
<ModelSignature> ::=
<ModelName> [ <listofQuantitiesOrModelSignatures> ];
Note
When a Model inherits from another Model, the signature of the extended model is the concatenation of the signature of his parent and his own local signature. This rule has to be applied recursively all along any inheritance trees of models.
Access Path
All the elements of a problem are organized using aggregation and compositional relationships forming a tree structure. Access to the elements of this structure is authorized by the use of a doted notation. A constant, variable, or element at different levels of this tree structure can be designated and manipulated using an access path.
Examples
Model Dipole() abstract
Constants
Variables
V : Voltage;
I : Current;
Elements
Properties
End
Model Resistor() extends Dipole[]
Constants
Variables
R : Resistance;
Elements
Properties
V = R*I;
End
Model SerialResistor(R1) extends Dipole[]
Constants
Variables
R : Resistance;
expr P : Power;
Elements
R1 : Resistor[];
R2 : Resistor();
Properties
V = (R1+R2)*I;
V = R1.V + R2.V;
I = R1.I;
R1.I = R2.I;
P := V*I;
End
Problem ElecProblem
Constants
e : Voltage = 10;
Variables
Elements
Res1 : Resistor();
Serial : SerialResistor(Res1);
Properties
Serial.V = e;
Serial.P <= 50;
End