Skip to contents

Executes an NLME simulation

Usage

simmodel(
  model,
  simParams,
  params,
  hostPlatform = NULL,
  runInBackground = FALSE,
  ...
)

Arguments

model

PK/PD model class object.

simParams

Simulation parameters. See NlmeSimulationParams. If missing, default parameters generated by NlmeSimulationParams() are used.

params

Engine parameters. See engineParams. The common parameters include: sort, ODE, rtolODE, atolODE, maxStepsODE. If missing, default parameters generated by engineParams(model) are used.

hostPlatform

Host definition for model execution. See hostParams. If missing, simple local host is used.

runInBackground

Logical. When TRUE, the wrapper starts the engine asynchronously and returns a job object immediately; pass that object to collectJob() when the run has finished to obtain the typed result. When FALSE (the default), the wrapper blocks until the engine completes and returns the result directly.

Background execution is supported only on Linux hosts, whether local or remote: a local host whose hostType is "linux" (the default on Linux workstations), or a remote host with hostType "linux", "RHEL", or "UBUNTU". It is not supported on Windows (hostType = "windows", including the default local host when R runs on Windows): leave the argument at FALSE. Passing TRUE on a Windows host stops with an error. Remote Windows hosts are not supported at all.

...

Additional class initializer arguments for NlmeSimulationParams, or arguments available inside hostParams or engineParams functions. If engineParams arguments are supplied through both params argument and additional argument (i.e., ellipsis), then the arguments in params will be ignored and only the additional arguments will be used with warning. If hostParams arguments are supplied through both hostPlatform argument and additional argument, then its slots will be overridden by additional arguments. In addition, if NlmeSimulationParams arguments are supplied through both simParams argument and additional argument, then its slots will be overridden by additional arguments.

Value

If runInBackground = FALSE, a named list of data.tables loaded from the engine's simulation outputs (any non-empty user-defined simulationTables, plus predout.csv / simout.csv depending on params@isPopulation). The list also carries runMode = "simulation", runTime, and RsNLMEVersion elements alongside the data. Otherwise an NlmeSimulationJob object that can be materialised later via collectJob(), which produces the same result list.

See also

Examples

if (FALSE) { # \dontrun{
SimTableObs <- tableParams(
  name = "SimTableObs.csv",
  timesList = "0,1,2,4,4.9,55.1,56,57,59,60",
  variablesList = "C, CObs",
  timeAfterDose = FALSE,
  forSimulation = TRUE
)

simParams <- NlmeSimulationParams(
  numReplicates = 2,
  simulationTables = SimTableObs
)
# Define the model
model <- pkmodel(
  numComp = 2,
  absorption = "Extravascular",
  ID = "Subject",
  Time = "Act_Time",
  CObs = "Conc",
  Aa = "Amount",
  data = pkData,
  modelName = "PkModel",
  workingDir = tempdir()
)

host <- hostParams(
  sharedDirectory = tempdir(),
  parallelMethod = "NONE",
  hostName = "local",
  numCores = 1
 )

results <- simmodel(model, simParams, hostPlatform = host)
# with seed given additionally:
results <- simmodel(model, simParams, hostPlatform = host, seed = 3527)
} # }