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 ofPitascModelElement
, 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
ordict
). Simple elements like strings, floats or float_csv are returned as built-in python objects, i.e.str
,float
orlist
offloat
.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:
- 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
ofstr
->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