Swan language#

This section describes the ansys.scadeone.core.swan module which contains all classes available to represent a Swan model.

Some class descriptions use the Extended Backus-Naur form to represent Swan constructs.

The classes represent each Swan construct as given in the language documentation and are mapped on the Swan grammar rules. These classes are data containers in the sense that they correspond to the model structure as read from a Swan file. They do not contain any logic to interpret the model or to perform any kind of analysis.

Note

To obtain a string from a Swan construct, use the ansys.scadeone.core.swan.swan_to_str() method, like this:

print(swan_to_str(my_construct))

Basic constructs have the __str__() method implemented, so you can use the str() function to obtain a string representation.

Classes with __str__() method implemented are: Luid, Lunum, Literal, Identifier (only the identifier is transformed into a string, its pragmas are not included), PathIdentifier, Pattern derived classes, Pragma, and pragma related classes (see: Diagram Pragmas), and ProtectedItem.