Opened 11 years ago
Closed 11 years ago
#2557 closed defect (fixed)
Report parameters with fixed = true and no binding equations
Reported by: | Francesco Casella | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | critical | Milestone: | 1.9.1 |
Component: | Backend | Version: | trunk |
Keywords: | Cc: |
Description
From Modelica 3.3 specification, Section 8.6:
If a parameter has a start-expression, does not have fixed=false,
and neither has a binding equation nor is part of a record having
a binding equation, the start-expression can be used as parameter-
expression although a diagnostic message is recommended when
initializing the model without setting the parameter value
Unfortunately we forgot to port this addition also into Modelica 3.2rev2. Anyway, this is the default behaviour in Dymola, and it is perfectly legal. OpenModelica doesn't take this rule into account, resulting in under-specified initial equation systems that often lead to division-by-zero errors when tackled by the new BLT-based initialization solver.
I would recommend to implement this feature asap, as it can fix many test cases that currently fail to initialize.
Change History (7)
comment:1 by , 11 years ago
Status: | new → accepted |
---|
comment:2 by , 11 years ago
The function BackendVariable.varFixed(var)
returned only true for parameters, if either the fixed attribute was explicitly given or a binding expression was defined. I fixed that.
Also I added a warning for this special cases to the initialization.
I run the test suite and if everything is working as expected, I will commit my changes.
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
I added the test from above here: testsuite/simulation/modelica/initialization/parameterWithoutBinding.mos
Fixed in r18913.
comment:4 by , 11 years ago
Well, I should improve the warning a bit:
Warning: Parameter C:VARIABLE(start = 1.0 fixed = true ) = 1.0 .initializationTests.parameterWithoutBinding, .Real type: Real has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value.
Better would be
Warning: Parameter C has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value.
Anyway, it is good enough for now.
comment:5 by , 11 years ago
I started a new Windows nightly so Francesco can play with it.
I updated the changes to AVM tests due to new warnings.
comment:6 by , 11 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I would encourage Lennart to improve the warning as he planned
comment:7 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed in r18932. Included the line number info too.
I prepared a small model that covert hat issue: