Diagrams#

A Diagram object stores the representation of a diagram. It contains the various blocks (see figure) and connections using Wire instances.

../../../_images/diagram.svg

Fig. 11 Diagram class diagram#

class ansys.scadeone.core.swan.Diagram(luid: Luid | None = None, objects: List[DiagramObject] | None = None)#

Bases: ScopeSection, DiagramCreator

Class for a diagram construct.

get_block_sources(obj: DiagramObject) List[tuple[DiagramObject, GroupAdaptation | None, GroupAdaptation | None]]#

Return a list of all diagram objects that are sources of current diagram. A list item is a tuple of source object and the source and target adaptations used for connection if any.

get_block_targets(obj: DiagramObject) List[tuple[DiagramObject, GroupAdaptation | None, GroupAdaptation | None]]#

Return a list of all diagram objects that are targets of current diagram. A list item is a tuple of source object and the source and target adaptations used for connection if any.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property is_text: bool#

True when section is given from {text%…%text} markup.

property luid: Luid | None#

Luid of diagram.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property objects: List[DiagramObject]#

Diagram objects.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

Pragmas associated to this scope section.

class ansys.scadeone.core.swan.DiagramObject(lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: HasPragma

Base class for diagram objects.

object ::= ( [[ lunum ]] [[ luid ]] description [[ local_objects ]] )

Parameters:
lunum: Lunum (optional)

Object local unique number within the current operator.

luid: Luid (optional)

Object local unique identifier within the current operator.

locals: list DiagramObject

List of local objects associated with the object. If locals is None, an empty list is created.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation, List[GroupAdaptation] | None]]#

Return a list of all diagram objects that are sources of current diagram object. A list item is a tuple of source object and the source and target adaptations used for connection if any.

property targets: List[tuple[DiagramObject, GroupAdaptation, GroupAdaptation]]#

Return a list of all diagram objects that are targets of current diagram object. A list item is a tuple of target object and the source and target adaptations used for connection if any.

Diagram objects#

This section describes the expr, def and block related classes.

Expr block#

class ansys.scadeone.core.swan.ExprBlock(expr: Expression, lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: DiagramObject

Expression block:

  • object ::= ( [[ lunum ]] [[ luid ]] description [[ local_objects ]] )

  • description ::= expr expr

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property expr: Expression#

Block expression.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation, List[GroupAdaptation] | None]]#

Return a list of all diagram objects that are sources of current diagram object. A list item is a tuple of source object and the source and target adaptations used for connection if any.

property targets: List[tuple[DiagramObject, GroupAdaptation, GroupAdaptation]]#

Return a list of all diagram objects that are targets of current diagram object. A list item is a tuple of target object and the source and target adaptations used for connection if any.

Def block#

class ansys.scadeone.core.swan.DefBlock(lhs: EquationLHS | ProtectedItem, lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: DiagramObject

Definition block:

  • object ::= ( [[ lunum ]] [[ luid ]] description [[ local_objects ]] )

  • description ::= def lhs

  • description ::= def {syntax% text %syntax}

The is_protected property returns True when the definition is protected with a markup.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property is_protected: bool#

True when definition is syntactically incorrect and protected.

property lhs: EquationLHS | ProtectedItem#

Returned defined flows.

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation, List[GroupAdaptation] | None]]#

Return a list of all diagram objects that are sources of current diagram object. A list item is a tuple of source object and the source and target adaptations used for connection if any.

property targets: List[tuple[DiagramObject, GroupAdaptation, GroupAdaptation]]#

Return a list of all diagram objects that are targets of current diagram object. A list item is a tuple of target object and the source and target adaptations used for connection if any.

Instance block#

class ansys.scadeone.core.swan.Block(instance: OperatorInstance | OperatorExpression | ProtectedItem, lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: DiagramObject

Generic block:

  • object ::= ( [[ lunum ]] [[ luid ]] description [[ local_objects ]] )

  • description ::= block (operator | op_expr )

  • description ::= block {syntax% text %syntax}

The is_protected property returns True when the block definition is protected with a markup.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property instance: OperatorInstance | OperatorExpression | ProtectedItem#

Called instance as an Operator, or an OperatorExpression or a protected string.

property is_protected: bool#

True when called operator is defined as a string.

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation, List[GroupAdaptation] | None]]#

