Modelling and using a catalogue of possible batteries

Now let’s assume that the batteries in our electrical system, instead of being fixed, can be chosen from a range of possibilities. Each possibility is represented by a tuple of 3 items of information: the battery reference (ref), the voltage of the battery (V) and the maximum current delivered by the battery (Imax).

ref

V

Imax

1

12

30

2

12

40

3

6

30

4

6

20

Modeling a data table

Let’s start by creating a deps Table named Battery representing the possible tuples.

Table Battery

Attributes
ref :  DipoleIndex;
V :   Voltage;
Imax : Current;

Tuples
[1, 12, 30],
[2, 12, 40],
[3, 6, 30],
[4, 6, 20]
End

Posting a Catalog property on a data table

We can now model a battery (VSource) according to the generator convention. A battery will have a reference (ref), an input port (P2) and an output port (P1), a voltage (e) represented by the potential difference between ports P1 and P2, a delivered current (I) and a maximum current (Imax) which must not be exceeded. The current delivered is less than or equal to the maximum permitted current. Finally, the variables ref, e and Imax must be made subject to compliance with the possible choices in the Battery Table using a Catalog property.

Model VSource() extends Generator[]
Constants

Variables
ref : DipoleIndex;
Imax : Current;;

Elements

Properties
Catalog([ref, e, Imax], Battery);
I <= Imax;

End

Modeling the problem

The model of the TwoSerialAndNode problem can now be modified by explicitly introducing an instance of the VSource model with an additional degree of freedom in the choice of reference for the generator feeding the system.

Problem  TwoSerialAndNodeWithGen
Constants

Variables

Elements
Res1 : Resistor(1) ;
Res2 : Resistor(2, 10) ;
Gen : VSource();

C12 : Node(Res1.Pin, Res2.Pout) ;
CG1 : Node(Res1.Pout, Gen.Pin) ;
CG2 : Node(Gen.Pout, Res2.Pin);

Properties
Res1.I = 0.1;

End

Compiling and Solving the problem

After opening the SerialAndNodeWithGen.proj project file in DEPS Studio, we can compile the project (project > build the problem).

../_images/CatalogCompile.png

Then the problem can be solved (Solve > First Solution).

../_images/CatalogSolve.png