Reputation: 75
Someone has script examples for integrating R and Dymola, I want to perform Monte Carlo Simulations in a Dymola model
the main idea will be performing an uncertainty analysis regarding the integration of renewables into the system.
we have a calibrated model of a building which is heated by a gas fired boiler, and we are going to implement a solar collector and a biomass gas fired boiler and check the probability of x% of the energy demand to be covered by the integrating y% of renewables
But I am struggling to learn how I can make R sample, call my model and analyse the results
I do not have experience with R
Can anyone help me?
thanks
Upvotes: 1
Views: 120
Reputation: 6655
In addition to the possibilities listed by Markus Andres, there is another method which is used quite often:
Dymola.exe
the path to a .mos script as first argument.
Dymola will start up and immediately execute the .mos script.A minimal .mos script would be:
openModel("<path-to-model>/MyModel.mo")
simulateModel("MyModel")
Modelica.Utilities.System.exit()
Note that you can not interact with Dymola using this method, so the exit()
call is crucial. If the exit()
call is not reached for whatever reason, the Dymola.exe will continue to run as idle process and you have to kill the process from R.
The Dymola User Manual Volume 1 also mentions this feature briefly in the section Parameter studies by running Dymola a number of time in “batch mode” and gives some hints how to log messages and set the result file names.
Upvotes: 1
Reputation: 7525
I have no experience with R but Dymola offers the following possibilities to remote control it:
There is no possibility to call it directly from R as far as I know. What you can do as well is call dymosim.exe
directly and modify the dsin.txt
to get your parameters in the model.
From my experience I would tend to use the Python interface. Probably a good way could be to combine R and Python as presented here: https://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/r/rpy
Upvotes: 1