sdLoadModel: Loads a Model from a XML File

Description Usage Arguments Details Value Examples

Description

A factory function that creates sdModelClass, sdCoupledModelClass or sdStaticModelClass object from a XML file or from the package repository (see the available models in the sdRepository documentation).

Usage

1
sdLoadModel(file, repository = F, timeSeriesDirectory = "")

Arguments

file

The XML file name with the model specification. If repository = TRUE, file is the name of a model from the sdsim repository.

repository

logical. If TRUE will use the file name to load a model from the sdsim package repository. See sdRepository for the complete list of valid names for loading existing models. Default is FALSE.

timeSeriesDirectory

The directory where time series inputs are stored (when passing the time series inputs via external files).

Details

The XML file must be created with the models object method '$saveToXml' to garantee that it will be correctly loaded and validated (by checking the sdsim prefix).

Value

A sdModelClass, a sdCoupledModelClass or a sdStaticModelClass object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Load the Bouncing Ball model from the sdsim repository
bb <- sdLoadModel(file = "BouncingBall", repository = TRUE)

# simulate the model and plot the results
outbb <- sdSimulate(model = bb)
outbb$plot("height speed", multipleYAxis = TRUE, units = TRUE)

# save the model to a XML file and reload it
bb$saveToXml(file = "bb.xml")
bb <- sdLoadModel(file = "bb.xml") 

EmbrapaInformaticaAgropecuaria/sdsim documentation built on May 10, 2019, 9:58 a.m.