Select Git revision
blueprint.md

Christoph Pohl authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
blueprint.md 4.92 KiB
- OpenModelica functions
- global reminder:
- omOpen(self)
- omTranslate(self)
- omApplyModifier(self, modifiersList)
- omSimulate(self, simOptions = "", resultName = "simResults")
- omSimulateMultiResults(self, resultName = "simResult", simOptions = "", initialNames="", initialValues="", resultNames="")
- omGetResultsFast(self, resultName = "simResult", outputVarList = [])
- omGetResults(self, resultName = "simResult", outputVarList = [])
- omGetResultVarNames(self, resultName = "simResult")
- omClose(self)
OpenModelica functions
pseudocode for the om-functions
self wont be described in parametersections
global reminder:
- check for
None
as result for functions that call OpenModelicas internal API
omOpen(self)
- @params: none
- set up a OM server
[ ] OMCSession- ModelicaSystem
- set options like
dymOpen()
does ?
omTranslate(self)
- @params: none
-
should compile the model (to FMU?) - compile the model to c code?
- Already done in ModelicaSystem's constructor?
- precisely in with the call to its internal API
- Already done in ModelicaSystem's constructor?
- check the result and catch exception
omApplyModifier(self, modifiersList)
-
@params:
-
modifiersList:
- format: [['submodule1','param1','value1'],['submodule2','param2','value2'],...]
-
modifiersList:
- change the given parameters with the coresponding value
omSimulate(self, simOptions = "", resultName = "simResults")
-
@params:
-
simOptions:
- simply add as parameter to
ModelicaSystem.setSimulationOptions(_simOptions_)
? - are these options like eg.
startTime
?
- simply add as parameter to
-
resultName:
- not needed as OpenModelica automatically writes the results to a file called "modelName_res.mat"
- TODO check how to aply these options (does such an option exist?)
- set options
- call ModelicaSystem's
simulate()
function
-
simOptions:
omSimulateMultiResults(self, resultName = "simResult", simOptions = "", initialNames="", initialValues="", resultNames="")
-
@params:
-
resultName:
- string with name of the file, the result should be written to
-
simOptions:
- ?
-
initialNames:
- ?
-
initialValues:
- ?
-
resultNames:
- not needed as OpenModelica automatically writes the results to a file called "modelName_res.mat"
-
resultName:
- TODO check which options are available
- see omSimulate for further informations
omGetResultsFast(self, resultName = "simResult", outputVarList = [])
-
@params:
-
resultName:
- not needed as OpenModelica automatically writes the results to a file called "modelName_res.mat"
-
outputVarList:
- array with the wanted variables
-
resultName:
- return an numpy.array containing the trajectories for the variables in outputVarList using ModelicaRes's
SimRes()
function
omGetResults(self, resultName = "simResult", outputVarList = [])
-
@params:
-
resultName:
- not needed as OpenModelica automatically writes the results to a file called "modelName_res.mat"
-
outputVarList:
- array with the wanted variables
-
resultName:
- values are read from the file with the name
resultName
- return numpy.array with the results for the given variables
- OpenModelica's function
getSolutions()
- check if the variablesNames are in it
- get value with
getSolutions(variableName1, variableName2,...)
, where variableName is a string containing the wanted variables's name
omGetResultVarNames(self, resultName = "simResult")
-
@params:
-
resultName:
- not needed as OpenModelica automatically writes the results to a file called "modelName_res.mat"
-
resultName:
- return the variable names from the simulation result
- OpenModelica's function
getSolutions()
omClose(self)
- @params: none
close the OpenModelica session withModelicaSystem.getconn.sendExpression(close())
like here- set the ModelicaSystem-Object
self.__omObj
toNone
- ModelicaSystem handles shutdown of OMCSession etc. in its Destructor