Skip to content
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

Uniform ways to provide custom package path to simulators #402

Open
milicag opened this issue Feb 26, 2021 · 0 comments
Open

Uniform ways to provide custom package path to simulators #402

milicag opened this issue Feb 26, 2021 · 0 comments

Comments

@milicag
Copy link

milicag commented Feb 26, 2021

Dymola and Optimica simulators have a small discrepancy in the input argument that represents the path to the package containing the root of the model path. In essence theDymola simulator allows the packagePath to be both till the and into the package.mo containing folder. Optimica simulator works with the packagePath only till the package.mo containing folder. Please see examples below.

Let us assume the path to our package is not exported to MODELICAPATH, as it is some custom path we'd like to provide. To demonstrate this discrepancy, I will simulate using Dymola and Optimica a model currently located in the ChillerPlant package, on a development branch of the OBC repo.

To successfully run the Dymola simulator I can type any of the following:

from buildingspy.simulate.Dymola import Simulator
s = Simulator("ChillerPlant.ClosedLoopBase.OneDeviceWithWSE", packagePath="/home/milicag/repos/obc/examples/case_study_2/ChillerPlant")
s.simulate()

or

from buildingspy.simulate.Dymola import Simulator
s = Simulator("ChillerPlant.ClosedLoopBase.OneDeviceWithWSE", packagePath="/home/milicag/repos/obc/examples/case_study_2")
s.simulate()

If I use the full package path from the first code block to run the Optimica simulator, I run into an error I copied below from the outputted json file:

from buildingspy.simulate.Optimica import Simulator
s = Simulator("ChillerPlant.ClosedLoopBase.OneDeviceWithWSE", packagePath="/home/milicag/repos/obc/examples/case_study_2/ChillerPlant")
s.simulate()
{
    "model": "ChillerPlant.ClosedLoopBase.OneDeviceWithWSE",
    "translation": {
        "success": false,
        "exception": "ModelicaClassNotFoundError: Class ChillerPlant.ClosedLoopBase.OneDeviceWithWSE not found",
        "cpu_time": 0.6208348274230957
    },
    "simulation": {
        "success": **false**
    }

If I then change the packagePath as follows, I can run the Optimica simulation successfully:

from buildingspy.simulate.Optimica import Simulator
s = Simulator("ChillerPlant.ClosedLoopBase.OneDeviceWithWSE", packagePath="/home/milicag/repos/obc/examples/case_study_2")
s.simulate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant