I was playing with OpenModelica using the PowerSystem library and found something curious.
To have a full grasp of what the equation constraints from the block's classes are, I always open each block individually and instantiate it, to have the full list of variables and equations of the flattened model.
However, I noticed that when I do it, the instantiated model has additional equations that are not defined in the code concerning the block's class or any parent's class, nor exists when I use the block in another model.
For instance, when instantiating the class for a simple Resistor (AC1ph_DC), it adds the equations equating the currents to zero (the last four equations):
R[1] * i[1] = v[1];
R[2] * i[2] = v[2];
v[1] = term_p.v[1] - term_n.v[1];
v[2] = term_p.v[2] - term_n.v[2];
i[1] = term_p.i[1];
i[2] = term_p.i[2];
(...)
term_p.i[1] = 0.0;
term_p.i[2] = 0.0;
term_n.i[1] = 0.0;
term_n.i[2] = 0.0;
Is this done automatically by OpenModelica to have a solvable system when instantiating just the resistor? Is there any documentation on that available?
Also, is there any "more correct" way to visualize the flattened class code of any block?