Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Scripting API to close a model

Scripting API to close a model

I'd like to develop a python script that needs to do:

1) Load a *.mo file
2) Extract the parameter settings in the model and save it in an external file
3) Close the model and exit

This script should process lots of *.mo files in different folders.

For 1), I figured out to do that by using ModelicaSystem(...) API. After calling this API, OpenModelica generated lots of intermediate files. I am wondering how to do the step 3), meaning close the model and remove all these intermediate files automatically.

Any suggestion would be much appreciated.

Thanks.

Kai

Re: Scripting API to close a model

tjroamer wrote:

After calling this API, OpenModelica generated lots of intermediate files

After initiating

Code:

ModelicaSystem

the model will be build at the current working directory and as a results you got the executable and xml to run the simulation. As far as i know, there are no option to to delete the intermediate files automatically.

At top of my head, you can make a subclasss of

Code:

ModelicaSystem

and add a routine to delete the c-files.

Re: Scripting API to close a model


Yes, this approach will eliminate the necessity of deleting files in the code at the application level. Many thanks for the suggestion.

There are 0 guests and 0 other users also viewing this topic
You are here: