Skip to content

Conversation

@Nmichele29
Copy link
Contributor

Related Issues

Purpose

Enables the possibility to instanciate a ModelicaSystem object without compiling the Modelica model called, therefore allowing the user to modify values of structural parameters through mod.sendExpression("setParameterValue(model, parameter, value)", parsed = False) and only compiling the model manually with mod.buildModel() once the values are modified. This way, we can avoid to compile the model when we call the ModelicaSystem constructor, change structural parameters and have to compile the model again to take the changes in account.

Approach

A new optional argument build is added to the ModelicaSystem constructor, which is a boolean value defaulting to True. The mod.buildModel() line in constructor is then enclosed in a if loop controlled by the value of build.

Nmichele29 added 2 commits May 7, 2025 18:22
Adds the build argument to ModelicaSystem constructor
@Nmichele29
Copy link
Contributor Author

Nmichele29 commented May 8, 2025

I'm sorry about these back and forths, am I in the right repositary this time ?

Also, through a little testing my change does raise an uncontrolled error message if one tries to simulate a model or other operations needing a compiled model without ever building it (by setting build to False and never calling mod.buildModel(). Should I add some Boolean check to make sure the model is built before simulated and raise some kind of error in the concerned methods if not ?

@casella casella requested a review from arun3688 May 8, 2025 08:31
Copy link
Collaborator

@arun3688 arun3688 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nmichele29 Currently the tests are failining because of trailing whitespaces can you remove all the trailing whitespaces and then commit your code, if you are using vscode, just open the file and press remove trailing whitespaces

@Nmichele29
Copy link
Contributor Author

Ok thanks for the help, I hope it's good now !

@arun3688 arun3688 merged commit 5d67225 into OpenModelica:master May 8, 2025
5 checks passed
@arun3688
Copy link
Collaborator

arun3688 commented May 8, 2025

@Nmichele29 Thanks for the contribution

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

Successfully merging this pull request may close these issues.

2 participants