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:
SumType 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:
ProductType 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
Class:
WatchQuantityType name:
watch_quantity
Parameters
quantity: the quantity reference name
Example
{"type": "watch_quantity", "quantity": "some_parameter_name"}
Sum Blocks Quantity Function
Class:
SumBlocksQuantityType name:
sum_blocks_quantity
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
Class:
PiecewiseLinearType name:
piecewise_linear
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
Class:
PiecewiseLinearPeriodicType name:
piecewise_linear_periodic
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
Class:
RescaleTwoPhasesFunctionType name:
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
Class:
SinusOffsetType name:
sinus_offset
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
Class:
FirstOrderType name:
first_order
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
}