#3656 closed defect (fixed)
Current removeSimpleEquation module causes leading sign error
Reported by: | Owned by: | Willi Braun | |
---|---|---|---|
Priority: | blocker | Milestone: | 1.9.4 |
Component: | Backend | Version: | |
Keywords: | Cc: | christian.kral@… |
Description
I'm developing some new components for teaching, please have a look at the enclosed small library. When simulating the Elevator example, plot cabin.s and cabin.v - I'm surprised why with cabin.s increases with a negative cabin.v. The equations in component MassGravitation v=der(s) seem correct. In an other simulation environment (Dymola) the result is correct.
Attachments (2)
Change History (18)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Hi,
I guess you have issues with a bug in Trac because of German default language in browser.
You can go to Preferences->Language and set it to English US and then try to attach again.
Cheers,
Adrian Pop/
comment:3 by , 9 years ago
This issue occurs with OpenModelica 1.9.4~dev-695-g5815c70, both in Windows and Linux 64bit.
comment:4 by , 9 years ago
Just to clarify the ticket. The equations of motion in class MassGravitation are
v = der(s); a = der(v);
I therefore expect that the positive slope (derivative) of cabin.s results in a positive velocity cabin.v -- which is not the case. Additionally, the acceleration shall be positive at the beginning of the simulation and negative towards the end of the simulation.
It is thus obvious, that the signs of the curves of cabin.v and cabin.s are wrong, even though the result of cabin.s is correct; I attached a PNG file of the simulations results.
This is a severe problem.
comment:5 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Willi, can you have a look at this?
comment:6 by , 9 years ago
Status: | assigned → accepted |
---|
comment:7 by , 9 years ago
Component: | *unknown* → Backend |
---|---|
Milestone: | Future → 1.9.4 |
Priority: | high → blocker |
Status: | accepted → assigned |
It seems to be again a nasty alias elimination bug in the current removeSimpleEquation module,
since it works correct with the new implementation and also without removeSimpleEquation at all.
comment:8 by , 9 years ago
Summary: | mysterious result → Current removeSimpleEquation module causes leading sign error |
---|
comment:9 by , 9 years ago
There must be a reason why the new implementation is not yet used regularily. Would it be possible to just disable negative aliases for now?
comment:10 by , 9 years ago
Something must be done urgently if OpenModelica produces such wrong results. I tested to disable the detection of negated aliases, in order to get an impression of the impact. This would be one option, in case the root cause is not found in the old implemenation and the new implementation is not yet ready.
See changes in Compiler/BackEnd/RemoveSimpleEquations.mo, function SimpleEquationAcausal:
https://github.com/rfranke/OMCompiler/commit/11832fc4634093926b9074ce343c8e4cbed3662d
The Hudson test results are not that bad, see:
https://test.openmodelica.org/hudson/job/OpenModelica_TEST_PULL_REQUEST/1578/
Here is simulation_modelica_others.EngineV6_output.mos for an example -- less alias eliminations result in less warnings for inconsistent start values:
-There have been 1441 SCCs and now there are 554 SCCs. +There have been 1295 SCCs and now there are 596 SCCs. record SimulationResult resultFile = "EngineV6_output_res.mat", simulationOptions = "startTime = 0.0, stopTime = 1.01, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'EngineV6_output', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", messages = "" end SimulationResult; -"Warning: Alias set with several free start values -* candidate: cylinder1.Cylinder.s(start = -0.3) -* candidate: cylinder1.gasForce.s_rel(start = 0.0) -=> select value from cylinder1.Cylinder.s(start = -0.3) for variable: cylinder1.Cylinder.s -Warning: Alias set with several free start values -* candidate: cylinder2.Cylinder.s(start = -0.3) -* candidate: cylinder2.gasForce.s_rel(start = 0.0) -=> select value from cylinder2.Cylinder.s(start = -0.3) for variable: cylinder2.Cylinder.s -Warning: Alias set with several free start values -* candidate: cylinder3.Cylinder.s(start = -0.3) -* candidate: cylinder3.gasForce.s_rel(start = 0.0) -=> select value from cylinder3.Cylinder.s(start = -0.3) for variable: cylinder3.Cylinder.s -Warning: Alias set with several free start values -* candidate: cylinder4.Cylinder.s(start = -0.3) -* candidate: cylinder4.gasForce.s_rel(start = 0.0) -=> select value from cylinder4.Cylinder.s(start = -0.3) for variable: cylinder4.Cylinder.s -Warning: Alias set with several free start values -* candidate: cylinder5.Cylinder.s(start = -0.3) -* candidate: cylinder5.gasForce.s_rel(start = 0.0) -=> select value from cylinder5.Cylinder.s(start = -0.3) for variable: cylinder5.Cylinder.s -Warning: Alias set with several free start values -* candidate: cylinder6.Cylinder.s(start = -0.3) -* candidate: cylinder6.gasForce.s_rel(start = 0.0) -=> select value from cylinder6.Cylinder.s(start = -0.3) for variable: cylinder6.Cylinder.s -" -561.477558467 +"" +561.4775584669927 ""
comment:11 by , 9 years ago
These Warning are called from the RemoveSimpleEquations-module if the start values of alias variables have to be merged. If you are detecting less alias variables you will have less conflicts with different start-values. It only means, that more variables are computed and therefore dont cause start-value conflicts.
comment:12 by , 9 years ago
Hopefully,
https://github.com/OpenModelica/OMCompiler/commit/a2d3cf252a3bc9f8ccfa986745a2a72edbee1a5e
fixes the problem properly. Lets wait for the library tests if nothing else breaks.
comment:13 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It seems, that everything works. I will close the ticket.
comment:14 by , 9 years ago
Commit https://github.com/OpenModelica/OpenModelica-testsuite/commit/13d3e9d7daf062613ccfc14a46baf357386d03c2 adds the provided example as test.
I can't attach the library.
Please tell me where and how I can register for the OpenModelica trac.
I'm using OpenModelica for teaching, and I'm already registered at OpenModelica.org.