View source: R/update_SimInput.R
| update_SimInput | R Documentation |
This function takes an xml input file for the simulator and
updates it according to the set of new parameters specified in the input
parameter list newParam. The schema definition of the xml file is also
required as an input parameter to validate the structure of the output file.
update_SimInput(xmlSimInput, newParam, xsdName, newFileName = NULL)
xmlSimInput |
Object of class |
newParam |
|
xsdName |
|
newFileName |
|
Return an xml-document object of package xml2 with
the parameters updated according to the specified input parameters. If
newFileName is specified, this object is written in the corresponding
xml file.
library(fs)
rootPath <- system.file(package = "simutils")
xmlSimInput <- file.path(rootPath, "extdata/input_files", "simulation.xml")
newParam.lst <- list(
end_time = 11,
movement_pattern = structure(list(
manhattan_grid = structure(
list(x_step = 40, y_step = 40, x_origin = 0, y_origin = 0),
type = "home_work_manhattan"
)
))
)
xsdName <- file.path(
rootPath,
"extdata/metadata/input_files/schema_definition", "simulation_dict.xsd"
)
newSimInputFile <- file.path(path_home(), "newSimulation.xml")
update_SimInput(
xmlSimInput = xmlSimInput,
newParam = newParam.lst,
xsdName = xsdName,
newFileName = newSimInputFile
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.