Functions Configuration

This sections describes the function configurations items available in the simulation configuration to initialise parameters or update them each time step.

Note

For most of the functions here, the parameters values can be string references to other parameter of the simulation.

The can also be function configuration items themselves.

Sum Function

  • Class: Sum

  • Type name: sum

Parameters

  • add: list of element to sum.

  • subtract: (Optional) list of element to subtract from the result of the sum.

Examples

Scalar Sum

{
    "type": "sum"
    "add": [0.1, 0.2, 0.3],
    "subtract": [0.2]
} // result 0.4

Vector Sum

{
    "type": "sum"
    "add": [[0.1, 0.2, 0.3], [0.9, 0.8, 0.7]]
} // result [1.0, 1.0, 1.0]

Product Function

  • Class: Product

  • Type name: product

Parameters

  • factors: list of element to multiply.

  • inverses: (Optional) list of element to divide from the product result.

Examples

Scalar product

{
    "type": "sum"
    "factors": [1.0, 2.0, 3.0],
    "inverses": [2.0]
} // result : 3.0

Vector product

{
    "type": "sum"
    "factors": [[0.1, 0.2, 0.3], [0.9, 0.8, 0.7]]
} // [0.9, 0.16, 0.27]

Watch Quantity Function

Parameters

  • quantity: the quantity reference name

Example

{"type": "watch_quantity", "quantity": "some_parameter_name"}

Sum Blocks Quantity Function

Parameters

  • quantity_id: the quantity reference name

  • elements: a list of the blocks names

Example

{
    "quantity_id": "volume_stored",
    "elements": ["rcr_block_1", "rcr_block_2"]
} // result: sum of volume_stored in rcr_block_1 and rcr_block_2

Piecewise Linear Function

Parameters

  • points_abscissas: The function abscissas

  • points_ordinates: The function ordinates

  • left_value: (Optional) Function value when the evaluation point is before the provided abscissas.

  • right_value: (Optional) Function value when the evaluation point is after the provided abscissas.

Example

{
    "type":"piecewise_linear",
    "points_abscissas": [0.0, 0.5, 1.0],
    "points_ordinates": [0.0, 1.0, 4.0],
    "left_value": -1.0,
    "right_value": 0.0
}

Piecewise Linear Periodic Function

Parameters

  • period: The function period

  • points_abscissas: The function abscissas

  • points_ordinates: The function ordinates

Example

{
    "type":"piecewise_linear_periodic",
    "period":"1.0",
    "points_abscissas": [0.0, 0.5],
    "points_ordinates": [0.0, 1.0]
}

Rescale Two Phases Function

Parameters

  • rescaled_period: The period of the rescale function

  • reference_function: The reference function coordinates

  • alpha: The proportion of the variation of phase 0

  • phases: For each intervals point of the reference, determine if it belong to phase 0 or 1.

Examples

{
    "type":"rescale_two_phases_function",
    "rescaled_period":"2.5",
    "reference_function": [[0.0, 0.0], [0.25, 1.0], [0.75, 1.0], [1.0, 0.0]],
    "alpha": 0.75,
    "phases": [0, 1, 0]
}

Sinus Offset Function

Parameters

  • offset_value: Offset value of the sinus

  • amplitude: Peak amplitude of the sinus

  • frequency: Frequency of the sinus

  • phase_shift: Phase shift of the sinus

Example

{
    "type":"sinus_offset",
    "offset_value":0.5,
    "amplitude": 1.0,
    "frequency": 0.5,
    "phase_shift": 0.0
}

First Order Function

Parameters

  • times_start: Start times of first order components

  • amplitudes: Amplitudes of first order components

  • time_constants: Time constants of first order components

  • baseline_value: Baseline value of the function

Examples

{
    "type":"first_order",
    "times_start":[0.0, 3.0, 7.0],
    "amplitudes": [1.0, -1.0, 0.5],
    "time_constants": [0.5, 0.8, 0.3],
    "baseline_value": 0.0
}