-
Notifications
You must be signed in to change notification settings - Fork 21
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
CheckContactCalculation and other Roads.Internal models fail in OpenModelica #18
Comments
I cannot find any problem when checking in Dymola.
Actually, there are two "inner" components in VehicleInterfaces.Roads.Internal.CheckContactCalculation and not just one:
So the issue could be that the inner road is looked for in the road component itself. But I don't believe this is a bug. |
Yes, you are right. My guess (and probably we are saying the same thing):
So there is a sort of loop. Anyway, in OpenModelica CheckContactCalculation does not work. I don't know if declaring a component as 'outer' and being at the same time part of the 'inner' instance is allowed, but it would sound strange to me. BTW, the error log reports that it finds only one 'inner' declaration because the other 'inner' declaration (i.e. road) is actually what is causing the issue! That's probably why it is not reported in the list of 'inner'-declared components. The second error, instead, I think is generated because the compiler is disregarding the 'outer' attribute of the road variable contained inside VisualizeSimpleRoads and, since it is declared as a Base class, it's throwing an error. But this is not the main cause, it is just a compiler rollback! |
I guess your analysis is right. I have looked at Modelica Language Specification for inner/outer definition. It is defined in Section 5.4 Instance Hierarchy Name Lookup of Inner Declarations and differs depending on the Specification version.
I guess this could be the point. Can you consult this with OpenModelica's team? |
Unfortunately I don't have any contact with OpenModelica developers. I would suggest to modify VisualizeSimpleRoads in this way: the road variable is used only to pass the position function to the underlying Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface, through the surfaceCharacteristic encapsulated function. In short: VisualizeSimpleRoads should have an input, namely Now: FlatRoad, while instantiating VisualizeSimpleRoads, should now provide not only However, I tried this solution and it does not work as it is... In particular about the Roads interface class... |
This can be easily helped: |
Well... Opened post in OpenModelica forum: |
@dariomangoni OpenModelica dev here, I'll just answer here instead of the forum since the main discussion is here. You're right, it's not clear in the specification whether that's allowed or not. But it also doesn't seem to be the actual issue, because OMC currently goes into an instantiation loop for your example model. That is to say, if the model actually looked like that you wouldn't get the error you're getting, the compiler would just crash. The frontend in the current version of OMC has many issues with inner/outer though, so this looks like just another bug in it. We've been working on replacing the old frontend with a completely new one (the old one might charitably be called "hard to maintain"), but it's still work in progress. But using the new frontend (with the command line option But as I said it's not quite ready yet, and the model currently fails to simulate because we're still missing support for overconstrained connections. We're working on that and hope to have it in any day now. So that particular model should probably simulate soon with OpenModelica, although I can't say how well the rest of the library will work. Only about 1/3 of the MSL simulate correctly using the new frontend right now, but it's rapidly improving. |
Propagating this function makes things complicated. Inner/outer is in contrast nice if it works properly. |
I had a look at the current state of the model in OpenModelica, and noticed it no longer flattened with the new frontend anymore. It was just a minor issue that I've fixed now, and I added the VehiceInterfaces library to our automatic coverage testing to avoid further regressions. The state of the library should be viewable at https://libraries.openmodelica.org/branches/newInst/VehicleInterfaces/VehicleInterfaces.html in a couple of hours if everything goes smoothly. Using the new frontend (compiler flag |
I believe PR #47 may be a fesible solution but still prefere the existing implementation. Even the comment #18 (comment) above states this shall be working now in OM as well. |
Yes, in OMC it's working but only with the new frontend, that turns out to be quite bugged for other perspectives. If I look at the MSL, for example in Again, you all have a wider experience than me. Mine it's just an idea. |
The existing implementation is definitely more simple to use - for exactly there is no additional input "position" the user has to care about. And as long as it is conform to Modelica Specification, there is no reason to prefer #47 over it. |
Models contained inside Roads.Internal suggest that something is not working properly.
Any Check_____ function report the following error:
It seems that those components (such as DummyTyre) that require an inner declaration of road are not connecting to the inner declaration that is actually found in Check______ models.
But here is the thing: I suppose that probably the error is in Internal.VisualizeSimpleRoads @480 at the line
outer VehicleInterfaces.Roads.Interfaces.Base road;
.Commenting it, everything works fine.
I didn't make a Pull Request, because I'm not sure of the solution.
The text was updated successfully, but these errors were encountered: