xmile_to_deSolve: Parse XMILE to deSolve components

Description Usage Arguments Details Value Examples

View source: R/read_xmile.R

Description

xmile_to_deSolve returns a list that serves as an input for deSolve's ODE function.

Usage

1
xmile_to_deSolve(filepath)

Arguments

filepath

A string that indicates a path to a file with extension .stmx or .xmile. Vensim files (.mdl) are not xmile files. They must be exported from Vensim with extension .xmile

Details

This function extracts the xml from the file specified via filepath to generate a list with the necessary elements to simulate with deSolve.

Value

This function returns a list with at least four elements. stocks, a numeric vector that contains initial values. consts, a numeric vector with the model's constants. func, the function that wraps the model's equations. sim_params, a list with control parameters. If the model includes a table or graphical function, this function returns the element graph_funs, a list with these functions.

Examples

1
2
path <- system.file("models", "SIR.stmx", package = "readsdr")
xmile_to_deSolve(path)

readsdr documentation built on Jan. 13, 2021, 11:08 a.m.