Components#

Component#

class mhi.xml.pscad.Component#

A Component

property classid: str#

The classid of the component.

Typically “UserCmp” but other possibilities include “WireOthogonal”, “Sticky”, “GraphFrame”, “ControlFrame”, and so on.

property location: XY#

The (X, Y) location of the component.

property canvas: Schematic#

The canvas the component is on.

property size: XY#

The size (width & height) of the component.

property defn: str | None#

The component’s definition.

property scope_and_defn: tuple[str, str]#

Returns the component definitions’s scope and definition names.

property name: str | None#

Returns the component’s assigned name value.

The name must be stored in a parameter called name, Name or NAME.

property layer: Layer | None#

The Layer the component is on, or None if not on any layer.

custom_state(state_name: str, state: CustomLayerState)#

Set a custom layer state for this component.

The component must already be part of a layer, and that layer must already have the named custom state added to it. This component will be set to the given state when the component’s layer is set to the given custom state name.

Added in version 1.4.0.

property params: ParamListNode | None#

The parameter list node of the component

Individual parameters can be set and retrieved using index notation:

name = cmp['Name']
cmp['BaseKV'] = '230.0 [kV]'
property enabled: bool#

Is this component enabled.

Note

This does not check if the component is on a disabled layer.

enable(state=True) None#

Enable this component

Note

This does not affect whether the component is on a disabled layer.

disable() None#

Disable this component

delete() None#

Remove this component from the canvas.

UserCmp#

class mhi.xml.pscad.UserCmp#

A component with a definition defined in a ‘.pslx’ file

property defn: str#

The definition of the component

property orient: int#

The orientation of the component.

Orient

Transformation

0

Untransformed

1

90 clockwise

2

180 clockwise

3

270 clockwise

4

Mirrored left/right

5

Mirrored + 90 clockwise

6

Mirrored + 180 clockwise

7

Mirrored + 270 clockwise

Added in version 1.4.0.

property subcanvas: 'Schematic' | None#

The component’s definition’s schematic, in one exists

is_module() bool#

Does this component’s definition contain a schematic?

Frames#

class mhi.xml.pscad.GraphFrame#

A Graph Frame

classmethod create_instance(canvas: Schematic, x: int = 1, y: int = 1, w: int = 32, h: int = 16, /, **kwargs) GraphFrame#

Create a Graph Frame on the canvas.

Added in version 1.2.0.

class mhi.xml.pscad.PlotFrame#

An XY Plot Frame

classmethod create_instance(canvas: Schematic, x: int = 1, y: int = 1, w: int = 18, h: int = 20, /, **kwargs) PlotFrame#

Create an XY Plot Frame on the canvas.

Added in version 1.2.0.

Wires#

Orthogonal#

class mhi.xml.pscad.WireOrthogonal#

An orthogonal wire

Added in version 1.2.0.

static create_instance(canvas: Schematic, /, *vertices: tuple[int, int] | XY) WireOrthogonal#

Create an Orthogonal wire on the canvas.

If more than two vertices are given, a multi-vertex wire will be created. If any segment is neither horizontal or vertical, additional vertices will be inserted.

Parameters:

*vertices – A series of (X, Y) pairs, in grid units

Diagonal#

class mhi.xml.pscad.WireDiagonal#

A Sticky Wire

Added in version 1.2.0.

static create_instance(canvas: Schematic, /, *vertices: tuple[int, int] | XY, lead_length: int = 1, lead_directions: list[XY] | None = None) WireDiagonal#

Create new sticky wire on the canvas.

vertices() list[Vertex]#

The list <vertex> elements of a Sticky Wire

These are the raw <vertex> elements, relative to the component’s origin. Use Wire.vertex[i] to retrieve the actual canvas vertex locations.

property vertex: VertexContainer#

Access an individual end-point vertex of a sticky wire

Vertex locations are absolute positions on the canvas. Setting a new vertex location will move the corresponding lead vertex by the same amount.

leads() list[Vertex]#

The list <vertex> elements of the lead vertices of a Sticky Wire

These are the raw <vertex> elements, relative to the component’s origin. Use StickyWire.lead[i] to retrieve the actual canvas vertex locations.

property lead: LeadContainer#

Access the sticky wire’s end-point lead’s vertex.

Vertex locations are absolute positions on the canvas. The lead vertex position must always share either the same x-value or the same y-value, but not both, to keep the lead horizontal or vertical.

Bus#

class mhi.xml.pscad.Bus#

A Bus

Added in version 1.2.0.

Type#

alias of BusType

static create_instance(canvas: Schematic, /, *vertices: tuple[int, int] | XY, Name: str = '', BaseKV: float = 0.0, VM: float = 1.0, VA: float = 0.0, type: BusType = BusType.AUTO) Bus#

Create a Bus on the canvas.

If more than two vertices are given, a multi-vertex bus will be created. If any segment is neither horizontal or vertical, additional vertices will be inserted.

property parameters: Parameters#

Retrieve the Bus’s Parameters

Bus Parameters#

class mhi.xml.pscad.component.Bus.Parameters(param_list: _Element | None)#

Bus parameters

BaseKV: float#
VA: float#
VM: float#
name: str#
type: BusType#

Annotations#

Divider#

class mhi.xml.pscad.Divider#

The PSCAD Divider <Line/> node class

classmethod create_instance(canvas: Schematic, x: int = 1, y: int = 1, w: int = 0, h: int = 0, **kwargs) Divider#

Create a Divider on the canvas.

Added in version 1.2.0.

property parameters: Parameters#

Retrieve the Divider’s Parameters

class mhi.xml.pscad.component.Divider.Parameters(param_list: _Element | None)#

Divider parameters

color: Colour#
state: Choice.enum('2D', '3D')#
style: LineStyle#
weight: Choice.enum('02_PT', '04_PT', '06_PT', '08_PT', '10_PT', '12_PT', '14_PT', 'BY_NODE_TYPE')#

Group Box#

class mhi.xml.pscad.GroupBox#

A PSCAD Group Box <Line/> node class

classmethod create_instance(canvas: Schematic, x: int = 1, y: int = 1, w: int = 11, h: int = 6, *, name: str = 'Groupbox', **kwargs) GroupBox#

Create a Group Box on the canvas.

Added in version 1.2.0.

property parameters: Parameters#

Retrieve the Group Box’s Parameters

class mhi.xml.pscad.component.GroupBox.Parameters(param_list: _Element | None)#

Group Box parameters

fill_bg: Colour#
fill_fg: Colour#
fill_style: FillStyle#
font: str#
line_colour: Colour#
line_style: LineStyle#
line_weight: int#
name: str#
show_name: bool#

Sticky#

class mhi.xml.pscad.Sticky#

The PSCAD <Sticky/> node class

static create_instance(canvas: Schematic, x: int = 1, y: int = 1, w: int = 6, h: int = 2, text: str = 'Sticky Note', **kwargs) Sticky#

Create a Sticky Note on the canvas.

Added in version 1.2.0.

property text: str#

Sticky Note contents”

property parameters: Parameters#

Retrieve the Bus’s Parameters

class mhi.xml.pscad.component.Sticky.Parameters(param_list: _Element | None)#

Sticky parameters

align: int#
arrows: Arrows#
bdr_color_adv: Colour#
bg_color_adv: Colour#
fg_color_adv: Colour#
full_font: str#
hl_color_adv: Colour#
style: int#

TLine & Cables#

class mhi.xml.pscad.TLine#

The PSCAD <TLine/> node class

class mhi.xml.pscad.Cable#

The PSCAD <Cable/> node class