Skip to content

NetworkLV ​

Low-voltage network model supporting unbalanced analysis.

Import ​

python
from pyptp import NetworkLV

Quick Start ​

python
# Load from file
network = NetworkLV.from_file("input.gnf")

# Access elements
for node in network.nodes.values():
    print(node.general.name)

# Save to file
network.save("output.gnf")

Properties ​

The network's global properties are stored in the properties attribute:

Element Collections ​

The network stores elements in typed collections:

Dict Collections ​

Elements indexed by key (typically GUID):

CollectionKey TypeElement Type
framesGuidFrameLV
textsGuidTextLV
profilesGuidProfileLV
gmtypesintGMTypeLV
sheetsGuidSheetLV
nodesGuidNodeLV
cablesGuidCableLV
linksGuidLinkLV
homesGuidConnectionLV
legendsGuidLegendLV
sourcesGuidSourceLV
fusesGuidFuseLV
transformersGuidTransformerLV
special_transformersGuidSpecialTransformerLV
reactance_coilsGuidReactanceCoilLV
syn_generatorsGuidSynchronousGeneratorLV
async_generatorsGuidAsynchronousGeneratorLV
async_motorsGuidAsynchronousMotorLV
earthing_transformersGuidEarthingTransformerLV
shunt_capacitorsGuidShuntCapacitorLV
batteriesGuidBatteryLV
loadsGuidLoadLV
circuit_breakersGuidCircuitBreakerLV
pvsGuidPVLV
load_switchesGuidLoadSwitchLV
measure_fieldsGuidMeasureFieldLV

List Collections ​

Elements stored in ordered lists:

CollectionElement Type
commentsCommentLV
hyperlinksHyperlinkLV
profile_filesProfileFileLV
measurement_filesMeasurementFileLV
selectionsSelectionLV

Methods ​

Class Methods ​

MethodDescription
from_file(path: str | Path, *, native_check: bool = True) -> NetworkLVCreate LV network from GNF file.

Instance Methods ​

MethodDescription
add(element) -> elementRegister an element in this network and return it.
delete_transformer(guid: str) -> boolRemove transformer from network by GUID string.
get_cable_guid_by_name(name: str) -> strFind cable GUID by name.
get_link(guid: Guid) -> LinkLV | NoneFind link by GUID.
get_node_guid_by_name(name: str) -> strFind node GUID by name.
get_sheet_guid_by_name(name: str) -> strFind sheet GUID by name.
get_transformer(guid: str) -> TransformerLV | NoneFind transformer by GUID string.
save(path: str | Path, version: GnfVersion = <GnfVersion.G8_12: G8.12>, *, validate_on_migration_failure: bool = True, native_check: bool = True) -> NoneSave network to GNF file.

Adding Elements ​

add() registers an element and returns it, so you can create and keep it in one line:

python
node = network.add(NodeLV(NodeLV.General(name="Kerkstraat 1")))

A connection refers to its GM type by number, which add() fills in when you register a GM type:

python
from pyptp.type_reader import Types

household = network.add(Types().get_lv_gm_type("sjv2500")).general.number
connection = ConnectionLV(..., gms=[ConnectionLV.GM(gm_type_number=household)])

A GM type with number 0 gets the number after the highest one in use. A number that is already in use raises ValueError. Loading a file follows the same rules: two GM types with one number raise ValueError.