trnsystor.statement.Constant

class trnsystor.statement.Constant(name=None, equals_to=None, doc=None)[source]

CONSTANTS Statement.

The CONSTANTS statement is useful when simulating a number of systems with identical component configurations but with different parameter values, initial input values, or initial values of time dependent variables.

Initialize object.

Parameters
  • name (str) – The left hand side of the equation.

  • equals_to (str, TypeVariable) – The right hand side of the equation.

  • doc (str, optional) – A small description optionally printed in the deck file.

classmethod from_expression(expression, doc=None)[source]

Create a Constant from a string expression.

Anything before the equal sign (“=”) will become the Constant’s name and anything after will become the equality statement.

Hint

The simple expressions are processed much as FORTRAN arithmetic statements are, with one significant exceptions. Expressions are evaluated from left to right with no precedence accorded to any operation over another. This rule must constantly be borne in mind when writing long expressions.

Parameters
  • expression (str) – A user-defined expression to parse.

  • doc (str, optional) – A small description optionally printed in the deck file.

property constant_number

The equation number (unique).