Return a list of all diagram objects that are sources of current diagram object. A list item is a tuple of source object and the source and target adaptations used for connection if any.

property targets: List[tuple[DiagramObject, GroupAdaptation, GroupAdaptation]]#

Return a list of all diagram objects that are targets of current diagram object. A list item is a tuple of target object and the source and target adaptations used for connection if any.

Grouping/ungrouping blocks#

Group operator#

The GroupBlock class represents the (group) graphical operator. It is the parent class of the grouping/ungrouping operators: Bar, Concat, ByPos and ByName.

class ansys.scadeone.core.swan.GroupBlock(lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: DiagramObject

Base class for all group operation blocks.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation, List[GroupAdaptation] | None]]#

Return a list of all diagram objects that are sources of current diagram object. A list item is a tuple of source object and the source and target adaptations used for connection if any.

property targets: List[tuple[DiagramObject, GroupAdaptation, GroupAdaptation]]#

Return a list of all diagram objects that are targets of current diagram object. A list item is a tuple of target object and the source and target adaptations used for connection if any.

Bar operator#

class ansys.scadeone.core.swan.Bar(lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: GroupBlock

Represent the “bar” graphical block (group/ungroup constructor block):

  • object ::= ( [[ lunum ]] [[ luid ]] group)

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation, List[GroupAdaptation] | None]]#

Return a list of all diagram objects that are sources of current diagram object. A list item is a tuple of source object and the source and target adaptations used for connection if any.

property targets: List[tuple[DiagramObject, GroupAdaptation, GroupAdaptation]]#

Return a list of all diagram objects that are targets of current diagram object. A list item is a tuple of target object and the source and target adaptations used for connection if any.

Concat operator#

class ansys.scadeone.core.swan.Concat(group: Group, lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: GroupBlock

Represent the “concat” graphical block (group/ungroup constructor block):

  • object ::= ( [[ lunum ]] [[ luid ]] group )

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property group: Group#

Group object.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation, List[GroupAdaptation] | None]]#

Return a list of all diagram objects that are sources of current diagram object. A list item is a tuple of source object and the source and target adaptations used for connection if any.

property targets: List[tuple[DiagramObject, GroupAdaptation, GroupAdaptation]]#

Return a list of all diagram objects that are targets of current diagram object. A list item is a tuple of target object and the source and target adaptations used for connection if any.

ByPos operator#

class ansys.scadeone.core.swan.ByPos(lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: GroupBlock

Represents a group block with ‘ByPos’ operation.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation, List[GroupAdaptation] | None]]#

Return a list of all diagram objects that are sources of current diagram object. A list item is a tuple of source object and the source and target adaptations used for connection if any.

property targets: List[tuple[DiagramObject, GroupAdaptation, GroupAdaptation]]#

Return a list of all diagram objects that are targets of current diagram object. A list item is a tuple of target object and the source and target adaptations used for connection if any.

ByName operator#

class ansys.scadeone.core.swan.ByName(lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: GroupBlock

Represents a group block with ‘ByName’ operation.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation, List[GroupAdaptation] | None]]#

Return a list of all diagram objects that are sources of current diagram object. A list item is a tuple of source object and the source and target adaptations used for connection if any.

property targets: List[tuple[DiagramObject, GroupAdaptation, GroupAdaptation]]#

Return a list of all diagram objects that are targets of current diagram object. A list item is a tuple of target object and the source and target adaptations used for connection if any.

Wire and connections#

