-
Notifications
You must be signed in to change notification settings - Fork 59
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
ModelicaSystem.simulate() does not handle 'outputFormat' and 'variableFilter' options correctly. #151
Comments
You should use @arun3688 is it possible to set this in ModelicaSystem? |
@Nobby-n To set the result file format when using ModelicaSystem you can set the result file via simulate API, something like below
You cannot use |
@adeas31 san, @arun3688 san I understand how to use 'simulate ()' as in your comment. |
@Nobby-n It is not possible to use variable filter as a runtime simulation flags, but however you can use the
|
@arun3688 san I'd confirmed that I can get only the variables I need using One of the reasons I want to use For example, in the
|
@Nobby-n Now the variable filter option is added to
You can directly use it in |
The approach from @Nobby-n applies the customization (variableFilter or overrides in general) when calling the pre-built model executable whereas the current implementation of @arun3688 applies the variableFilter before when calling buildModel. I think both approaches are interesting! There might be use cases where calling It would be necessary to tell ModelicaSystem not to call
I would appreciate if we can have this in OMPython. I have already integrated this proposal in my fork of OMPython and I am ready to send a pull request. What do you think? |
@Nobby-n Please make a PR |
@joewa yes your PR is noted |
@joewa Me too, your pull request is notified. |
Overview
The argument '-override' of (model).exe has the following syntax
(model).exe -override=startTime=0,stopTime=5,stepSize=0.01,tolerance=1e-06,solver=dassl,mdl.param1=0.5,mdl.param2=2.0,outputFormat=csv,variableFilter=. *
ModelicaSystems.simulate() will give the '-override' option if parameters or simulation options are set using setParameters() or setSimulationOptions().
In this case, 'outputFormat' and 'variableFilter' cannot be specified.
To specify 'outputFormat' and 'variableFilter', I added options to the 'simflags' argument as below, but after using setParameters() or/and setSimulationOptions(), '-override' is double argument and simulate() does not work properly.
mod.simulate(simflags='-override=startTime=0,stopTime=5,stepSize=0.01,tolerance=1e-06,solver=dassl,outputFormat=csv,variableFilter=.*')
Operating Environment
Windows 10 Enterprise ver 20H2
OpenModelica 1.16.2 MSL3.2.3
Python 3.9.6
OMPython 3.3.0
Tentative measures
Do not use setParameters(), setSimulationOptions(), and specify all 'override' options using simFlags.
simulate() improvement suggestions
Add arguments to specify 'outputFormat' and 'variableFilter' and add code to append them to the '-override' statement.
The tested 'simulate()' modifications are as follows.
The text was updated successfully, but these errors were encountered: