Variable and Message

Variable

Variable(key, unit='', description='')

Bases: Child

Time series of a component, one value per time step of the simulation

t = pro.component("space_1").variable("temperature")
t.values  # numpy array
t.unit    # "°C"

Create new variable, without values until initialise()

Parameters:

Name Type Description Default
key str

key of the variable in its component

required
unit str

unit. Defaults to "".

''
description str

description. Defaults to "".

''

key property writable

key

str: key of the variable in its component

values property writable

values

numpy.ndarray: value of each time step

unit property

unit

str: unit of the values

description property

description

str: description of the variable

initialise

initialise(n, default=0.0)

Create the array of values

Parameters:

Name Type Description Default
n int

number of time steps

required
default float

initial value. Defaults to 0.0.

0.0

Message

Message(text, level='ERROR')

Message of the simulation environment (error, warning or information)

Messages are added with Simulation.message() and listed with Simulation.message_list().

Create new message

Parameters:

Name Type Description Default
text str

text of the message

required
level str

"ERROR", "WARNING", "INFO" or "CONSOLE". Defaults to "ERROR".

'ERROR'

text property

text

str: text of the message

level property

level

str: "ERROR", "WARNING", "INFO" or "CONSOLE"

print

print()

Print the message, preceded by its level unless it is "CONSOLE"