Opened 9 years ago
Last modified 7 years ago
#3638 assigned defect
Parameters based on externally read parameters are not calculated correctly
Reported by: | Owned by: | Willi Braun | |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Run-time | Version: | |
Keywords: | Cc: |
Description
Please consider the following example:
model ReadingParameters parameter String inputFile = Modelica.Utilities.Files.loadResource("modelica://ReadingParameters/input.dat") "Input data file"; parameter Modelica.SIunits.Voltage V1 = KeyWordIO.readRealParameter(inputFile, "V1"); parameter Modelica.SIunits.Voltage V2 = KeyWordIO.readRealParameter(inputFile, "V2"); final parameter Real n12 = V1 / V2; end ReadingParameters;
This example relies on the same library to read parameters from external files, as included in #3625.
Please run the attached example. It reads the data file "input.dat" from which the values V1 = 1000 and V2 = 100 are obtained. In this case the ratio n12 = V1/V2 is calculated correctly: n12 = 10
Now, in the data file change the second lint to V2 = 1000, make a right click on the result file in the Variable Browser and "re-simulate" (not re-compile). Then, the new parameters are read correctly, i.e., V1 = 1000 and V2 = 1000. However, the original parameter n12 = 10 remains unchanged, even though n12 should be equal to 1.
Attachments (3)
Change History (11)
by , 9 years ago
Attachment: | ReadingParameters.mo added |
---|
comment:1 by , 9 years ago
Neither removing the attribute final
of the parameter n12 nor adding annotation(Evaluate=true)
change the model behavior.
comment:2 by , 9 years ago
Component: | OMEdit → Run-time |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:3 by , 9 years ago
Owner: | changed from | to
---|
comment:7 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:8 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
The milestone of this ticket has been reassigned to "Future".
If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.
If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".
In both cases, a short informative comment would be welcome.
Test example