Forward expression#
A forward expression is stored as a Forward class. The class hierarchy is given in the following pictures:
Fig. 15 Forward class diagram#
- class ansys.scadeone.core.swan.Forward(restart: bool | None, dimensions: List[ForwardDim], body: ForwardBody, returns: List[ForwardReturnItem], luid: Luid | None = None)#
Bases:
ExpressionForward expression:
fwd_expr ::= forward [[ luid]] [[ (( restart | resume )) ]] {{ dim }}+fwd_body returns ( returns_group )returns_group ::= [[ returns_item {{ , returns_item }} ]]- 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.
- 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.
- 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_restart: bool#
True if restart mode, else resume mode. Note: default mode for a forward is restart, which is indicated by the restart property being None.
- 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.ForwardBody(sections: List[ScopeSection], unless_expr: Expression | None = None, until_expr: Expression | None = None)#
Bases:
SwanItemforward construct:
fwd_body ::= [[ unless expr ]] scope_sections [[ until expr ]]
- 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.
- 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.
- 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.
Dimensions#
- class ansys.scadeone.core.swan.ForwardDim(size: Expression | None = None, dim_id: Identifier | None = None, elems: List[ForwardCurrentElement] | None = None, protected: str | None = None)#
Bases:
SwanItemforward construct dimension:
dim ::= << size >> [[ with (( << id >> | current_elt )) {{ current_elt }} ]]
Note that:
there may be no with part,
or it is an ID followed by a possible empty list,
or if no ID, at least one current_element.
The is_valid() method checks for that property.
- Parameters:
- size: common.Expression
Dimension size.
- id: common.Identifier (optional)
with ID.
- elems: List[ForwardCurrentElement] (optional)
with elements part.
- protected: str (optional)
Content of the dimension if it syntactically incorrect. In that case, all other parameters are None.
- 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.
- 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.
- property dim_id: Identifier | None#
forward dimension ID, or None.
- property elems: List[ForwardCurrentElement] | None#
forward dimension elements or None.
- 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 protected: str | None#
Returns protected form as a string if dimension is syntactically invalid.
- property size: Expression | None#
forward dimension size.
- class ansys.scadeone.core.swan.ForwardCurrentElement(lhs: ForwardLHS, expr: Expression)#
Bases:
SwanItemForward current element:
current_elt ::= current_lhs = expr ;
- 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.
- 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.
- property expr: Expression#
Current element 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 lhs: ForwardLHS#
Current element.
- 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.ForwardLHS(lhs: Identifier | ForwardLHS)#
Bases:
SwanItemforward construct:
current_lhs ::= id | [ current_lhs ]
- 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.
- 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.
- 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 lhs: Identifier | ForwardLHS#
Returns current lhs as an Identifier or a ForwardLHS.
- 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.
Forward returns#
The base class for return clause is ForwardReturnItem.
A syntactically incorrect return clause is represented by the
ProtectedForwardReturnItem class.
Fig. 16 Forward return#
- class ansys.scadeone.core.swan.ForwardReturnItem#
Bases:
SwanItemBase class for returns_item.
- 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.
- 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.
- 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.ProtectedForwardReturnItem(data: str)#
Bases:
ProtectedItem,ForwardReturnItemforward construct: protected returns_item with {syntax% … %syntax} markup.
- 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.
- 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.
- 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.
Accumulation#
Accumulation clause is represented by the ForwardAccuClause class.
- class ansys.scadeone.core.swan.ForwardAccuClause(id: Identifier, last_expr: Expression)#
Bases:
ForwardReturnItemforward accumulator construct:
accu_clause ::= id : last = expr
- 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.
- 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.
- property id: Identifier#
Item_clause identifier.
- 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 last_expr: Expression#
Item_clause last expression.
- 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.
Array clause#
Returned array clause is represented by the ForwardReturnArrayClause class,
which references a ForwardArrayClause instance and its optional identifier.
- class ansys.scadeone.core.swan.ForwardReturnArrayClause(array_clause: ForwardArrayClause, id: Identifier | None = None)#
Bases:
ForwardReturnItemforward construct:
returns_item ::= [[ id : ]] array_clause
- 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.
- 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.
- property array_clause: ForwardArrayClause#
Array clause.
- property id: Identifier | None#
Identifier of clause, or None.
- 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.
Array clause is either:
a
ForwardArrayClauseExprinstance, ora
ForwardArrayClauseElementinstance, which represents the[array_clause]expression.
- class ansys.scadeone.core.swan.ForwardArrayClause#
Bases:
SwanItemBase class for forward array_clause.
- 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.
- 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.
- 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.ForwardArrayClauseExpr(expr_no_bracket: Expression, default_expr: Expression | None = None)#
Bases:
ForwardArrayClauseforward construct:
array_clause ::= expr_no_bracket [[ default expr ]]
- 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.
- 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.
- property default_expr: Expression | None#
Default expression, or None.
- property expr_no_bracket: Expression#
Expression without brackets.
- 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.ForwardArrayClauseElement(array_clause: ForwardArrayClause)#
Bases:
ForwardArrayClauseforward construct:
array_clause ::= [ array_clause ]]
- 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.
- 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.
- property array_clause: ForwardArrayClause#
Array clause.
- 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.