Skip to content Skip to sidebar Skip to footer

Ompython Using Custom Model With External Package

I am trying to simulate custom model using external package ModPowerSystems, and use OMPython to do some automation. my code is: from OMPython import OMCSessionZMQ from OMPython im

Solution 1:

It seems you have a component named "time" in the MainModel.mo at line 12?


Older answer below (the question changed).

There are several issues. If you load package.mo the entire library will be loaded so you don't need to give it once again in the list of libraries. Also, if you give library ModPowerSystems in the list of libraries you should not give any other internal packages ModPowerSystems.X.Y for example in the list.

The code should look like:

mod=ModelicaSystem(str(source_dir)+"/simulator/ModPowerSystems/package.mo",
                    "ModPowerSystems.CustomModule.Examples.BasicGrids.MainModel",
                    ["Modelica"])

Another issue is "Error: Cannot instantiate ModPowerSystems.CustomModule.Examples.BasicGrids.MainModel due to class specialization PACKAGE". Which means that the class you are trying to simulate: ModPowerSystems.CustomModule.Examples.BasicGrids.MainModel is not a model, is a package which cannot be simulated. Maybe there are models inside that package that you need to select.

There are other issues like missing names in the package.order files in the library but those are just warnings and let's ignore them for now.

Post a Comment for "Ompython Using Custom Model With External Package"