Initialize an empty stock-and-flow model of class sdbuildR_xmile. You can either create an empty stock-and-flow model or load a template from the model library.
Arguments
- name
Name of the template to load. If NULL, an empty stock-and-flow model will be created with default simulation parameters and a default header. If specified, the name should be one of "logistic_model", "SIR", "predator_prey", "cusp", "Crielaard2022", "coffee_cup", "bank_account", "Lorenz", "Rossler", "vanderPol", "Duffing", "Chua".
Value
Stock-and-flow model of class sdbuildR_xmile. Its structure is based on XML Interchange Language for System Dynamics (XMILE). It is a nested list, containing:
- header
Meta-information about model. A list containing arguments listed in
header()
.- sim_specs
Simulation specifications. A list containing arguments listed in
sim_specs()
.- model
Model variables, grouped under the variable types stock, flow, aux (auxiliaries), constant, and gf (graphical functions). Each variable contains arguments as listed in
build()
.- macro
Global variable or functions. A list containing arguments listed in
macro()
.- model_units
Custom model units. A list containing arguments listed in
model_units()
.
Details
Do not edit the object manually; this will likely lead to errors downstream.
Rather, use header()
, sim_specs()
, build()
, macro()
, and
model_units()
for safe manipulation.
See also
Other build:
as.data.frame.sdbuildR_sim()
,
as.data.frame.sdbuildR_xmile()
,
build()
,
debugger()
,
find_dependencies()
,
get_build_code()
,
header()
,
macro()
,
plot.sdbuildR_xmile()
,
print.summary.sdbuildR_xmile()
,
summary.sdbuildR_xmile()
Examples
sfm <- xmile()
summary(sfm)
#> Your model contains:
#> * 0 Stocks
#> * 0 Flows
#> * 0 Constants
#> * 0 Auxiliaries
#> * 0 Graphical Functions
#> * 0 Custom model units
#> * 0 Macros
#>
#> Simulation time: 0.0 to 100.0 seconds (dt = 0.01)
#> Simulation settings: solver euler in R
# Load a template
sfm <- xmile("Lorenz")
sim <- simulate(sfm)
plot(sim)