- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Change Class "replaceable"
Change Class "replaceable"
Change Class "replaceable"
I'm new to OpenModelica as well as Modelica itself. I want to use the VehicleInterfaces library, but the documentation is rather short and specific to application in Dymola.
For the Tutorial1 in the library, it says to right click and change Classes for the subsystems (in Dymola). This feature is not available for OMEdit. How do you go about this in OMEdit and is there a better tutorial on vehicle, and especially drive train modelling with OpenModelica and OMEdit?
Re: Change Class "replaceable"
I’m afraid that you are entering in a difficult task, due to OpenModelica, but also to Modelica characteristics.
Regarding OpenModelica, there is no popup menu from which to select compatible models. It is a feature highly expected and that I think will be provided in the next version. I have never worked with Dymola but I think this is not the case there. In OMEdit you need to manually edit your model and change the desired part. For example if you want to change the engine to VehicleInterfaces.Engines.MinimalEngine you could write a new model redeclaring the engine like:
model VehicleTest
extends VehicleInterfaces.Examples.ConventionalManualVehicle (redeclare VehicleInterfaces.Engines.MinimalEngine engine);
end VehicleTest;
But, after this, you will find that this is not correctly working due to the second OMEdit limitation. If you try to edit graphically the engine, you will be editing the original definition of the engine, not the new one. This can be also solved with some work. You copy in your package the original model. First run it. Probably you need to write the full path of the referenced models because, as you are out of the original package, the package reference can be missing at the beginning of the name. Now that you have a runable model you can edit the model and change the declaration of the engine to VehicleInterfaces.Engines.MinimalEngine
When I tried to run the modified model I got the message that 1 equation was missing. Here begin the Modelica problems. Modelica packages can be prepared in a way that you just change an object definition by a compatible one, edit some parameters and every thing is fine. This is not the normal situation that I’m finding, many times additional modifications are needed and, in order to know what to do, you need an in depth knowledge of the package and of Modelica language. Perhaps this is not the case with the VehicleInterfaces package, I do not know.
I would recommend you to expend some time learning the Modelica language before to play with dedicated libraries.
I attach the tests I did.
Regards
Carlos
ModelicaTest19.mo
Re: Change Class "replaceable"
Thank you very much for your detailed answer. It seems, like it's not as easy as I hoped it would be.
I was working through the web book "Modelica by Example" to cover the basics, but to get to my goal, I need to start working with the libraries.
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Change Class "replaceable"