Balanced when I check model, but imbalanced when I simulate

Viewed 73

I am trying to simulate the flow in pipes between reservoirs. I have created my own pipe component (based on Modelica.Fluid) and it works fine when I simulate from one tank to another as shown below.

enter image description here

However, when I try to connect two pipes in series, as shown in the picture below, the model does not work. When I check my model, I'm told my model is balanced and has 402 equations and 402 variables. However, when I try to simulate I get the following error message:

An independent subset of the model has imbalanced number of equations (143) and variables (144)

enter image description here

Any ideas where this error message originates from? How is it possible that a balanced system becomes unbalanced when simulating, and how could it work with one pipe, but not two in series?

1 Answers

The problem is something like:

model M
  Real x,y;
equation
  x = sin(x);
  x = 3.0;
end M;

Where the total number of equations are balanced, but there is something causing some part of the system to be unbalanced (like forgetting a variable in the equations). OpenModelica internally partitions everything into sets of equations/variables that reach each other, which can give the error-message above. For the trivial cases like the one above, there is usually a different error-message though.

Related