Opened 10 years ago
Last modified 7 years ago
#3221 assigned defect
Equation count of models containing expandable connectors
Reported by: | anonymous | Owned by: | Mahder Alemseged Gebremedhin |
---|---|---|---|
Priority: | normal | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | trunk |
Keywords: | Cc: |
Description
Consider the following code
package ExpandableConn model IntegInput Modelica.Blocks.Interfaces.RealInput u; Modelica.Blocks.Continuous.Integrator integrator; equation connect(integrator.u, u); end IntegInput; model IntegConn Modelica.Blocks.Continuous.Integrator integrator; Modelica.Icons.SignalBus conn; equation connect(integrator.u, conn.signal); end IntegConn; end ExpandableConn;
For me both models in the package should be balanced (=have the same number of equations and variables).
Indeed Dymola reports 2 equations and variables in both cases.
OM, instead, in the case of IntegConn reports three variables ad two equations.
Then this model is inserted in to a larger one, the count gests balanced again.
However i think the OM behaviour is worse. In fact one of the most beautiful characteristics of Modelica is that, when balanced models are connected to each other, the whole model stays balanced; when a large model is unbalanced, usually one expects to find where the unbalance comes from by looking at individual submodels: this OM counting technique makes this process more difficult.
I must add that I've not checked what Modelica Specifications say about how to count model variables when expandable connectors are present.
Change History (5)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
I made a mistake when copying the code.
Here follows the code that corresponds to what I wanted to point out.
package ExpandableConn model IntegInput Modelica.Blocks.Interfaces.RealInput u; Modelica.Blocks.Continuous.Integrator integrator; equation connect(integrator.u, u); end IntegInput; model IntegConn Modelica.Blocks.Continuous.Integrator integrator; Conn conn; equation connect(integrator.u, conn.signal); end IntegConn; expandable connector Conn extends Modelica.Icons.SignalBus; end Conn; end ExpandableConn;
I'm glad to see that you intend to revise the equation count (I infer this from your "yet" in the end of your message).
comment:3 by , 10 years ago
Yes, we're working on improving the front-end and that will include local balance checking.
Hopefully will be available sometime in the fall.
comment:4 by , 7 years ago
Component: | *unknown* → NF - New FrontEnd |
---|---|
Milestone: | Future → 2.0.0 |
Owner: | changed from | to
Status: | new → assigned |
Type: | discussion → defect |
See #4138 under "Local balanced checking"
comment:5 by , 7 years ago
Component: | NF - New FrontEnd → New Instantiation |
---|
Move all tickets from NF - New Frontend to New Instantiation so we don't have two different categories for the same thing.
Using this script: ExpandableConn.mos
we get:
The first one is counted correctly.
The second one is not, but Dymola also complains about the second one:
And indeed the Modelica.Icons.SignalBus conn; is just a connector, not an expandable one.
Are you sure you did the correct code?
There seems to be a bug in OpenModelica as we should not find the variable signal inside conn as conn is not expandable.
Also, you're right OpenModelica should check local balancing of models but we don't yet do it.