Opened 10 years ago
Closed 4 years ago
#3150 closed defect (fixed)
Wrong variability for array reduction
Reported by: | Adrian Pop | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | high | Milestone: | 1.17.0 |
Component: | New Instantiation | Version: | trunk |
Keywords: | Cc: |
Description
Flattening this model:
model BadVariability package Medium constant Boolean singleState = false; end Medium; parameter Integer nReg(min = 2) = 2; model CoilRegister "Register for a heat exchanger" constant Boolean initialize_p1 = not Medium.singleState; end CoilRegister; CoilRegister[nReg] hexReg(initialize_p1 = array(i == 1 and not Medium.singleState for i in 1:nReg)); end BadVariability;
gives:
adrpo@ida-liu050 ~/dev/OpenModelica/build/bin/media $ ../omc +locale=C BadVariability.mo Error processing file: BadVariability.mo [c:/bin/cygwin/home/adrpo/dev/OpenModelica/build/bin/media/BadVariability.mo:13:29-13:101:writable] Error: Component hexReg[2].initialize_p1 of variability CONST has binding false of higher variability PARAM. Error: Error occurred while flattening model BadVariability
The variability should be constant for the array reduction, not parameter.
This affects some of the building models, see for example:
https://test.openmodelica.org/libraries/Buildings/files/Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretizedPerfectGases.err
Change History (9)
comment:1 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:3 by , 9 years ago
Milestone: | Future → pre1.9.4 |
---|
It doesn't make sense to keep closed ticket in the "Future" milestone that were simply forgotten to assign to the correct milestone in the past.
comment:4 by , 7 years ago
No, a reduction with an iterator that is paramter should not be able to assign to a constant. This also has the side-effect of making OM evaluate things like array(1 for i in 1:n)
into {}
regardless of value of the parameter n
. I will revert this changeset since it conflicts with #4550.
comment:5 by , 7 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:6 by , 7 years ago
If necessary for the library (especially old ones), we could have a debug-flag -d=allowAssigningParameterToConstant
or something similar which forces evaluation of the parameter and prints a warning (which we could use in the library coverage).
comment:7 by , 7 years ago
Milestone: | pre1.9.4 → 1.9.4 |
---|
comment:8 by , 7 years ago
Milestone: | 1.9.4 → Future |
---|
comment:9 by , 4 years ago
Component: | Frontend → New Instantiation |
---|---|
Milestone: | Future → 1.17.0 |
Resolution: | → fixed |
Status: | reopened → closed |
Works in 1.17.0-dev, in including Buildings.Fluid.HeatExchangers.Validation.WetCoilDiscretizedInitializationPerfectGases
Fixed in r24514.