Groups#
Groups can be declared using the group declaration.
Groups are used either as a list of group items or as adaptation of an expression may for groups.
Fig. 17 Group class diagram#
Group construction#
Group constructor is : ( group ). A group is itself a list of group items.
- class ansys.scadeone.core.swan.GroupConstructor(group: Group)#
Bases:
ExpressionA group expression: group_expr ::= (*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:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf 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.
- property at: Identifier | None#
Memory constrained location.
- 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 model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- class ansys.scadeone.core.swan.Group(items: List[GroupItem])#
Bases:
SwanItemGroup item as a list of GroupItem.
- 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:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf 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.
- 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 model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- class ansys.scadeone.core.swan.GroupItem(expr: Expression, label: Identifier | None = None)#
Bases:
SwanItemItem of a group expression: group_item ::= [[ label : ]] 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:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf 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.
- property expr: Expression#
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 label: Identifier | None#
Group item label.
- property model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
Group projection and renaming#
A group projection accesses to fields in a group and returns a group of the matching fields, using renaming.
The syntax is: expr .( group_renaming ) where .( group_renaming )
is a group adaptation, also used for Connection in diagrams.
- class ansys.scadeone.core.swan.GroupProjection(expr: Expression, adaptation: GroupAdaptation)#
Bases:
ExpressionGroup projection: group_expr ::= expr group_adaptation.
- 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:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf 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.
- property adaptation: GroupAdaptation#
Expression group adaptation.
- property at: Identifier | None#
Memory constrained location.
- property expr: Expression#
Adapted 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 model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- class ansys.scadeone.core.swan.GroupAdaptation(renamings: List[GroupRenamingBase])#
Bases:
SwanItemGroup adaptation: group_adaptation ::= . ( group_renamings ).
- 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:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf 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.
- 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 model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- class ansys.scadeone.core.swan.GroupRenaming(source: Identifier | Literal, renaming: Identifier | None = None, is_shortcut: bool = False)#
Bases:
GroupRenamingBaseGroup Renaming: (( Id | Integer)) [: [Id]].
Renaming source index as Id or Integer, either a name or a position. For example: a or 2.
Optional renaming target index:
No index
Renaming as : Id, for example: a : b, 2 : b
Shortcut, example a : means a : a. Note that a : a is not a shortcut.
- Parameters:
- source: common.Identifier | Literal
Source index.
- renaming: common.Identifier (optional)
Renaming as an Identifier.
- is_shortcut: bool (optional)
Renaming is a shortcut of the form ID.
- 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:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf 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.
- 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 renaming is a shortcut with no renaming, or a renaming with no shortcut.
- property model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property renaming: Identifier | None#
Renaming in new group. None if no renaming.
- property source: Identifier | Literal#
Source selection in group.
- class ansys.scadeone.core.swan.ProtectedGroupRenaming(data: str, markup: str | None = 'syntax')#
Bases:
GroupRenamingBase,ProtectedItemSpecific class when a renaming is protected for syntax error.
Source is an adaptation such as: .( {syntax%renaming%syntax} ).
- 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:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf 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.
- property is_valid: bool#
True when renaming is a shortcut with no renaming, or a renaming with no shortcut.
- property model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property renaming: Identifier | None#
Renaming in new group. None if no renaming.