dympy¶
-
class
dympy.dympy.
Dymola
[source]¶ Class which governs the connection to Dymola
Methods
-
compile
(modelname, parameters=None)[source]¶ Compiles a modelica model with optional parameters
Parameters: modelname : string
the name of the model
parameters : dict
optional dictionary of parameters to compile with the model
Examples
>>> dymola.compile('test') >>> dymola.compile('test',parameters={'A':5})
-
get_result
()[source]¶ Loads simulation results into a dictionary
Returns: res : dict
dictionary with results, keys are the dymola variables as strings
Examples
>>> res = dymola.get_result() >>> res['test.A.B']
-
openModel
(filename)[source]¶ Opens a .mo file in Dymola
Parameters: filename : string
the name of the file
Examples
>>> dymola.openModel('C:\Python27\Lib\site-packages\dympy\test.mo')
-
run_cmd
(cmd)[source]¶ Runs a Dymola command
Parameters: par : string Examples
>>> dymola.run_cmd('clear()')
-
set_parameters
(pardict)[source]¶ Sets all values in the parameter dictionary to their value
Parameters: pardict : dict
name - value pairs for parameters
Notes
The parametes must be free to vary after compilation in modelica, this often requires setting :code`annotation(Evaluate=false)` for the parameter. If not parameters must be supplied during the model compilation
Examples
>>> dymola.set_parameters({'C1.T':300})
-
simulate
(StartTime=0, StopTime=1, OutputInterval=0, NumberOfIntervals=500, Tolerance=0.0001, FixedStepSize=0, Algorithm='dassl')[source]¶ Simulates a compiled model
Parameters: StartTime : number
simulation start time in seconds
StopTime : number
simulation stop time in seconds
OutputInterval : number
interval between the output data in seconds
NumberOfIntervals : int
number of intervals in the output data, if both OutputInterval and NumberOfIntervals are > 0 ???
Tolerance : number
integration tolerance
FixedStepSize : number
interval between simulation points used with fixed timestep methods
Algorithm : string
integration algorithm [‘dassl’,’lsodar’,’euler’,...]
Examples
>>> dymola.simulate(StopTime=86400)
-