Message Boards Message Boards

0
|
6792 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Number of equations is more than expected in SystemModeler

Posted 4 years ago

Hello,

I machine generated (MatLab Script) an electrical circuit Modelica (.mo) file electrical netlist from a four port Y Paramater rational model in the complex frequency domain. I created a model class and used the Modelica Library calls throughout. It has 546 passive components (Resistor, Capacitor, and Inductor classes) and has 824 connect() equations. It also extends the Modelica Library four port. So It is kinda big. I'm treating it as a four port component and in a top level graphical model I connected a signal source and load resistor to the four port. So that's four more connect equations added to my model's 824. I'm getting this "Not Globally Balanced" validation check error which says that I have 2144 variables and 2146 equations. So, somehow I have two more equations than unknowns. Is there some way to get System Modeler to list out the equations and variables in some file so I can see and count things as my equation tally isn't jiving with what System Modeler is telling me. I have generated a corresponding SPICE circuit file and other than convergence issues, SPICE seems happy with the topology. So I do have something to compare it against. I'm searching high and low and I'm not seeing the problem here. I've attached my model file. Does anyone have any ideas on how best to trouble shoot this?

Thanks.

Attachments:
POSTED BY: Roger Backhus
2 Replies
Posted 4 years ago

Oh. Ok. Thank you very much! That saved a lot of time!

Roger

POSTED BY: Roger Backhus

The extra variables come from the declaration extends Modelica.Electrical.Analog.Interfaces.TwoPort;.

The TwoPort model adds four pins but also the corresponding voltages and variables (v1, i1, v2, i2). In your case, you are defining the behavior using components, so you don't need the extra variables and equations that TwoPort provides.

Just replace the extends by a declaration of four independent pins.

Modelica.Electrical.Analog.Interfaces.Pin p1;
Modelica.Electrical.Analog.Interfaces.Pin p2;
Modelica.Electrical.Analog.Interfaces.NegativePin n1;
Modelica.Electrical.Analog.Interfaces.NegativePin n2;

If you want to have an icon and the pins located in the correct position, you can create your own component based on TwoPort and remove the variables that are not needed. For example (notice that I removed the annotations to make it more readable here):

partial model FourPin
  Modelica.Electrical.Analog.Interfaces.PositivePin p1;
  Modelica.Electrical.Analog.Interfaces.NegativePin n1;
  Modelica.Electrical.Analog.Interfaces.PositivePin p2;
  Modelica.Electrical.Analog.Interfaces.NegativePin n2;
end FourPin;
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract