Diagram Pragmas#
The graphical information is saved as diagram pragmas in the Swan source. This section describes the diagram pragma classes.
DiagramPragma class diagram#
Diagram Pragma#
- class ansys.scadeone.core.swan.DiagramPragma#
Bases:
object
The diagram information of a graphical object.
- property coordinates: Coordinates#
Return the diagram coordinates.
- property orientation: Orientation#
Return the diagram orientation.
Coordinates#
- class ansys.scadeone.core.swan.Coordinates(x: Coordinate | None = None, y: Coordinate | None = None)#
Bases:
object
Coordinates define a horizontal (x) and a vertical (y) position of a graphical object.
Coordinates are specified as:
xy = COORD ";" COORD
where:
COORD
: Coordinate x or y (seeCoordinate
)
Coordinates are used to define the position of the diagram object, states or Active if/when blocks.
- property x: Coordinate | None#
Return the x coordinate.
- property y: Coordinate | None#
Return the y coordinate.
Coordinate#
- class ansys.scadeone.core.swan.Coordinate(position: Position, value: int)#
Bases:
object
Coordinate defines a horizontal (x) or vertical (y) position of a graphical object.
Coordinate is defined as:
xy = ("H" | "h")x ";" ("V" | "v")y
("H" | "h")
or("V" | "v")
: Absolute or relative position (seePosition
)x
ory
: Coordinate value
The relative coordinate values are computed from:
the center of the parent block
wire and transition: the center of the source/target, or the previous coordinate
Position#
Size#
Direction#
- class ansys.scadeone.core.swan.Direction(value: DirectionType)#
Bases:
object
The direction of the diagram object.
Direction is defined as
dir = dir_val
where
dir_val
is defined inDirectionType
.Direction is used to define the direction of predefined operator and block with text (Expr, Def, Instance, Equation).
- property value: DirectionType#
Return the direction value.
Direction type#
- class ansys.scadeone.core.swan.DirectionType(value)#
Bases:
Enum
The direction value of a diagram object.
The direction value is defined as
dir_val = ne|nw|es|en|se|sw|ws|wn
where:
ne
: North-Eastnw
: North-Westes
: East-Southen
: East-Northse
: South-Eastsw
: South-Westws
: West-Southwn
: West-North
The direction value is read as: the first direction is at the top of the graphical object, and the second direction is the right side of the graphical object.
- The default direction is North-East:
West corresponding to inputs,
East corresponding to outputs.
- EAST_NORTH = 'en'#
East-North direction. From the default direction, a 90° left rotation and a horizontal flip are applied (inputs are at the bottom and outputs are at the top).
- EAST_SOUTH = 'es'#
East-South direction. From the default direction, a 90° left rotation is applied (inputs are at the bottom and outputs are at the top).
- NORTH_EAST = 'ne'#
North-East direction. Default direction (inputs are on the left, outputs are on the right).
- NORTH_WEST = 'nw'#
North-West direction. From the default direction, a horizontal flip is applied, or a 180° rotation and a vertical flip are applied (inputs are on the right and outputs are on the left).
- SOUTH_EAST = 'se'#
South east direction. From the default direction, a vertical flip is applied (inputs are on the left and outputs are on the right).
- SOUTH_WEST = 'sw'#
South-West direction. From the default direction, a 180° rotation is applied (inputs are on the right and outputs are on the left).
- WEST_NORTH = 'wn'#
West-North direction. From the default direction a 90° right rotation is applied (inputs are at the top and outputs are at the bottom).
- WEST_SOUTH = 'ws'#
West-South direction. From the default direction, a 90° right rotation and a horizontal flip are applied (inputs are at the top and outputs are at the bottom).
Orientation#
- class ansys.scadeone.core.swan.Orientation(value: OrientationType)#
Bases:
object
Text content orientation.
Orientation is defined as
orient = orient_val
where
orient_val
is defined inOrientationType
.Orientation is used to define the text content orientation of the diagram object.
- property value: OrientationType#
Return the orientation value.
Orientation type#
Path information#
- class ansys.scadeone.core.swan.PathInfo(w_anchor: WireAnchor, path: WirePath)#
Bases:
object
The wire or transition path between two objects. The path is defined by a list of moves.
The wire and transition paths are defined as:
Wire
wp = path_info
Transition
tp = path_info
where:
path_info = w_anchor path
w_anchor
is defined inWireAnchor
.path
is defined inWirePath
.- property w_anchor: WireAnchor#
Return the wire anchor.
Wire anchor#
- class ansys.scadeone.core.swan.WireAnchor(lunum: Lunum | None = None, coordinates: Coordinates | None = None)#
Bases:
object
Wire anchor is the starting or ending point of a path.
Wire anchor is defined as:
w_anchor = LUNUM | COORD '|' LUNUM (* connection to a group-related block *) | coordinates '|' LUNUM (* coordinates of a starting/ending point of a transition for a state *) | coordinates (* unconnected point as a pair of COORD. *)
where:
LUNUM
: The graphical object identifier (seeLunum
)COORD
: Coordinate x or y (seeCoordinate
)coordinates
: Coordinates (x;*y*) (seeCoordinates
)
- property coordinates: Coordinates | None#
Return the coordinates.
Wire path#
- class ansys.scadeone.core.swan.WirePath(moves: List[Move] | None = None, w_anchor: WireAnchor | None = None, branch: Branch | None = None)#
Bases:
object
The wire path structure.
Wire path is defined as:
path = {move} w_anchor | {move} branch
{move} means zero or more moves. where:
move
is defined inMove
w_anchor
is defined inWireAnchor
branch
is defined inBranch
- property w_anchor: WireAnchor | None#
Return the wire anchor.
Move#
- class ansys.scadeone.core.swan.Move(coordinates: MoveCoordinates | None = None)#
Bases:
object
Movement of a wire or transition.
Move is defined as:
Move = move_coordinates
Where:
move_coordinates
: Move coordinates (seeMoveCoordinates
)
- property coordinates: MoveCoordinates | None#
Return the coordinates.
Move coordinates#
- class ansys.scadeone.core.swan.MoveCoordinates(coordinates: Coordinates, fork_coordinates: Coordinates | None = None)#
Bases:
object
Move coordinates manages the movement among coordinates of wires and transitions.
Wire coordinates are defined as:
wire_coordinates = COORD | coordinates
and transition coordinates are defined as:
transition_coordinates = (COORD | coordinates) '|' coordinates
Thus, joining both definitions, move coordinates is defined as:
move_coordinates = (COORD | coordinates) '|' coordinates
- property coordinates: Coordinates#
Return the coordinates.
- property fork_coordinates: Coordinates | None#
Return the fork coordinates. Only applies to transitions.