IscDiagram
- class ipsa.IscDiagram
The
IscDiagram
class provides access to graphical data on a single IPSA diagram. These functions allow network components to be drawn, display options to be set and deleted.The creation of items on the diagram also creates the associated network components. The parameters of these components can then be set using the functions described for the particular component types.
The origin for the co-ordinates is normally the top left corner of the diagram. Positive values of X are to the right whilst positive values of Y are down below the origin.
- SetName(strName: str) None
Sets the name of the diagram.
- Parameters:
strName (str) – The name of the diagram.
- CreateBusbarPoint(strName: str, dX: float, dY: float) int
Creates a new busbar component on the diagram. A point busbar symbol is a small dot which does not resize as the diagram zoom level is changed.
- CreateBusbarJunction(strName: str, dX: float, dY: float) int
Creates a new busbar component on the diagram. A junction busbar symbol is the circular junction symbol.
- CreateBusbarHexagonal(strName: str, dX: float, dY: float) int
Creates a new busbar component on the diagram. A hexagonal busbar symbol has six sides.
- CreateBusbarCircular(strName: str, dX: float, dY: float) int
Creates a new busbar component on the diagram. A circular busbar symbol is a circle.
- CreateBusbarRectangular(strName: str, bHorizontal: bool, dX: float, dY: float) int
Creates a new busbar component on the diagram. The rectangular symbol is the standard horizontal or vertical busbar.
- DrawBusbarPoint(nUID: int, dX: float, dY: float) bool
Draws an existing busbar component on the diagram as defined by the busbar UID. A point busbar symbol is displayed as a small dot which does not resize as the diagram zoom level is changed.
- DrawBusbarJunction(nUID: int, dX: float, dY: float) bool
Draws an existing busbar component on the diagram as defined by the busbar UID. A junction busbar symbol is the solid circular junction symbol.
- DrawBusbarHexagonal(nUID: int, dX: float, dY: float) bool
Draws an existing busbar component on the diagram as defined by the busbar UID. The hexagonal symbol is the standard filled hexagonal busbar.
- DrawBusbarRectangular(nUID: int, bHorizontal: bool, dSize: float, dX: float, dY: float) bool
Draws an existing busbar component on the diagram as defined by the busbar UID. The rectangular symbol is the standard horizontal or vertical busbar.
- Parameters:
- Returns:
Boolean denoting whether the busbar was drawn.
- Return type:
- DrawBusbarCircular(nUID: int, dSize: float, dX: float, dY: float) bool
Draws an existing busbar component on the diagram as defined by the busbar UID. The circular symbol is the larger unfilled circle.
- CreateLine(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int
Deprecated. Instead, use CreateBranch.
Creates a new branch component on the diagram.
- Parameters:
strName (str) – The branch name.
dXFrom (float) – The x coordinate of the busbar where the branch starts.
dYFrom (float) – The y coordinate of the busbar where the branch starts.
dXTo (float) – The x coordinate of the busbar where the branch ends.
dYTo (float) – The y coordinate of the busbar where the branch ends.
- Returns:
The unique positive ID of the new branch. A negative value is returned if the “from” end busbar is not found, and zero is returned if the “to” end busbar is not found.
- Return type:
- CreateBranch(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int
Creates a new branch component on the diagram.
- Parameters:
strName (str) – The branch name.
dXFrom (float) – The x coordinate of the busbar where the branch starts.
dYFrom (float) – The y coordinate of the busbar where the branch starts.
dXTo (float) – The x coordinate of the busbar where the branch ends.
dYTo (float) – The y coordinate of the busbar where the branch ends.
- Returns:
The unique positive ID of the new branch. If the branch cannot be drawn, the return value is 0.
- Return type:
- DrawLine(nUID: int) bool
Draws the symbol for the line identified by the unique ID. The line is drawn as a single segment between two busbars. The line must have been created using one of the following first:
IscDiagram.CreateLine
IscNetwork.CreateBranch
IscNetwork.CreateTransformer
- CreateBreaker(strName: str, dX: float, dY: float) int
Creates a new circuit breaker on the diagram. Note branch has to have already been drawn.
- DrawBreaker(nBreakerUID: int, dX: float, dY: float) bool
Draws the symbol for the breaker identified by the unique ID nBreakerUID at the location dX,dY.
- CreateTransformer(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int
Deprecated. Instead, use Create2WTransformer.
Creates a new transformer component on the diagram.
- Parameters:
strName (str) – The branch name.
dXFrom (float) – The x coordinate of the busbar where the branch starts.
dYFrom (float) – The y coordinate of the busbar where the branch starts.
dXTo (float) – The x coordinate of the busbar where the branch ends.
dYTo (float) – The y coordinate of the busbar where the branch ends.
- Returns:
The unique positive ID of the new transformer. A negative value is returned if the “from” end busbar is not found, and zero is returned if the “to” end busbar is not found.
- Return type:
- Create2WTransformer(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int
Creates a new transformer component on the diagram.
- Parameters:
strName (str) – The branch name.
dXFrom (float) – The x coordinate of the busbar where the branch starts.
dYFrom (float) – The y coordinate of the busbar where the branch starts.
dXTo (float) – The x coordinate of the busbar where the branch ends.
dYTo (float) – The y coordinate of the busbar where the branch ends.
- Returns:
The unique positive ID of the new transformer. If the transformer cannot be drawn, the return value is 0.
- Return type:
- DrawTransformer(nUID: int) bool
Draws the symbol for the transformer identified by the unique ID. The line is drawn as a single segment between two busbars. The line must have been created using the following first:
IscNetwork.CreateTransformer
- CreateUnbalancedLine(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int
Deprecated. Instead, use CreateUnbalancedBranch.
Creates a new unbalanced line component on the diagram.
- Parameters:
strName (str) – The unbalanced line name.
dXFrom (float) – The x coordinate of the busbar where the branch starts.
dYFrom (float) – The y coordinate of the busbar where the branch starts.
dXTo (float) – The x coordinate of the busbar where the branch ends.
dYTo (float) – The y coordinate of the busbar where the branch ends.
- Returns:
The unique positive ID of the new unbalanced line component. A negative value is returned if the “from” end busbar is not found, and zero is returned if the “to” end busbar is not found.
- Return type:
- CreateUnbalancedBranch(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int
Creates a new unbalanced line component on the diagram.
- Parameters:
strName (str) – The unbalanced line name.
dXFrom (float) – The x coordinate of the busbar where the branch starts.
dYFrom (float) – The y coordinate of the busbar where the branch starts.
dXTo (float) – The x coordinate of the busbar where the branch ends.
dYTo (float) – The y coordinate of the busbar where the branch ends.
- Returns:
The unique positive ID of the new unbalanced line component. If the unbalanced line cannot be drawn, the return value is 0.
- Return type:
- CreateUnbalancedTransformer(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int
Deprecated. Instead, use CreateUnbalanced2WTransformer.
Creates a new unbalanced transformer component on the diagram.
- Parameters:
strName (str) – The unbalanced transformer name.
dXFrom (float) – The x coordinate of the busbar where the branch starts.
dYFrom (float) – The y coordinate of the busbar where the branch starts.
dXTo (float) – The x coordinate of the busbar where the branch ends.
dYTo (float) – The y coordinate of the busbar where the branch ends.
- Returns:
The unique positive ID of the new unbalanced transformer component. A negative value is returned if the “from” end busbar is not found, and zero is returned if the “to” end busbar is not found.
- Return type:
- CreateUnbalanced2WTransformer(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int
Creates a new unbalanced transformer component on the diagram.
- Parameters:
strName (str) – The unbalanced transformer name.
dXFrom (float) – The x coordinate of the busbar where the branch starts.
dYFrom (float) – The y coordinate of the busbar where the branch starts.
dXTo (float) – The x coordinate of the busbar where the branch ends.
dYTo (float) – The y coordinate of the busbar where the branch ends.
- Returns:
The unique positive ID of the new unbalanced transformer component. If the unbalanced transformer cannot be drawn, the return value is 0.
- Return type:
- AddPointToLine(nLineUID: int, dX: float, dY: float, bFromEnd: bool) bool
Adds a knee point to the line identified by the unique ID.
- Parameters:
- Returns:
Boolean denoting whether the knee point was added.
- Return type:
- RefreshLine(nLineUID: int) None
Redraws the line identified by the line UID after knee points have been added.
- Parameters:
nLineUID (int) – The line UID.
- SplitBranch(nLineUID: int, nSection: int, dRatio: float, strName: str) int
Splits a branch into two sections connected by a new busbar.
- Parameters:
nLineUID (int) – The line UID.
nSection (int) – Specifies which section of a multi-section branch is split. For branches with only one section then nSection should be set to 0.
dRatio (float) – Specifies how the branch impedances are divided between the new branches. A value of 0.0 sets the split position to be at the “From” end whilst a value of 1.0 specifies the “To” end. Values between 0.0 and 1.0 split the branch in proportion. For multi-section branches dRatio splits the section identified by nSection.
strName (str) – The name of the busbar.
- Returns:
The UID of the new branch if it is greater than 0. ) if the branch has not been split. This is because there is a circuit breaker on the branch or the branch is drawn on more than one diagram.
- Return type:
- DrawUndrawnItemsAttachedToBusbar(nBusbarUID: int) None
Draws items attached to the busbar identified by the busbar UID if they are not already drawn on the diagram. Note that this will draw branch items as well.
- Parameters:
nBusbarUID (int) – The busbar UID.
- DeleteItem(nUID: int) bool
Deletes the graphic item identified by the UID. This may be a line, radial component or busbar.
- GetLineLength(nUID: int) float
- GetLineLength(pComponent) float
Returns the component length for the graphic symbol on the current diagram. On geographic diagrams this function returns the actual line length, assuming that the diagram is correctly scaled.
- SetItemPenColour(nUID: int, nRed: int, nGreen: int, nBlue: int, nAlpha: int) bool
Sets the outline colour of the diagram object. The colour is set by the RGB parameters. All colour parameters should be between 0 and 255.
- SetItemBrushColour(nUID: int, nRed: int, nGreen: int, nBlue: int, nAlpha: int) bool
Sets the fill colour of the diagram object. The colour is set by the RGB parameters. All colour parameters should be between 0 and 255.
- MapToLatLong(fScreenX: float, fScreenY: float) List[float]
Returns the latitude and longitude in decimal degrees of the screen position. The diagram is the one referenced by the IscDiagram object that the function is called on. The fScreenX and fScreenY parameters are relative to the nominal centre point of the screen, therefore calling this function with fScreenX = 0.0 and fScreenY = 0.0 returns the centre point of the background map in degrees. Note that the screen X is north/south and screen y is east/west.
- LatLongToMap(fN: float, fE: float) List[float]
Returns the screen X and Y coordinates of the latitude and longitude. The fScreenX and fScreenY coordinates are relative to the nominal centre point of the screen which can be found by the MapToLatLong function. Note that the screen X is north/south and screen y is east/west.
- GetUIDFromCoordinates(dX: float, dY: float) int
Returns the UID of a component at coordinates (dX, dY). The screen coordinates are relative to the nominal centre point of the screen.
- GetBusbarUIDFromCoordinates(dX: float, dY: float) int
Returns the UID of a busbar at coordinates (dX, dY). The screen coordinates are relative to the nominal centre point of the screen.
- GetItemX(nUID: int) float
Returns the screen X coordinate of the busbar. The screen coordinates are relative to the nominal centre point of the screen.
- GetItemY(nUID: int) float
Returns the screen Y coordinate of the busbar. The screen coordinates are relative to the nominal centre point of the screen.
- GetItemFromXPoints(nUID: int) List[float]
Returns a list of floats for the screen X coordinates of the FROM busbar point, the middle point of the line and all knee points lying on the branch between these two points. The coordinates are for the FROM end of the line. The screen coordinates are relative to the nominal centre point of the screen.
- GetItemFromYPoints(nUID: int) List[float]
Returns a list of floats for the screen Y coordinates of the FROM busbar point, the middle point of the line and all knee points lying on the branch between these two points. The coordinates are for the FROM end of the line. The screen coordinates are relative to the nominal centre point of the screen.
- GetItemToXPoints(nUID: int) List[float]
Returns a list of floats for the screen X coordinates of the TO busbar point, the middle point of the line and all knee points lying on the branch between these two points. The coordinates are for the TO end of the line. The screen coordinates are relative to the nominal centre point of the screen.
- GetItemToYPoints(nUID: int) List[float]
Returns a list of floats for the screen Y coordinates of the TO busbar point, the middle point of the line and all knee points lying on the branch between these two points. The coordinates are for the TO end of the line. The screen coordinates are relative to the nominal centre point of the screen.