Operator instance#
An OperatorInstanceApplication object is an Expression object
representing an operator instance call, the called operator being represented
by an instance of the top-level class OperatorInstance
A block can refer to an operator instance or an operator expression.
Fig. 12 Operator instance class diagram#
Note: array-related operations are described in the Array section.
Operator instance application#
- class ansys.scadeone.core.swan.OperatorInstanceApplication(operator: OperatorInstance, params: Group, luid: Luid | None = None)#
Bases:
ExpressionOperator instance call:
expr := operator_instance ( group )
operator_instance ::= operator [[ luid ]]
- 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.
- property operator: OperatorInstance#
Called operator.
Operator instance base class#
- class ansys.scadeone.core.swan.OperatorInstance(sizes: List[Expression])#
-
Base class for: operator ::= prefix_op [[sizes]].
- 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.
- property sizes: List[Expression]#
Size parameters of call.
Named operator instance#
- class ansys.scadeone.core.swan.NamedInstance(path_id: PathIdentifier, sizes: List[Expression])#
Bases:
OperatorInstanceCall to operator: operator ::= path_id [[sizes]].
- 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.
- property path_id: PathIdentifier#
Operator path.
- property sizes: List[Expression]#
Size parameters of call.
Operator expressions#
The OperatorExpression class is used to represent an operator
expression. The OperatorExpressionInstance class is used to represent an operator
expression instance, which corresponds to the syntax “( operator_expression )”.
Fig. 13 Operator expression class diagram#
- class ansys.scadeone.core.swan.OperatorExpression#
-
Base class for op_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 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.OperatorExpressionInstance(op_expr: OperatorExpression, sizes: List[Expression])#
Bases:
OperatorInstanceCall to op_expr: operator ::= (op_expr) [[sizes]].
- 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.
- property op_expr: OperatorExpression#
Operator expression.
- property sizes: List[Expression]#
Size parameters of call.
Anonymous operator instance#
- class ansys.scadeone.core.swan.AnonymousOperatorWithExpression(is_node: bool, params: List[Identifier], sections: List[ScopeSection], expr: Expression)#
Bases:
OperatorExpressionAnonymous operator expression: ((node|function)) id {{ , id }} scope_sections => 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#
Anonymous operator body.
- 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.
- property params: List[Identifier]#
Anonymous operator parameters list.
- property sections: List[ScopeSection]#
Scope sections list.
- class ansys.scadeone.core.swan.AnonymousOperatorWithDataDefinition(is_node: bool, inputs: List[VarDecl], outputs: List[VarDecl], data_def: Equation | Scope)#
Bases:
OperatorExpressionAnonymous operator expression: ((node|function)) params returns params data_def.
- 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 data_def: Equation | Scope#
Anonymous operator data definition, either an equation or a scope.
- 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.
Higher-order operator instance#
Higher-order operations (operations using an operator as parameter) are
represented by instances of the OperatorExpression class.
Fig. 14 Operator higher-order class diagram#
Higher-order |
Application |
|---|---|
map, fold, mapfold, mapi foldi, mapfoldi |
array iterators |
activate operator expression every |
conditional activation |
restart operator expression every |
conditional restart |
Iterator#
- class ansys.scadeone.core.swan.Iterator(kind: IteratorKind, operator: OperatorInstance | ProtectedOpExpr)#
Bases:
OperatorExpressionIterators: map, fold, mapfold, mapi, foldi, mapfoldi.
- 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 kind: IteratorKind#
Iterator kind.
- 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 operator: OperatorInstance | ProtectedOpExpr#
Iterated operator.
Activate#
- class ansys.scadeone.core.swan.ActivateEvery(operator: OperatorInstance, condition: Expression, is_last: bool, expr: Expression)#
Bases:
OperatorExpressionHigher-order activate expression: activate operator every expr (( last**| **default )) 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 condition: Expression#
Activation condition.
- property expr: Expression#
Activation default/last 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.
- property operator: OperatorInstance#
Operator under activation.
Restart#
- class ansys.scadeone.core.swan.RestartOperator(operator: OperatorInstance, condition: Expression)#
Bases:
OperatorExpressionHigher-order restart expression: restart operator every 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 condition: Expression#
Activation condition.
- 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.
- property operator: OperatorInstance#
Operator under activation.
Partial operator instance#
- class ansys.scadeone.core.swan.PartialOperator(operator: OperatorInstance, partial_group: List[OptGroupItem])#
Bases:
OperatorExpressionPartial operator expression: operator partial_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 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.
- property operator: OperatorInstance#
Called operator.
- property partial_group: List[OptGroupItem]#
Returns the partial group items.
- class ansys.scadeone.core.swan.OptGroupItem(item: GroupItem | None = None)#
Bases:
SwanItemOptional group item: opt_group_item ::= _ | group_item.
- 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.
N-ary operator instance#
N-ary operator instances are implemented as specific expressions. See N-ary expressions section.
Protected operator expression#
This class is used when an operator expression is syntactically incorrect and was protected by the serialization process.
- class ansys.scadeone.core.swan.ProtectedOpExpr(data: str, markup: str)#
Bases:
OperatorExpression,ProtectedItemProtected operator expression, i.e., saved as string if syntactically incorrect.
- 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 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.