Opened 8 years ago
Last modified 6 years ago
#4050 new defect
Array of component: Too many equations.
Reported by: | Lennart Ochel | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | critical | Milestone: | 2.0.0 |
Component: | Backend | Version: | |
Keywords: | PNlib | Cc: | Adrian Pop, Martin Sjölund, Per Östlund, Mahder Alemseged Gebremedhin |
Description (last modified by )
I need to create an array of PC
components, similar to the minimal example below. When doing so, OpenModelica reports 142 equations and 126 variables.
model test inner PNlib.Settings settings annotation(Placement(visible = true, transformation(origin = {-30, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); PNlib.PC P1[2] annotation(Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); annotation(uses(PNlib(version = "1.4"))); end test;
Change History (10)
comment:1 by , 8 years ago
Description: | modified (diff) |
---|
comment:2 by , 8 years ago
It seems that there are some algorithm sections, which have too many output variables. This is the corresponding declaration within model PC:
Blocks.enablingInCon enableIn(…); Blocks.enablingOutCon enableOut(…);
comment:3 by , 8 years ago
The wrongly detected output variables are the following ones, which are declared as protected within the block definition:
P[2].enableOut.cumEnablingProb[1] P[2].enableOut.cumEnablingProb[2:P[2].enableOut.nremTAout] P[2].enableOut.TEout[P[2].enableOut.posTE] P[2].enableIn.cumEnablingProb[1] P[2].enableIn.cumEnablingProb[2:P[2].enableIn.nremTAin] P[2].enableIn.TEin[P[2].enableIn.posTE] P[1].enableOut.cumEnablingProb[1] P[1].enableOut.cumEnablingProb[2:P[1].enableOut.nremTAout] P[1].enableOut.TEout[P[1].enableOut.posTE] P[1].enableIn.cumEnablingProb[1] P[1].enableIn.cumEnablingProb[2:P[1].enableIn.nremTAin] P[1].enableIn.TEin[P[1].enableIn.posTE]
comment:4 by , 8 years ago
Cc: | added |
---|
And this is what the algorithm statements look like, that are used to determine the outputs:
P[2].enableOut.cumEnablingProb[1] := {}[{}[1]] / P[2].enableOut.sumEnablingProbTAout; P[2].enableOut.cumEnablingProb[2:P[2].enableOut.nremTAout] := {}[-1 + (2:P[2].enableOut.nremTAout)] + {}[{}[2:P[2].enableOut.nremTAout]] / P[2].enableOut.sumEnablingProbTAout; […]
comment:5 by , 8 years ago
I did a bit more investigation and I know what the problem is, but not yet how to fix it.
The problem is that if we have an array of components the algorithmOutputs function is given DAE.NOT_EXPAND so it does no expansion of the crefs. Because it does no expansion it comes up with 16 outputs instead of 12:
16: // bad outputs P[1].enableIn.arcWeightSum, P[1].enableIn.nremTAin, P[1].enableIn.nTAin, P[1].enableIn.sumEnablingProbTAin, P[1].enableIn.cumEnablingProb[1], P[1].enableIn.cumEnablingProb[2:P[1].enableIn.nremTAin], P[1].enableIn.randNum, P[1].enableIn.state128, P[1].enableIn.endWhile, P[1].enableIn.k, P[1].enableIn.posTE, P[1].enableIn.TEin[P[1].enableIn.posTE], P[1].enableIn.state128[1], P[1].enableIn.state128[2], P[1].enableIn.state128[3], P[1].enableIn.state128[4]}
Correct outputs:
12: // correct outputs {P1.enableIn.arcWeightSum, P1.enableIn.nremTAin, P1.enableIn.nTAin, P1.enableIn.sumEnablingProbTAin, P1.enableIn.randNum, P1.enableIn.state128[1], P1.enableIn.state128[2], P1.enableIn.state128[3], P1.enableIn.state128[4], P1.enableIn.endWhile, P1.enableIn.k, P1.enableIn.posTE}
It seems the problem appears when one replaces the index in the for loop with the range of the for loop and it does not expand the crefs. However, if the crefs are expanded that is not correct also as you will get 24 instead of 12 outputs, for both P[1] and P[2].
comment:6 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:7 by , 7 years ago
Milestone: | 1.12.0 → 1.13.0 |
---|
Milestone moved to 1.13.0 due to 1.12.0 already being released.
comment:8 by , 6 years ago
Updated test case to work with PNLib 1.4
model test inner PNlib.Components.Settings settings annotation(Placement(visible = true, transformation(origin = {-30, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); PNlib.Components.PC P1[2] annotation(Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); annotation(uses(PNlib(version = "1.4"))); end test;
follow-up: 10 comment:9 by , 6 years ago
Component: | Frontend → New Instantiation |
---|---|
Milestone: | 1.13.0 → 2.0.0 |
Owner: | changed from | to
With the NF, we now get
[2] 09:39:00 Symbolic Error The given system is mixed-determined. [index > 3] Please checkout the option "--maxMixedDeterminedIndex".
There is probably something wrong in the way the DAE structure is built.
comment:10 by , 6 years ago
Component: | New Instantiation → Backend |
---|---|
Owner: | changed from | to
Replying to casella:
With the NF, we now get
[2] 09:39:00 Symbolic Error The given system is mixed-determined. [index > 3] Please checkout the option "--maxMixedDeterminedIndex".There is probably something wrong in the way the DAE structure is built.
I'm not sure that's the NF's fault. checkModel reports that the model is balanced when using the NF, while it has too many equations when using the OF. So I'm going to assume this is a backend issue unless someone convinces me otherwise.
I just added an inner Settings component to the example to get rid of the warnings.