Opened 6 years ago
#5124 new defect
Very simple model is detected as over-determined
Reported by: | Owned by: | Lennart Ochel | |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Backend | Version: | |
Keywords: | Cc: |
Description
The following example model fails (28 equations and 26 variables):
model Test model tp extends Modelica.Electrical.Analog.Interfaces.TwoPort; equation connect(n1, n2); connect(p1, p2); end tp; Modelica.Electrical.Analog.Sources.ConstantVoltage v; Modelica.Electrical.Analog.Basic.Ground g1; Modelica.Electrical.Analog.Sources.ConstantCurrent c(I = 0); Test.tp pt; equation connect(g1.p, v.n); connect(pt.p1, v.p); connect(pt.n1, v.n); connect(pt.p2, c.p); connect(pt.n2, c.n); end Test;
When removing the TwoPort in the middle, it works.
model Test Modelica.Electrical.Analog.Sources.ConstantVoltage v; Modelica.Electrical.Analog.Basic.Ground g1; Modelica.Electrical.Analog.Sources.ConstantCurrent c(I = 0); equation connect(g1.p, v.n); connect(v.p, c.p); connect(v.n, c.n); end Test;
When manually inlining the TwoPort, I get:
model Test model tp Modelica.SIunits.Voltage v1; Modelica.SIunits.Voltage v2; Modelica.SIunits.Current i1; Modelica.SIunits.Current i2; Modelica.Electrical.Analog.Interfaces.PositivePin p1; Modelica.Electrical.Analog.Interfaces.NegativePin n1; Modelica.Electrical.Analog.Interfaces.PositivePin p2; Modelica.Electrical.Analog.Interfaces.NegativePin n2; equation v1 = p1.v - n1.v; v2 = p2.v - n2.v; 0 = p1.i + n1.i; 0 = p2.i + n2.i; i1 = p1.i; i2 = p2.i; connect(n1, n2); connect(p1, p2); end tp; Modelica.Electrical.Analog.Sources.ConstantVoltage v; Modelica.Electrical.Analog.Basic.Ground g1; Modelica.Electrical.Analog.Sources.ConstantCurrent c(I = 0); Test.tp pt; equation connect(g1.p, v.n); connect(pt.p1, v.p); connect(pt.n1, v.n); connect(pt.p2, c.p); connect(pt.n2, c.n); end Test;
This has the same result as with the non-inlined version.
When I remove the 0=p1.i+n1.i and 0=p2.i+n2.i equations, it works.
Example:
model Test model tp Modelica.SIunits.Voltage v1; Modelica.SIunits.Voltage v2; Modelica.SIunits.Current i1; Modelica.SIunits.Current i2; Modelica.Electrical.Analog.Interfaces.PositivePin p1; Modelica.Electrical.Analog.Interfaces.NegativePin n1; Modelica.Electrical.Analog.Interfaces.PositivePin p2; Modelica.Electrical.Analog.Interfaces.NegativePin n2; equation v1 = p1.v - n1.v; v2 = p2.v - n2.v; i1 = p1.i; i2 = p2.i; connect(n1, n2); connect(p1, p2); end tp; Modelica.Electrical.Analog.Sources.ConstantVoltage v; Modelica.Electrical.Analog.Basic.Ground g1; Modelica.Electrical.Analog.Sources.ConstantCurrent c(I = 0); Test.tp pt; equation connect(g1.p, v.n); connect(pt.p1, v.p); connect(pt.n1, v.n); connect(pt.p2, c.p); connect(pt.n2, c.n); annotation( uses(Modelica(version = "3.2.2")) ); end Test;
These two equations are practically redundant and should be eliminated/ not be counted.
Note:
See TracTickets
for help on using tickets.