defaultScript: Create a default script string for loading and simulating a...

Description Usage Arguments Value See Also Examples

View source: R/defaultScript.R

Description

Create a default script for loading and simulating a model.

Usage

1
defaultScript(modelName, startTime=0, ...)

Arguments

modelName

a string for the name of the model to be simulated. [required]

startTime

OpenModelica simulate argument

...

additional arguments to be passed to the OpenModelica simulate call.

Value

A string representation of the script.

See Also

See Also callOpenModelica and defaultScriptWithParameter.

Examples

 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)

mclements/ROpenModelica documentation built on May 22, 2019, 3:06 p.m.