Class PkgWrapper

Wrapper class around an OdinModel designed to be driven from the R package odin

Hierarchy

  • PkgWrapper

Constructors

  • Parameters

    • Model: OdinModelConstructable

      The model to wrap

    • pars: UserType

      Parameters to set into the model on construction

    • unusedUserAction: string

      String, describing the action to take if there are unknown values in pars - possible values are "error", "ignore", "warning" and "message"

    Returns PkgWrapper

Methods

  • Return metadata about the model - odin uses this internally.

    Returns any

  • Compute initial conditions of the model

    Parameters

    • t: number

      The time to compute initial conditions at

    Returns number[]

  • Compute derivatives of the model

    Parameters

    • t: number

      The time to compute the derivatve at

    • y: number[]

      The value of the variables

    Returns { output: null | number[]; state: any[] }

    • output: null | number[]
    • state: any[]
  • Run the model, returning output at particular points in time. Note that this is quite a different interface to that used in wodinRun in order to match the interface expected by odin, but also due to limitations of what can be carried across the R/JS boundary.

    Parameters

    • t: number[]

      A vector of times to integrate over. Must be in increasing order, and at least two values given. The first time is the time that the integration starts from.

    • y0: null | number[]

      Initial conditions, or null to use values from initial

    • control: Partial<DopriControlParam>

      Control parameters, passed through to the solver, see dopri.DopriControlParam

    Returns { names: string[]; statistics: { lastError: number; nEval: number; nSteps: number; nStepsAccepted: number; nStepsRejected: number; stiffNNonstiff: number; stiffNStiff: number }; y: number[][] }

    • names: string[]

      Names of all variables (and outputs) in the system

    • statistics: { lastError: number; nEval: number; nSteps: number; nStepsAccepted: number; nStepsRejected: number; stiffNNonstiff: number; stiffNStiff: number }

      Statistics from the solver about work done

      • lastError: number

        The last estimated error in the solution

      • nEval: number

        The number of evaluations of the rhs function

      • nSteps: number

        The number of steps attempted

      • nStepsAccepted: number

        The number of steps accepted

      • nStepsRejected: number

        The number of steps rejected

      • stiffNNonstiff: number

        The number of stiff checks that were non-stiff

      • stiffNStiff: number

        The number of stiff checks that were stiff

    • y: number[][]

      Array-of-arrays with the result y[i][j] is the jth output at the ith time

  • Change parameters in a model after it has been initialised.

    Parameters

    • pars: UserType

      Parameters to set. Values that are omitted are not replaced by their defaults.

    • unusedUserAction: string

      Action to take if unknown values are found in pars, see constructor

    Returns void

Generated using TypeDoc