Skip to content

Presentations Guide ​

This guide explains the presentation system in PyPtP. Presentations are visual metadata that define how elements appear on schematic diagrams. Give every node, branch and element a presentation when you create it. pyptp does not add one for you yet.

Full Example

View the complete code: 08_presentations_required.py

Why Presentations?

Presentations exist because PyPtP's file formats (GNF and VNF) were designed for Gaia and Vision, network analysis applications from Phase to Phase. These applications require schematic layout information alongside electrical data.

For purely programmatic use cases (data processing, calculations, or integration pipelines), we are exploring options to support networks without presentation data in future releases.

Why Presentations Matter ​

Networks are described both topologically (electrical connections) and schematically (visual layout). Where an object is drawn doesn't affect power flow results, but Gaia and Vision expect every object to be drawn on at least one sheet.

What Presentations Are (and Aren't) ​

Presentations are visual metadata only. They tell Gaia/Vision where to draw elements on a schematic, but they don't alter the underlying network topology.

Common Misconception

Presentations cannot re-visualize your network's structure. If two nodes are connected by a cable, that connection exists regardless of how (or whether) you present it. Presentations let you:

  • Show or hide elements on specific sheets
  • Position elements at different coordinates
  • Style symbols with colors and sizes

They do not let you:

  • Display a simplified or alternative topology
  • Visually "merge" or "split" nodes
  • Show connections that don't exist electrically

Think of presentations as a layer of sticky notes on top of your network data. You can move the notes around, color them, or leave an object off some sheets. Rearranging notes doesn't change what's written underneath.

Presentation Types ​

TypeUsed ByPurpose
NodePresentationNodesPosition of busbars, substations
BranchPresentationLines, cables, linksPath between two nodes
ElementPresentationSources, loads, generatorsPosition of attached elements

Sheet Requirement ​

Every network needs at least one sheet (the canvas where elements are drawn):

python
from pyptp import NetworkMV
from pyptp.elements.color_utils import CL_GRAY
from pyptp.elements.mv.sheet import SheetMV

network = NetworkMV()

sheet = SheetMV(SheetMV.General(name="Main", color=CL_GRAY))
sheet.register(network)
sheet_guid = sheet.general.guid

Node Presentations ​

Nodes require NodePresentation to specify their visual position:

python
from pyptp.elements.mv.node import NodeMV
from pyptp.elements.mv.presentations import NodePresentation

node = NodeMV(
    NodeMV.General(name="Substation", unom=10.0),
    presentations=[NodePresentation(sheet=sheet_guid, x=100, y=100)],
)
node.register(network)

NodePresentation Parameters ​

ParameterTypeRequiredDescription
sheetGuidYesSheet this presentation belongs to
xintYesHorizontal position (pixels)
yintYesVertical position (pixels)
symbolNodePresentationSymbolNoVisual symbol type
sizeintNoSymbol size multiplier
colorDelphiColorNoSymbol color

Branch Presentations ​

Branches (lines, cables, links) require BranchPresentation to define the path between nodes:

python
from pyptp.elements.mv.link import LinkMV
from pyptp.elements.mv.presentations import BranchPresentation

link = LinkMV(
    LinkMV.General(node1=node1.general.guid, node2=node2.general.guid),
    presentations=[
        BranchPresentation(
            sheet=sheet_guid,
            first_corners=[(100, 100), (200, 100)],
            second_corners=[(300, 100)],
        )
    ],
)
link.register(network)

BranchPresentation Parameters ​

ParameterTypeRequiredDescription
sheetGuidYesSheet this presentation belongs to
first_cornerslist[tuple]YesPolyline from node1 outward
second_cornerslist[tuple]YesPolyline from node2 outward

See Branch Corners for detailed polyline routing.

Element Presentations ​

Elements attached to nodes (sources, loads, etc.) use ElementPresentation:

python
from pyptp.elements.mv.source import SourceMV
from pyptp.elements.mv.load import LoadMV
from pyptp.elements.mv.presentations import ElementPresentation

source = SourceMV(
    SourceMV.General(node=node1.general.guid, sk2nom=100.0),
    presentations=[ElementPresentation(sheet=sheet_guid, x=100, y=50)],
)
source.register(network)

load = LoadMV(
    LoadMV.General(node=node2.general.guid, P=0.05, Q=0.025),
    presentations=[ElementPresentation(sheet=sheet_guid, x=300, y=50)],
)
load.register(network)

ElementPresentation Parameters ​

ParameterTypeRequiredDescription
sheetGuidYesSheet this presentation belongs to
xintYesHorizontal position
yintYesVertical position
colorDelphiColorNoSymbol color
sizeintNoSymbol size multiplier

Multiple Presentations ​

Elements can appear on multiple sheets. This is useful for:

  • Overview diagrams showing the entire network
  • Detail sheets focusing on specific feeders
  • Different voltage level views
python
node = NodeMV(
    NodeMV.General(name="Busbar", unom=10.0),
    presentations=[
        NodePresentation(sheet=overview_guid, x=200, y=200),
        NodePresentation(sheet=detail_guid, x=100, y=150),
    ],
)

See Multi-Sheet Nodes for complete examples.

Complete Example ​

python
"""Every node, branch and element gets a presentation on a sheet.

pyptp does not add one for you yet, so give each object one when you create it.
"""

from pyptp import NetworkMV, configure_logging
from pyptp.elements.color_utils import CL_GRAY
from pyptp.elements.mv.link import LinkMV
from pyptp.elements.mv.load import LoadMV
from pyptp.elements.mv.node import NodeMV
from pyptp.elements.mv.presentations import BranchPresentation, ElementPresentation, NodePresentation
from pyptp.elements.mv.sheet import SheetMV
from pyptp.elements.mv.source import SourceMV
from pyptp.ptp_log import logger

configure_logging(level="INFO")

network = NetworkMV()

# Every network needs at least one sheet
sheet = SheetMV(SheetMV.General(name="Main", color=CL_GRAY))
sheet.register(network)
sheet_guid = sheet.general.guid

# Nodes require NodePresentation
node1 = NodeMV(
    NodeMV.General(name="Node1", unom=10.0),
    presentations=[NodePresentation(sheet=sheet_guid, x=100, y=100)],
)
node1.register(network)

node2 = NodeMV(
    NodeMV.General(name="Node2", unom=10.0),
    presentations=[NodePresentation(sheet=sheet_guid, x=300, y=100)],
)
node2.register(network)

# Branches require BranchPresentation
link = LinkMV(
    LinkMV.General(node1=node1.general.guid, node2=node2.general.guid),
    presentations=[
        BranchPresentation(
            sheet=sheet_guid,
            first_corners=[(100, 100), (200, 100)],
            second_corners=[(300, 100)],
        )
    ],
)
link.register(network)

# Elements require ElementPresentation
source = SourceMV(
    SourceMV.General(node=node1.general.guid, sk2nom=100.0),
    presentations=[ElementPresentation(sheet=sheet_guid, x=100, y=50)],
)
source.register(network)

load = LoadMV(
    LoadMV.General(node=node2.general.guid, P=0.05, Q=0.025),
    presentations=[ElementPresentation(sheet=sheet_guid, x=300, y=50)],
)
load.register(network)

network.save("with_presentations.vnf")
logger.info("Valid network saved")