Description Usage Arguments Value See Also Examples
View source: R/callOpenModelica.R
Call OpenModelica to simulate a model. Includes the facility to run multiple simulations for different parameter values.
1 2 | callOpenModelica(modelName, model, script=defaultScript(modelName),
values=NULL, omcCommand="omc",omcArgs="",omcModels="Modelica")
|
modelName |
a string for the name of the model to be simulated. [required] |
model |
a string representation of the model to be simulated. [required] |
script |
either (i) a string representation of the simulation script (see |
values |
vector of numeric values to be passed for the parameter. |
omcCommand |
string representing the command to call omc. |
omcArgs |
string representing the arguments to omc that precedes the script and library arguments. |
omcModels |
string representing the other Modelica libraries required. |
A data.frame
object from the simulation output with column names
"time" and other columns as per the simulation.
See Also defaultScript
, defaultScriptWithParameter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Not run:
model <- "
model CalledbyR
Real x(start=1.0),y(start=2.0);
parameter Real b = 2.0;
equation
der(x) = -b*y;
der(y) = x;
end CalledbyR;"
out <- callOpenModelica("CalledbyR", model)
plot(y~time, data=out, type="l")
out <- callOpenModelica("CalledbyR", model, script=defaultScript("CalledbyR",stopTime=10))
plot(y~time, data=out, type="l")
out <- callOpenModelica("CalledbyR",
model,
script=defaultScriptWithParameter("CalledbyR", "b", stopTime=10),
values=c(0.5,1,2))
if (require(ggplot2))
qplot(x=time, y=y, data=transform(out, value=factor(value)), color=value, geom="line")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.