Operator sections#
Scope contains scope sections which define variables, equations, diagrams, formal properties and emissions.
The Scope class is used to define the scope and contains a list of ScopeSection.
It derives from the HasPragma class as a scope can have pragmas for the layout of
blocks defined by:py:class:ActivateIf and ActivateWhen constructs.
- class ansys.scadeone.core.swan.Scope(sections: List[ScopeSection] | None = None, pragmas: List[Pragma] | None = None)#
Bases:
HasPragmaScope definition:
data_def ::= scopescope ::= { {{scope_section}} }- get_declaration(name: str) Declaration | None#
Returns the type, global, operator or variable declaration searching by namespace.
- 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 sections: List[ScopeSection]#
Scope sections.
- class ansys.scadeone.core.swan.ScopeSection#
Bases:
SwanItemBase class for scopes.
- 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.ProtectedSection(data: str)#
Bases:
ScopeSection,ProtectedItemProtected section, meaning a syntactically incorrect section construct.
- 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.