-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OM fails to compile model with boolean nominals #6977
Comments
Yes this is the same issue as the one you linked (https://trac.openmodelica.org/OpenModelica/ticket/5783) You can try compiling your models with the flag |
@mahge Thanks, that seems to do the trick with this issue! However some other problems emerged. I let to decide yourself, if to close this, or keep it open to fix. The proposed workaround works, although maybe because of that its impossible to finish the simulation. |
@filip-jezek If I understand you correctly you did not disable tearing? But this is the exact type of error for which Btw. loadFile("Physiolibrary/package.mo"); getErrorString();
simulate(Physiolibrary.Hydraulic.Examples.MeursModel2011.HemodynamicsMeurs_flatNorm); getErrorString(); using
|
@AnHeuermann Originally I have not disabled tearing, once I use the --tearingMethod=minimalTearing it runs correctly. Have you used the Physiolibrary version I have linked? It has some new modifications (that is chattering protection) which are causing the problem and which are not present in the Physiolibrary included in the OpenModelica. Once you confirm you used the updated Physiolibrary, I can definitely test the nightly build. |
I have further problems with more complex model, but I was unable to isolate or name it, so I created a forum post instead of a bug report here https://openmodelica.org/forum/default-topic/3148-om-fails-to-run-with-compilation-errors,-dymola-runs-fine#p10372 |
My bad, now I'm getting the error as well. It's an error in Cellier Tearing we need to fix. But the example is a bit to big to debug it. |
We should probably close one of the two tickets to keep the discussion in one place. @AnHeuermann which one do you want to keep? |
I prefer the GitHub issues, so I closed https://trac.openmodelica.org/OpenModelica/ticket/5783. |
@AnHeuermann and I looked at this ticket and have a pretty good idea on how to solve it. I will try to do it this until the end of next week. |
- solves ticket OpenModelica#6977 - new function that takes a context and calls the correct equation create function (for now only jacobian/normal) - used inside if equations to actually create jacobian if equations (seems to never have been used because it couldn't work) - small fix in backend to have correct size of if equations in advanced adjacency matrices
I created a pull request that solves the issue: #6985 The basic problem was: In the backend we created the wrong equation size for if equations in enhanced adjacency matrices so it created too many rows for it -> tearing failed -> entirely untorn system was created -> it still has discrete iteration variables -> fail. (minimalTearing does not depend on enhanced adjacancy matrices so that worked). After that i encountered an issue with jacobian equation generation because the if-equation handling was not correct since it actually never came to use because of the backend bug. Whoever implemented that in the first place did a good job i only had to change few things to make it possible. We still get some errors and warnings:
But as you can see it overall works. The errors have to be further investigated because that still seems like a tearing bug. I attached the result file if you want to have a look at it and see if it is sensible. Physiolibrary.Hydraulic.Examples.MeursModel2011.HemodynamicsMeurs_flatNorm_res.zip |
- solves ticket #6977 - new function that takes a context and calls the correct equation create function (for now only jacobian/normal) - used inside if equations to actually create jacobian if equations (seems to never have been used because it couldn't work) - small fix in backend to have correct size of if equations in advanced adjacency matrices
The PR is pushed and did not cause any new issues. If you pull and build the latest version from source you could test this yourself. |
- do not count pre(cr) as occurence of cr - related to issue OpenModelica#6977
I also fixed the other problem with the errors in #6988 . We basically did not correctly convert the if-equations to if-expressions. The warnings are valid though. In your case you are checking a parameter so you know what it is gonna be, but to be sure i would always use I changed the resistor to be:
And it runs without complains under my newest changes. Note that |
- do not count pre(cr) as occurence of cr - related to issue #6977
Last PR has also been pushed, as i said everything runs smoothly now. You can build from source or pull the latest nightly build to test it. Feel free to reopen the ticket if anything still does not work. |
Description
OpenModelica has problems generating equation for complex boolean variables. Here I demonstrate it on a simple circulatory. case
When the ideal diode is extended by chattering protection, then it fails to compile. Remove the chattering protection and it runs fine.
The compilation produces translation error for each of the four valves in the messages browser:
[8] 12:12:21 Translation Error
Internal error - BackendDAEOptimize.makeEquationToResidualExp failed to transform equation: TricuspidValve.open = TricuspidValve.passableVariable > 0.0 to residual form!
and in the simulation ouptut window:
Physiolibrary.Hydraulic.Examples.MeursModel2011.HemodynamicsMeurs_flatNorm_02nls.c: In function 'initializeStaticDataNLS279':
Physiolibrary.Hydraulic.Examples.MeursModel2011.HemodynamicsMeurs_flatNorm_02nls.c:89:97: error: 'BOOLEAN_ATTRIBUTE {aka struct BOOLEAN_ATTRIBUTE}' has no member named 'nominal'
sysData->nominal[i] = data->modelData->booleanVarsData[15].attribute /* TricuspidValve.open /.nominal;
^
Physiolibrary.Hydraulic.Examples.MeursModel2011.HemodynamicsMeurs_flatNorm_02nls.c:90:97: error: 'BOOLEAN_ATTRIBUTE {aka struct BOOLEAN_ATTRIBUTE}' has no member named 'min'
sysData->min[i] = data->modelData->booleanVarsData[15].attribute / TricuspidValve.open /.min;
^
Physiolibrary.Hydraulic.Examples.MeursModel2011.HemodynamicsMeurs_flatNorm_02nls.c:91:97: error: 'BOOLEAN_ATTRIBUTE {aka struct BOOLEAN_ATTRIBUTE}' has no member named 'max'
sysData->max[i++] = data->modelData->booleanVarsData[15].attribute / TricuspidValve.open */.max;
Probably tied to this issue https://trac.openmodelica.org/OpenModelica/ticket/5783
Steps to reproduce
Grab https://github.com/filip-jezek/Physiolibrary/tree/NoSteadyState and simulate Physiolibrary.Hydraulic.Examples.MeursModel2011.HemodynamicsMeurs_flatNorm
Expected behavior
Should run. Doesnt run.
Version and OS
any workarounds appreciated.
The text was updated successfully, but these errors were encountered: