Variable declarations#
- class ansys.scadeone.core.swan.VarSection(var_decls: List[Variable])#
Bases:
ScopeSectionImplements:
var {{var_decl ;}} section.
- 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.Variable#
Bases:
SwanItemBase class for Variable and ProtectedVariable.
- 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.VarDecl(id: Identifier, is_starred: bool = False, at: Identifier | None = None, type: GroupTypeExpression | None = None, init_type: VarInitDelay = VarInitDelay.DelayNone, causality_type: List[Identifier] | None = None, default: Expression | None = None, last: Expression | None = None, pragmas: list[Pragma] | None = None)#
Bases:
Declaration,VariableClass for variable declaration.
- Parameters:
- id: common.Identifier
Variable identifier.
- is_starred: bool, optional
True if variable is starred. Default is False.
- at: Optional[common.Identifier], optional
Memory constrained output. Name of the memory place. Note: is_output must be True. Default is None.
- type: Optional[common.GroupTypeExpression], optional
Variable type. Default is None.
- init_type: VarInitDelay, optional
Variable initialization delay. Default is VarInitDelay.DelayNone.
- causality_type: Optional[List[common.Identifier]], optional
Variable causality_type attributes. Default is None.
- default: Optional[common.Expression], optional
Variable default expression. Default is None.
- last: Optional[common.Expression], optional
Variable last expression. Default is None.
- pragmas: Optional[list[common.Pragma]], optional
List of pragmas. Default is 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.
- property at: Identifier | None#
Memory constrained output. Name of the memory place. Note: is_output must be True.
- property causality_type: List[Identifier]#
Variable causality_type attributes.
- property default: Expression | None#
Variable default expression.
- property id: Identifier#
Language item identifier.
- property init_type: VarInitDelay#
Variable initialization delay.
- property is_external: bool#
True if declaration has no definition.
Check if there is no alternative declaration in the module (interface or body). Warn if any, and raise an error if inconsistent.
- 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_public: bool#
True if declaration is public.
A declaration is public if:
it is declared in a module interface,
or it is declared in a module body, but the module has no interface.
A declaration is private if it is declared in a module body, and the module has an interface, and there is no declaration with the same name in the module interface.
If declared in both a module interface and body, the declaration is considered as public, but a warning is issued.
- property is_starred: bool#
True when consumption is allowed for the input variable. Note: is_input must be True.
- property last: Expression | None#
Variable 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.
- property type: GroupTypeExpression | None#
Variable type.
- class ansys.scadeone.core.swan.ProtectedVariable(data: str, pragmas: List[Pragma] | None = None)#
Bases:
Variable,ProtectedItem,HasPragmaProtected variable definition as a string.
- 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.