View source: R/utilities-simulation.R
loadSimulation | R Documentation |
Loads a simulation from a pkml file and returns the simulation. If the passed simulation file has been loaded before, the simulation is not loaded again but a cached object is returned. This behavior can be overridden.
loadSimulation(
filePath,
loadFromCache = FALSE,
addToCache = TRUE,
resetIds = TRUE
)
filePath |
Full path of pkml simulation file to load. |
loadFromCache |
If |
addToCache |
If |
resetIds |
If |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite")
# Load sim1 for the first time
sim1 <- loadSimulation(simPath)
# sim2 will be loaded from cache and will represent the same object as sim1
sim2 <- loadSimulation(simPath, loadFromCache = TRUE)
parameter1 <- getParameter(toPathString(c("Organism", "Liver", "Volume")), sim1)
parameter2 <- getParameter(toPathString(c("Organism", "Liver", "Volume")), sim2)
# parameter1 and parameter2 belong to the same simulation object, so changing
# one of the them will also change another
setParameterValues(parameters = parameter2, values = 0)
parameter1$value == parameter2$value # TRUE
# sim3 will not be loaded from cache
sim3 <- loadSimulation(simPath, loadFromCache = FALSE)
# parameter3 belong to different simulation object than parameter1 and parameter2
parameter3 <- getParameter(toPathString(c("Organism", "Liver", "Volume")), sim3)
setParameterValues(parameters = parameter3, values = 1)
parameter2$value == parameter3$value # FALSE#'
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.