OMPython icon indicating copy to clipboard operation
OMPython copied to clipboard

Enhancements required for multi-simulation scenarios

Open prat33kg opened this issue 5 years ago • 1 comments

Using getXXXX() method from ModelicaSystem class loads the results and parameter values from the resultant MAT file with the default name "model_name_res.mat". But if the same model has to be simulated multiple times by changing certain parameters, the resulting MAT file gets overwritten for each simulation iteration and comparing the results with the previous simulations is not possible. Therefore I would like to suggest following two enhancements in the existing OMPython library and in particular ModelicaSystem class:

  1. Allow the user to provide a name or suffix for the generated resultant MAT file
  2. Allow the user to define the path to the MAT file from which they want to read the results or parameters using getXXXX()/getXXXX(S) method.

Also added the same as a ticket on trac as: https://trac.openmodelica.org/OpenModelica/ticket/5378

prat33kg avatar Mar 08 '19 09:03 prat33kg

@PatronusCoder This is implemented with this commit https://github.com/OpenModelica/OMPython/commit/f64925b182436a49a03bee38c2b3f6e2167392e9 Now you can specify your own result file using the following getXXX method

omc.simulate(resultfile="tmpres.mat")`
omc.getSolutions("time", resultfile="tmpres.mat")

If the result file is not specified the default resultfilename is used on both the API calls

However, for comparison of different result file you can use getSolutions () something thing like below, You can also use getSolution() method to directly read a result file, if the resultfile is available in some location.

omc.getSolutions("time", resultfile="tmpres1.mat")
omc.getSolutions("time", resultfile="tmpres2.mat")

arun3688 avatar Sep 04 '19 14:09 arun3688