Description Usage Arguments Value See Also Examples
View source: R/defaultScript.R
Create a default script for loading and simulating a model.
1 | defaultScript(modelName, startTime=0, ...)
|
modelName |
a string for the name of the model to be simulated. [required] |
startTime |
OpenModelica |
... |
additional arguments to be passed to the OpenModelica |
A string representation of the script.
See Also callOpenModelica
and 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 | ## 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.