Skip to contents

A class for managing MCSimMod models.

Arguments

mName

Name of an MCSim model specification file, excluding the file name extension .model.

mString

A character string containing MCSim model specification text.

Details

Instances of this class represent ordinary differential equation (ODE) models. A Model object has both attributes (i.e., things the object “knows” about itself) and methods (i.e., things the object can “do”). Model attributes include: the name of the model (mName); a vector of parameter names and values (parms); and a vector of initial conditions (Y0). Model methods include functions for: translating, compiling, and loading the model (loadModel); updating parameter values (updateParms); updating initial conditions (updateY0); and running model simulations (runModel). So, for example, if mod is a Model object, it will have an attribute called parms that can be accessed using the R expression mod$parms. Similarly, mod will have a method called updateParms that can be accessed using the R expression mod$updateParms(). Use the createModel() function to create Model objects.

Fields

mName

Name of an MCSim model specification file, excluding the file name extension .model.

mString

Character string containing MCSim model specification text.

initParms

Function that initializes values of parameters defined for the associated MCSim model.

initStates

Function that initializes values of state variables defined for teh associated MCSim model..

Outputs

Names of output variables defined for the associated MCSim model.

parms

Named vector of parameter values for the associated MCSim model.

Y0

Named vector of initial conditions for the state variables of the associated MCSim model.

paths

List of character strings that are names of files associated with the model.

writeTemp

Boolean specifying whether to write model files to a temporary directory. If value is TRUE, model files will be Written to a temporary directory; if value is FALSE, model files will be Written to the same directory that contains the model specification file.

Methods

cleanup(deleteModel = FALSE)

Delete files created during the translation and compilation steps performed by loadModel. If deleteModel = TRUE, delete the MCSim model specification file, as well.

initialize(...)

Initialize the Model object using an MCSim model specification file (mName) or an MCSim model specification string (mString).

loadModel(force = FALSE)

Translate (if necessary) the model specification text to C, compile (if necessary) the resulting C file to create a dynamic link library (DLL) file (on Windows) or a shared object (SO) file (on Unix), and then load all essential information about the Model object into memory (for use in the current R session).

runModel(times, ...)

Perform a simulation for the Model object using the deSolve function ode for the specified times.

updateParms(new_parms = NULL)

Update values of parameters for the Model object.

updateY0(new_states = NULL)

Update values of initital conditions of state variables for the Model object.