dynamicvariable

class sysdynpy.dynamicvariable.DynamicVariable(*args, **kwargs)[source]

Bases: sysdynpy.systemelement.SystemElement

An auxiliary system element to simplify calculation rules.

Dynamic variables are very similar to flows, but they don’t have to be connected to a stock. The value of dynamic variables can be calculated from stocks and parameters at any time. They don’t need an initial value.

__init__(name, system, var_name, calc_rule, input_elements=[])[source]

Constructor method.

Parameters
  • name (str) – The element name. Can not be empty. Must be unique within the system.

  • system (System) – The system that this element shall be part of.

  • var_name (str) – The name of the variable this element will be assigned to, once it is constructed. This is needed because the variable name has to be known in other modules to execute the lambda expression that defines the calculation rule.

  • calc_rule (function) – The rule used to calculate the value property. Input elements are referenced by their var_name property. The calculation rule is stored as a lambda expression. This means that all valid python expression are valid as calculation rules.

  • input_elements (list, optional) – The system elements needed to calculate the value for this element (usually connected by arrows in a simulation diagram), defaults to an empty list

property calc_rule

see __init__()

property input_elements

see __init__()

property name

see __init__()

property system

see __init__()

property value

The numeric value that is used in calculations.

Type

int or float

property var_name

see __init__()