class ansys.scadeone.core.swan.Wire(source: Connection, targets: List[Connection], lunum: Lunum | None = None, luid: Luid | None = None, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: DiagramObject

Wire definition:

  • object ::= ( [[ lunum ]] [[ luid ]] description [[ local_objects ]] )

  • description ::= wire connection => connection {{ , connection }}

A wire must have a least one target.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property has_target: bool#

Return True when wire as at least one target.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property source: Connection#

Wire source.

property sources: List[tuple[DiagramObject, GroupAdaptation | None]]#

This method must not be called for a Wire

property targets: List[Connection]#

Wire targets.

class ansys.scadeone.core.swan.Connection(port: PortExpr | None = None, adaptation: GroupAdaptation | None = None)#

Bases: SwanItem

Wire connection for a source or for targets:

  • connection ::= port [[ group_adaptation ]] | ()

If both port and adaptation are None, then it corresponds to the ‘()’ form.

Connection is not valid if only adaptation is given. This is checked with the _is_valid()_ method.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property adaptation: GroupAdaptation | None#

Return the adaptation of the port of the connection.

property is_connected: bool#

True when connected to some port.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property is_valid: bool#

True when the connection either () or port [adaptation].

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property port: PortExpr | None#

Return the port of the connection.

Def-by-case blocks#

The def-by-case blocks gather the graphical version of then state machine and activate if/when constructs.

class ansys.scadeone.core.swan.StateMachineBlock(def_by_case: StateMachine, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: DefByCaseBlockBase

State machine block definition:

  • object ::= ( description [[ local_objects ]] )

  • description ::= [lhs :] state_machine

A StateMachineBlock is a proxy to the internal StateMachine object, therefore the methods and properties of the StateMachine object can be accessed directly.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property def_by_case: DefByCase#

Def-by-case object.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation | None]]#

This method must not be called for a def-by-case block.

property state_machine: StateMachine#

State machine object.

property targets: List[tuple[DiagramObject, GroupAdaptation | None]]#

This method must not be called for a def-by-case block.

class ansys.scadeone.core.swan.ActivateIfBlock(def_by_case: ActivateIf, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: DefByCaseBlockBase

Activate-if block definition:

  • object ::= ( description [[ local_objects ]] )

  • description ::= [lhs :] activate [[ luid ]] if_activation

A ActivateIF is a proxy to the internal ActivateIf object, therefore the methods and properties of the ActivateIf object can be accessed directly.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property activate_if: ActivateIf#

Activate if object.

property def_by_case: DefByCase#

Def-by-case object.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation | None]]#

This method must not be called for a def-by-case block.

property targets: List[tuple[DiagramObject, GroupAdaptation | None]]#

This method must not be called for a def-by-case block.

class ansys.scadeone.core.swan.ActivateWhenBlock(def_by_case: ActivateWhen, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: DefByCaseBlockBase

Activate-when block definition:

  • object ::= ( description [[ local_objects ]] )

  • description ::= [lhs :] activate [[ luid ]] when_activation

A ActivateIF is a proxy to the internal ActivateWhen object, therefore the methods and properties of the ActivateIf object can be accessed directly.

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property activate_when: ActivateWhen#

Activate when object.

property def_by_case: DefByCase#

Def-by-case object.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property sources: List[tuple[DiagramObject, GroupAdaptation | None]]#

This method must not be called for a def-by-case block.

property targets: List[tuple[DiagramObject, GroupAdaptation | None]]#

This method must not be called for a def-by-case block.

Sections#

The SectionObject contains a Swan section, that is to say, a let, var, diagram, assert, assume or guarantee section.

class ansys.scadeone.core.swan.SectionObject(section: ScopeSection, locals: List[DiagramObject] | None = None, pragmas: List[Pragma] | None = None)#

Bases: DiagramObject

Section object definition:

  • object ::= ( description [[ local_objects ]] )

  • description ::= scope_section

get_full_path() str#

Full path of the Swan construct.

This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.

Returns:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If the method is not implemented for the current SwanItem type.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property locals: List[DiagramObject]#

Local objects of object.

property luid: Luid | None#

Luid of object, or None if no Luid.

property lunum: Lunum | None#

Lunum of object, or None if no Lunum.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property section: ScopeSection#

Section object of diagram object.

property sources: List[tuple[DiagramObject, GroupAdaptation | None]]#

This method must not be called for a SectionObject

property targets: List[tuple[DiagramObject, GroupAdaptation | None]]#

This method must not be called for a SectionObject