Skip to content

LV Street ​

This example builds a small LV network from nothing: a 10 kV rail with a source, a transformer to the LV rail of the substation, two feeders along both sides of the Molenstraat with three connections each, and a tie cable between the feeder ends that is open at one side. Types come from the bundled type workbook.

Full Example

View the complete code: 16_lv_street.py

Network, Types and Sheet ​

network.add() registers an element and returns it, so each element is created and kept in one line:

python
network = NetworkLV()
types = Types()
sheet = network.add(SheetLV(SheetLV.General(name="Molenstraat"))).general.guid

Cables Drawn with between() ​

Every cable is drawn with BranchPresentation.between(), and its length follows from the drawing:

python
def add_cable(
    name: str, color: DelphiColor, node1: NodeLV, node2: NodeLV, via: Sequence[tuple[int, int]] = ()
) -> CableLV:
    """Add a cable between two nodes, its length follows the drawing."""
    presentation = BranchPresentation.between(node1, node2, sheet, via=via)
    presentation.color = color
    drawn = sum(math.dist(a, b) for a, b in pairwise(presentation.polyline()))
    cable = CableLV(
        CableLV.General(node1=node1.general.guid, node2=node2.general.guid, name=name),
        presentations=[presentation],
        cable_part=CableLV.CablePart(length=round(drawn / PIXELS_PER_METER, 1)),
    )
    cable.set_cable_type(types, "4*150 VVMvKsas/Alk")
    return network.add(cable)

The LV rail is drawn as a vertical line, so the first section of each feeder leaves it at the height of its first joint.

Fuses and Connections ​

The first section of each feeder gets a fuse at the rail. Every joint gets a connection with its service cable, fuse and GM type:

python
fuse = FuseLV(
    FuseLV.General(name=name, in_object=section.general.guid, side=1),
    presentations=[SecundairPresentation(sheet=sheet, distance=40, color=color)],
)
fuse.set_type(types, "Jean Muller 200 A gL/gG")
network.add(fuse)

house = ConnectionLV(
    ConnectionLV.General(node=joint.general.guid, name=f"Molenstraat {house_number}", length=10),
    presentations=[ElementPresentation(sheet=sheet, x=x + 80, y=cable_y + side * 200)],
    gms=[ConnectionLV.GM(gm_type_number=gm_type)],
)
house.set_cable_type(types, "Vulto 4x10 Cu")
house.set_fuse_type(types, "Jean Muller 25 A gL/gG")
network.add(house)

An element with one type has set_type(). The connection has a cable type and a fuse type, so it has set_cable_type() and set_fuse_type(). See Type Reader.

Transformer and GM Type ​

python
transformer = TransformerLV(
    TransformerLV.General(node1=mv_rail.general.guid, node2=lv_rail.general.guid, name="Trafo 1"),
    presentations=[BranchPresentation.between(mv_rail, lv_rail, sheet)],
    type=TransformerLV.TransformerType(),
)
transformer.set_type(types, "10250/400 V  630 kVA")
network.add(transformer)

household_gm = network.add(types.get_lv_gm_type("sjv2500"))
household = household_gm.general.number

add() gives the GM type the next free number, and household is that number, ready for ConnectionLV.GM(gm_type_number=...).

The Open Tie ​

The tie cable joins the ends of both feeders, and is opened at its node 2 side:

python
tie = add_cable("Molenstraat kop", CL_BLACK, odd_end, even_end, via=[(1240, 540), (1240, 660)])
tie.general.set_switches(SIDE_NODE2, closed=False)

set_switches() opens or closes the phase and auxiliary conductor switches on one side. Neutral and PE switches are not changed.

Next Steps ​