Emissions#

class ansys.scadeone.core.swan.EmissionBody(flows: List[Identifier], condition: Expression | None = None, luid: Luid | None = None)#

Bases: SwanItem

Implements an emission:

emission_body ::= flow_names [[ if expr ]]
flow_names ::= NAME {{ , NAME }}
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:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If 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.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property condition: Expression | None#

Emission condition if exists, else None.

property flows: List[Identifier]#

Emitted flows.

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 luid: Luid | None#

Emission identifier if exists, else None.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

class ansys.scadeone.core.swan.EmitSection(emissions: List[EmissionBody])#

Bases: ScopeSection

Implements an Emit section:

emit {{emission_body ;}}

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:
str

Path within the owner and name of the Swan construct.

Raises:
ScadeOneException

If 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.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property emissions: List[EmissionBody]#

List of emissions.

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_text: bool#

True when section is given from {text%…%text} markup.

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

Pragmas associated to this scope section.