Opened 8 years ago
Closed 8 years ago
#4248 closed defect (fixed)
OMEdit causes wrong simulation results
Reported by: | Owned by: | Adrian Pop | |
---|---|---|---|
Priority: | blocker | Milestone: | 1.11.0 |
Component: | Frontend | Version: | |
Keywords: | Cc: | a.haumer@…, Lennart Ochel, Martin Sjölund, Patrick Täuber, jhagemann, Adeel Asghar, Adrian Pop |
Description
Please consider the attached simulation example IMCNominalOperation.NominalOperation
. Run the example and compare the variables
powerSensor.y.re
imc.powerBalance.powerStator
These two variables must be equal and they are equal in Dymoa. In OpenModelica there exists a deviation by the factor of 3.
As all the voltages and currents are OK, the problem seems to be related with the evaluation of Modelica.Electrical.QuasiStationary.MultiPhase.Functions.activePower
.
This issue refers to:
OMEdit 1.12.0~dev-156-g85fb2b9 Connected to OpenModelica 1.12.0~dev-328-g4f7ddab Linux Mint 18.1 64bit
Attachments (3)
Change History (24)
by , 8 years ago
Attachment: | IMCNominalOperation.mo added |
---|
comment:1 by , 8 years ago
Cc: | added |
---|---|
Component: | OMEdit → Run-time |
Owner: | changed from | to
Status: | new → assigned |
This might be a Linux issue as they appear same on Windows 64-bit.
by , 8 years ago
Attachment: | plot-win64.png added |
---|
follow-up: 9 comment:2 by , 8 years ago
Cc: | added |
---|---|
Component: | Run-time → Backend |
Summary: | OpenModelica causes wrong simulation results → wrapFunctionCall causes wrong results |
It works for me without the recently enabled modules wrapFunctionCall module.
A work-a-round is to disable it by +postOptModules-=wrapFunctionCalls
.
@adeas31 Can you verify that this module was enabled and it still works on Windows.
comment:3 by , 8 years ago
Milestone: | Future → 1.12.0 |
---|---|
Owner: | changed from | to
Status: | assigned → accepted |
follow-up: 6 comment:5 by , 8 years ago
Milestone: | 1.12.0 → 1.11.0 |
---|---|
Priority: | high → blocker |
follow-up: 7 comment:6 by , 8 years ago
Cc: | added |
---|
Replying to wbraun
Milestone changed from 1.12.0 to 1.11.0
Why did you change milestone to 1.11.0? The module wrapFunctionCalls
will be introduced as feature with version 1.12.0.
follow-up: 10 comment:7 by , 8 years ago
Replying to lochel:
Replying to wbraun
Milestone changed from 1.12.0 to 1.11.0
Why did you change milestone to 1.11.0? The module
wrapFunctionCalls
will be introduced as feature with version 1.12.0.
but it seems also be enabled by default for 1.11 beta 3 as
Replying to ahaumer@...
I have the same problem on Windows64 with OpenModelica 1.11 beta 3.
comment:8 by , 8 years ago
I cannot reproduce the issue. Both signals seem to be equal. Maybe you could provide some more information on how to reproduce the issue.
comment:9 by , 8 years ago
Replying to wbraun:
A work-a-round is to disable it by
+postOptModules-=wrapFunctionCalls
.
That does not work for me, because then the simulation execution fails.
Simulation execution failed for model: IMCNominalOperation.NominalOperation DASKR-- AT T (=R1) AND STEPSIZE H (=R2) THE In above, R1 = 9.3462593976256E-10 R2 = 7.7526609695740E-20 DASKR-- ERROR TEST FAILED REPEATEDLY OR WITH ABS(H)=HMIN stdout | warning | DDASSL had repeated error test failures on the last attempted step. stdout | warning | can't continue. time = 0.000000 stdout | info | model terminate | Integrator failed. | Simulation terminated at time 9.34626e-10
comment:10 by , 8 years ago
comment:11 by , 8 years ago
Summary: | wrapFunctionCall causes wrong results → OMEdit causes wrong simulation results |
---|
Okay, my first analysis was wrong it's not wrapFunctionCall. It's strange I can reproduce the issue with OMEdit, but not on command line with the same omc version.
follow-up: 13 comment:12 by , 8 years ago
OMEdit sets -d=nogen while OMC does not. Does it impact the results?
comment:13 by , 8 years ago
Replying to sjoelund.se:
OMEdit sets -d=nogen while OMC does not. Does it impact the results?
No. I just tried the example with -d=nogen
and the two signals are still equal.
comment:14 by , 8 years ago
Cc: | added |
---|
As far as I can see, OMEdit sets the following flags to translate the model:
setMatchingAlgorithm("PFPlusExt"); getErrorString(); setIndexReductionMethod("dynamicStateSelection"); getErrorString(); setCommandLineOptions("-d=initialization"); getErrorString(); setCommandLineOptions("--simCodeTarget=C"); getErrorString(); setCommandLineOptions("--target=gcc"); getErrorString(); setCommandLineOptions("+profiling=none"); getErrorString();
However, it is not possible to reproduce the issue with this configuration. Adeel, what else does OMEdit?
follow-up: 17 comment:15 by , 8 years ago
One of signals has a unit, where the other has not. related?
comment:16 by , 8 years ago
Try calling the simulation executable from the command line with same arguments as OMEdit does.
comment:17 by , 8 years ago
Replying to anonymous:
One of signals has a unit, where the other has not. related?
Signal imc.powerBalance.powerStator
has unit W
, whereas powerSensor.y.re
has no unit. I cannot see how this could lead to difference of factor 3 between both signals.
comment:18 by , 8 years ago
Its fixed in OMEdit 015e9da/OMEdit.
The problem is caused because some of the query API function is setting some flag and then not resetting it back. Willi is investigating more about it.
comment:19 by , 8 years ago
Cc: | added |
---|---|
Component: | Backend → Frontend |
With the following script we were able to reproduce the issue:
loadModel(Modelica, {"3.2.2"}); getErrorString(); loadFile("./IMCNominalOperation.mo"); getErrorString(); getComponentAnnotations(Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines.BaseClasses.PartialBasicMachine); getErrorString(); simulate(IMCNominalOperation.NominalOperation); val(powerSensor.y.re, 0.001, "./IMCNominalOperation.NominalOperation_res.mat"); val(imc.powerBalance.powerStator, 0.001, "./IMCNominalOperation.NominalOperation_res.mat");
so the if
getComponentAnnotations(Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines.BaseClasses.PartialBasicMachine);
is executed you get different results, otherwise the variables are equal.
comment:20 by , 8 years ago
Owner: | changed from | to
---|
comment:21 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Fixed in d9d4df/OMCompiler.
Added test in 5727bc/OpenModelica-testsuite.
Esimulation example demonstrating the issue