-
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
One model of PNLib got broken #8381
Comments
Thanks @mahge! @AnHeuermann you were mostly involved with those commits, could you please check what went possibly wrong with ArcswithPCtoTC3 in those four days? Thanks! |
I don't think the error should be because of 1cbaefaede. In that case the error message should be different. But I can try to quickly build and test on that an the previous commit. |
I checked the
Maybe it could be 8df2386 if PNLib uses |
I broke a lot of PNlib in #8117, which was intended to work around issues where references to 0-size arrays remained in the flat model. Since it didn't work with PNlib for unknown reasons I reverted it in #8140 and instead attempted to fix the issue by replacing such crefs with appropriate array expressions, so I assume that's what broke Reverting everything is not an option since it fixes many issues in Buildings and other libraries, and it also fails in a similar way when using the old frontend. So it would be good if someone familiar with the backend could take a closer look, it might be something we need to change in the frontend but I'd need some guidance on what exactly is causing the issue. |
- remove dividing pivot row by pivot element > it would need an update of rhs - refers to ticket OpenModelica#8381
i mistakenly linked this issue to a PR which solves another, sorry! Although the changes might actually fix this, let's see! |
@kabdelhak, last ditch reminder, could you have a look before 1.19.0 is released. @perost gave some hints in his comment. |
@casella Looking into it this week. |
I looked at
Which mathematically makes no sense due to I adapted the PNLib (
CORRECT:
We could also work with some kinds of infinity tokens, but as far as i can see there is no syntax for that in modelica so it is not allowed? Furthermore i have to say that this just fixes part of the regression and the model passes to simulation again. It still fails to initialize though. |
Using a dense solver instead of a sparse solver works for the initialization ( I don't really know much about this kinsol sparse solver and why it fails here... |
https://specification.modelica.org/master/arrays.html#reduction-expressions says the result is defined as the "Greatest value of type". |
The specification is a bit weird in this regard, because it does define |
So should we do it in the Frontend? Since when you evaluate the array to be empty the type also vanishes right? We would need to do it at that point to know what the return type is. |
Yes, I will add a simplification rule or something for it. |
I changed the NF to evaluate min/max of empty arrays in #8904. I think we avoided doing that on purpose earlier because that's what the OF did, so I'm not entirely sure if this is a good idea. But I guess we'll see. |
Thank you! For now i cannot see any disadvantage of evaluating this but time will tell i guess. We already found the problem for the remaining issue of the sparse solver failing. Apparently functions cannot be partially differentiated and therefore any jacobian containing a function is computed numerically (i did not know that, in the NB it aready should be possible), That would not be much of an issue since in the case there is a function which would force the Backend to do it numerically, but somehow it misses this fact due to the tuple assignment.
This also gets detected as function call, but only if The quick solution would be to catch this earlier and just compute the numerical one. I am currently trying to find where that happens. The most correct way would be to implement partial function differentiation properly, but that takes much time and i don't know if its worth since it will work in the NB. |
@kabdelhak: Is the backend generating such equations? The frontend should remove 0-sized variables that are assigned in tuples, since those variables don't exist in the flat model. So if you get such equations from the frontend then there's a bug somewhere. |
Nono it gets removed, i guess the underscore is the real problem:
By the way, are you sure your evaluation thing for empty arrays works? It did not work for the PNLib model and i tried this minimal model:
It did not seem to work, maybe i am missing something? Or maybe it does not work for nested calls? |
Ah, sorry. I didn't consider that we replace 0-sized variables with |
The simplification of |
@perost, @kabdelhak, thanks for the good work! Once we see proof that the problem is resolved on master, please cherry-pick it to maintenance/v1.19, so we avoid the regression in the upcoming release. |
- updates the evaluation of function bodies to remove empty outputs (wild cards) - allows correct detection of unability to differentiate functions - fixes ticket OpenModelica#8381
- updates the evaluation of function bodies to remove empty outputs (wild cards) - allows correct detection of unability to differentiate functions - fixes ticket #8381
PR #8913 fixes the problem. I expanded the module |
Should i take the commit from @perost and mine and cherry-pick that to the v1.19? Is there a third one that needs to be included? |
If you cherry-pick you should take both of my commits, i.e. #8904 and #8909. But yeah, we should probably wait for the library tests first. |
Just tried the ArcswithPCtoTC3 model on the latest 1.20.0-dev nightly build on my PC and it works fine. @kabdelhak if you can take care of the cherry-picking into maintenance, I can then test it with the 1.19.0-beta.2, and then close the ticket if all's fine there. Thank! |
PNLib is now back at 100% also on the CI test results. All's well that ends well 😃 @kabdelhak can you please cherry-pick your fixes into |
- updates the evaluation of function bodies to remove empty outputs (wild cards) - allows correct detection of unability to differentiate functions - fixes ticket OpenModelica#8381
Cherry-Pick PR: #8974 |
* Evaluate min/max of empty arrays (#8904) * Add simplification rules for `min({})`/`max({})` (#8909) * [BE] update evalFunction (#8913) - updates the evaluation of function bodies to remove empty outputs (wild cards) - allows correct detection of unability to differentiate functions - fixes ticket #8381 Co-authored-by: perost <perost86@gmail.com>
Works fine in 1.19.0-dev.beta4 |
The PNLib library by @lochel worked 100% in omc 1.18.0, see overview report. For some reason, something got wrong in the current 1.19.0-dev version, causing the ArcswithPCtoTC3 model to fail at runtime with this error:
This is kind of weird, I don't understand why nonlinear systems should be involved in the solution of PN models at all. @lochel, could you comment on that?
@mahge, @adrpo, could you help me finding when the regression took place? I remember you showed me how to do that, but I lost track of it.
If nonlinear systems are not to be expected, then I guess @kabdelhak should check if there is something wrong with causalization.
The text was updated successfully, but these errors were encountered: