Can anyone tell me if i can model as below where model Main connects model A and model B. It gives error : 6 equations and 8 variables but how can connect such models.
model A
Modelica.Blocks.Interfaces.RealInput ain1;
Modelica.Blocks.Interfaces.RealInput ain2;
Modelica.Blocks.Interfaces.RealInput ain3;
Modelica.Blocks.Interfaces.RealInput ain4;
Modelica.Blocks.Interfaces.RealOutput aout1;
Modelica.Blocks.Interfaces.RealOutput aout2;
end A;
model B
Modelica.Blocks.Interfaces.RealInput bin1;
Modelica.Blocks.Interfaces.RealInput bin2;
end B;
model Main
Modelica.Blocks.Interfaces.RealInput min1;
Modelica.Blocks.Interfaces.RealInput min2;
Modelica.Blocks.Interfaces.RealInput min3;
Modelica.Blocks.Interfaces.RealInput min4;
A a;
B b;
equation
connect(a.ain1,min1);
connect(a.ain2,min2);
connect(a.ain3,min3);
connect(a.ain4,min4);
connect(a.aout1,b.bin1);
connect(a.aout2,b.bin2);
end Main;
Right now, you have 6 equations (one per
connectstatement). However, you have 8 variables (one for eachRealInputand eachRealOutput). From a mathematical point of view, this means that your model is under-determined, because you have more variables than equations.To solve this, you need to add two additional equations. Logically, the missing link seems to be how the two outputs of
Aare related to the inputs ofA. For example, the following model (where I've added such a relation between the inputs and outputs ofA) is fine: