pitasc.model_element

Convenience tools for accessing and modifying pitasc models more easily.

Contains the PitascModelElement class used by the SimpleInterface class for easier access to model elements.

class pitasc.model_element.PitascModelElement(runtime_id, session)

Represents a pitasc model element.

Corresponds to an entry/tag in the pitasc XML file.

Objects of this class should only be created by SimpleInterface or other instances of PitascModelElement, not by the user.

Only model elements containing other elements are represented by this class, e.g. lists or dictionaries (not to be confused with list or dict). Simple elements like strings, floats or float_csv are returned as built-in python objects, i.e. str, float or list of float.

Access to lists is possible via indexing, e.g.

>>> model.apps[0]

Access to dictionaries is possible via dot-notation, e.g.

>>> model.configuration.update_rate
Parameters:
  • runtime_id (int) – id of the object in the pitasc model.

  • session (SimpleInterface) – SimpleInterface object needed to get and set values.

add(prototype)

Creates a new element and adds it as a member or list entry.

Parameters:

prototype (str) – pitasc type of the element to be created.

Returns:

Object representing the new element.

Return type:

PitascModelElement

property description

Description of the pitasc model element.

Type:

str

property members

Available members with type and description info.

If a member is an invalid or unset reference, the dict value for this member is None.

Type:

dict of str -> dict

property name

Name of the pitasc model element.

Type:

str

property path

Path of the pitasc model element relative to the model root.

Type:

str

property type

pitasc type of the pitasc model element.

Type:

str

property visibility

Visibility of the pitasc model element.

Type:

str

pitasc.model_element.convert_value_to_str(value)

For internal use. Converts the given value to str in a format that pitasc can process.

Parameters:

value (list or basic type) – Value that should be converted

Returns:

Value representation that is suitable for processing by the pitasc model.

Return type:

str