Hierarchy

  • AbstractSubject
    • VarsList

Implements

  • GraphVarsList

Constructors

  • Initializes the list of variables. The names argument must contain the reserved, case-insensitive, 'time' variable.

    Parameters

    • names: string[]

      array of language-independent variable names; these will be underscorized so the English names can be passed in here.

    Returns VarsList

Properties

TIME: "TIME" = 'TIME'

This name is the reserved name for the time variable.

Methods

  • Add a contiguous block of variables.

    Parameters

    • names: string[]

      language-independent names of variables; these will be underscorized so the English name can be passed in here.

    Returns number

    index index of first Variable that was added

    Throws

    if any of the variable names is 'DELETED', or array of names is empty

  • Deletes a contiguous block of variables. Delete several variables, but leaves those places in the array as empty spots that can be allocated in future with addVariables. Until an empty spot is reallocated, the name of the variable at that spot has the reserved name 'DELETED' and should not be used.

    Parameters

    • index: number

      index of first variable to delete

    • howMany: number

      number of variables to delete

    Returns void

  • Whether recent history is being stored, see saveHistory.

    Returns boolean

    true if recent history is being stored

  • Parameters

    • name: string

    Returns Variable

  • Parameters

    • index: number

    Returns number

  • Returns the value of the time variable, or throws an exception if there is no time variable.

    There are no explicit units for the time, so you can regard a time unit as any length of time, as long as it is consistent with other units.

    Returns number

    the current simulation time

    Throws

    if there is no time variable

  • Returns the current value of the variable with the given index.

    Parameters

    • index: number

      the index of the variable of interest

    Returns number

    the current value of the variable of interest

  • Returns an array with the current value of each variable. The returned array is a copy of the variable values; changing the array will not change the variable values. However, for performance, the array is maintained between invocations.

    Returns number[]

  • Returns the Variable object at the given index or with the given name

    Parameters

    • id: string | number

      the index or name of the variable; the name can be the English or language independent version of the name

    Returns Variable

    the Variable object at the given index or with the given name

  • Increments the sequence number for the specified variable(s), which indicates a discontinuity has occurred in the value of this variable. This information is used in a graph to prevent drawing a line between points that have a discontinuity.

    Parameters

    • Rest ...indexes: number[]

      the indexes of the variables; if no index given then all variable's sequence numbers are incremented

    Returns void

  • Returns the number of variables available. This includes any deleted variables (which are not being used and should be ignored).

    Returns number

    the number of variables in this VarsList

  • Saves the current variables in a 'history' set, for debugging, to be able to reproduce an error condition. See printHistory.

    Returns void

  • Indicates the specified Variables are being automatically computed.

    Parameters

    • Rest ...indexes: number[]

      the indexes of the variables

    Returns void

  • Sets whether to store recent history, see #saveHistory.

    Parameters

    • value: boolean

      true means recent history should be stored

    Returns void

  • Sets the current simulation time.

    Parameters

    • time: number

      the current simulation time.

    Returns void

    Throws

    if there is no time variable

  • Sets the specified variable to the given value. Variables are numbered starting at zero. Assumes this is a discontinous change, so the sequence number is incremented unless you specify that this is a continuous change in the variable.

    Parameters

    • index: number

      the index of the variable within the array of variables

    • value: number

      the value to set the variable to

    • continuous: boolean = false

      true means this new value is continuous with previous values; false (the default) means the new value is discontinuous with previous values, so the sequence number for the variable is incremented

    Returns void

    Throws

    if value is NaN

  • Sets the value of each variable from the given list of values. When the length of vars is less than length of VarsList then the remaining variables are not modified. Assumes this is a discontinous change, so the sequence number is incremented unless you specify that this is a continuous change in the variable.

    Parameters

    • vars: number[]

      array of state variables

    • continuous: boolean = false

      true means this new value is continuous with previous values; false (the default) means the new value is discontinuous with previous values, so the sequence number for the variable is incremented

    Returns void

    Throws

    if length of vars exceeds length of VarsList

  • Returns the index of the time variable, or -1 if there is no time variable.

    Returns number

  • Returns the set of Variable objects in this VarsList, in their correct ordering.

    Returns Variable[]

Generated using TypeDoc