### Get and Print Cable C6 Sizing Information Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Retrieves the 'cable_C6' component and prints its initial sizing details, including load current, number of cables per phase, and the minimum required CSA. ```python cable_C6: Cable = network.get_component("cable_C6") print( f"sizing based on In: {cable_C6.sizing_based_on_I_n}", f"load current per phase: {cable_C6.I_b_ph.to('A'):~P.0f}", f"single-core cables per phase: {cable_C6.n_phase}", f"load current per single-core cable: {cable_C6.I_b.to('A'):~P.0f}", f"required min. CSA: {cable_C6.S.to('mm**2'):~P.0f}", sep="\n" ) ``` -------------------------------- ### Size PE-Conductors Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Configures global PE conductor parameters and applies sizing calculations to all cables in the network. ```python from python_electric import PEConductorConfig new_glob_pe_config = PEConductorConfig( mech_protected=False, separated=True ) network.glob_pe_config = new_glob_pe_config network.size_all_pe_conductors() for cable in network.iter_all_cables(): print( f"{cable.name} [{cable.earthing_system}]: " f"{cable.n_phase} x {cable.S:~P.0f}, " f"PE = {cable.S_pe:~P.0f}" ) ``` -------------------------------- ### Define and Add Cable C1 Component Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Creates a CableInput object for connection 'C1' with specified length, material, installation method, and other parameters. This data is then added to the network. ```python cable_C1_dat = CableInput( name="cable_C1", L=Q_(5, 'm'), conductor_material=ConductorMaterial.COPPER, insulation_material=InsulationMaterial.PVC, T_amb=Q_(30, 'degC'), install_method=InstallMethod.F, cable_mounting=CableMounting.PERFORATED_TRAY, cable_arrangement=CableArrangement.SINGLE_CORE_TOUCHING, earthing_system=EarthingSystem.IT, num_other_circuits=0 ) network.add_component("C1", cable_C1_dat) ``` -------------------------------- ### Import python-electric components Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Imports necessary classes and functions from the python-electric library for network design. This includes classes for network topology, loads, components, and electrical properties. ```python from python_electric import ( Q_, NetworkTopology, Load, TransformerInput, CableInput, ConductorMaterial, InsulationMaterial, InstallMethod, CableMounting, CableArrangement, EarthingSystem, VoltReference, CircuitBreaker ) ``` -------------------------------- ### Define and Add Cable C6 Component Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Creates a CableInput object for connection 'C6' with specified length, material, and installation parameters, then adds it to the network. This defines the characteristics of the cable for this connection. ```python cable_C6_dat = CableInput( name="cable_C6", L=Q_(15, 'm'), conductor_material=ConductorMaterial.COPPER, insulation_material=InsulationMaterial.PVC, T_amb=Q_(30, 'degC'), install_method=InstallMethod.F, cable_mounting=CableMounting.PERFORATED_TRAY, cable_arrangement=CableArrangement.SINGLE_CORE_TOUCHING, earthing_system=EarthingSystem.IT, num_other_circuits=0 ) network.add_component("C6", cable_C6_dat) ``` -------------------------------- ### Create Network Topology and Connections Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Initializes a NetworkTopology object and adds source grid connections and subsequent network connections with associated loads. This sets up the basic structure of the electrical network. ```python network = NetworkTopology( name="network", U_n=Q_(400, 'V'), earthing_system=EarthingSystem.IT, neutral_distributed=False ) # SOURCE CONNECTION network.add_source_grid_connection( conn_id="C0", end_id="MV_BUS", U_l=Q_(11, 'kV'), S_sc=Q_(500, 'MVA') ) network.add_connection( conn_id="T1", start_id="MV_BUS", end_id="T1_BUS", load=Load( U_l=Q_(420, 'V'), cos_phi=1.0, P_e=Q_(1000, 'kVA') ) ) network.add_connection( conn_id="C1", start_id="T1_BUS", end_id="B2_BUS", load=Load( U_l=Q_(400, 'V'), cos_phi=1.0, P_e=Q_(1000, 'kVA') ) ) network.add_connection( conn_id="C6", start_id="B2_BUS", end_id="T6_BUS", load=Load( U_l=Q_(400, 'V'), cos_phi=1.0, P_e=Q_(400, 'kVA') ) ) ``` -------------------------------- ### Calculate Short-Circuit Currents Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Executes short-circuit analysis on the network and iterates through results to display maximum and minimum fault currents per bus. ```python sc_results = network.run_shortcircuit_calc() for bus_id, sc_result in sc_results.items(): print( f"Bus {bus_id}: " f"MAX [{sc_result.fault_type_max}] = {sc_result.max.to('kA'):~P.2f}, " f"MIN [{sc_result.fault_type_min}] = {sc_result.min.to('kA'):~P.2f}" ) ``` -------------------------------- ### Load Project and Build Network Topology - Python Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Loads a project file from disk and builds the network topology. This is a foundational step for subsequent network analysis and design operations within the python-electric library. ```python from python_electric.gui import ProjectModel from python_electric.gui.build import build_network_topology p = "./LV_design_03.pxe" proj = ProjectModel.load(p) topo = build_network_topology(proj) ``` -------------------------------- ### Get and Print Cable C1 Sizing Information Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Retrieves the 'cable_C1' component from the network and prints its initial sizing information, including current ratings and required conductor cross-sectional area (CSA). ```python from python_electric import Cable cable_C1: Cable = network.get_component("cable_C1") print( f"sizing based on In: {cable_C1.sizing_based_on_I_n}", f"load current per phase: {cable_C1.I_b_ph.to('A'):~P.0f}", f"single-core cables per phase: {cable_C1.n_phase}", f"load current per single-core cable: {cable_C1.I_b.to('A'):~P.0f}", f"required min. CSA: {cable_C1.S.to('mm**2'):~P.0f}", sep="\n" ) ``` -------------------------------- ### Display Global Protective Equipment Configuration Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Prints the global configuration settings for protective equipment within the network. This includes parameters like conductor material, insulation material, mechanical protection, and separation. ```python print(topo.glob_pe_config) ``` -------------------------------- ### Resize Cable C6 and Print Updated Sizing Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Resizes 'cable_C6' by specifying both the number of single-core cables per phase and the CSA. It then prints the updated sizing information to reflect these changes. ```python cable_C6.resize(n_phase=4, S=Q_(95, 'mm**2')) print( f"sizing based on In: {cable_C6.sizing_based_on_I_n}", f"load current per phase: {cable_C6.I_b_ph.to('A'):~P.0f}", f"single-core cables per phase: {cable_C6.n_phase}", f"load current per single-core cable: {cable_C6.I_b.to('A'):~P.0f}", f"required min. CSA: {cable_C6.S.to('mm**2'):~P.0f}", sep="\n" ) ``` -------------------------------- ### Display Global PE Conductor Configuration Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Prints the current global configuration settings for sizing PE-conductors. These settings include conductor material, insulation material, mechanical protection status, separation, and interrupt time. ```python print(network.glob_pe_config) ``` -------------------------------- ### Configure and Connect Circuit Breakers Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Retrieves load/fault data, suggests appropriate circuit breaker specifications, connects them to the network, and generates plots for verification. ```python cb_Q1_sug = network.suggest_circuit_breaker( "cable_C1", prefer_adjustable=True, safety_factor_Icu=1.5 ) cb_Q1 = network.connect_circuit_breaker( "cable_C1", standard=CircuitBreaker.Standard.INDUSTRIAL, category=cb_Q1_sug.category, I_cu=cb_Q1_sug.I_cu, k_m=cb_Q1_sug.k_m ) plt_C1 = network.cable_plot("cable_C1") plt_C1.show() ``` -------------------------------- ### Calculate and Print Correction Factors for cable_W1 Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Calculates the total correction factor for 'cable_W1' based on its ampacity and ampacity at standard conditions. It then transforms the actual load and nominal currents to standard conditions for comparison. ```python k = cable_W1.I_z / cable_W1.I_z0 I_b0 = cable_W1.I_b_ph / k I_n0 = cable_W1.I_n / k print( f"Total correction factor: {k:.3f}", f"Actual load current transformed to standard conditions: {I_b0.to('A'):~P.0f}", f"Nominal current transformed to standard conditions: {I_n0.to('A'):~P.0f}", sep="\n" ) ``` -------------------------------- ### Iterate and Print All Cable Sizing - Python Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Iterates through all cables in the network topology and prints their sizing details using the `print_cable` function. This provides a comprehensive overview of the cable sizing results for the entire network. ```python for cable in topo.iter_all_cables(): print_cable(cable) ``` -------------------------------- ### Check Selectivity Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Verifies the selectivity between an upstream and a downstream circuit breaker to ensure proper fault isolation. ```python res = network.check_selectivity(upcable_id="cable_C1", downcable_id="cable_C6") print(res) ``` -------------------------------- ### Analyze and Retrieve Component Electrical Data Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Retrieves electrical characteristics of a component (busbar or cable) from the network and prints key metrics such as load current, nominal current, ampacity, and short-circuit currents. ```python busbar: BusBar = network.get_component("busbar") print( f"load current: {busbar.I_b.to('A'):~P.1f}", f"nominal current: {busbar.I_n.to('A'):~P.1f}", f"ampacity: {busbar.I_z.to('A'):~P.1f}", f"maximum short-circuit current: {busbar.I_sc_max.to('A'):~P.1f}", f"minimum short-circuit current: {busbar.I_sc_min.to('A'):~P.1f}", sep="\n" ) ``` -------------------------------- ### Resize Cable C1 and Print Updated Sizing Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Resizes 'cable_C1' by changing the number of single-core cables per phase and prints the updated sizing information. This demonstrates how changing cable configuration affects the required CSA. ```python cable_C1.resize(n_phase=6) print( f"sizing based on In: {cable_C1.sizing_based_on_I_n}", f"load current per phase: {cable_C1.I_b_ph.to('A'):~P.0f}", f"single-core cables per phase: {cable_C1.n_phase}", f"load current per single-core cable: {cable_C1.I_b.to('A'):~P.0f}", f"required min. CSA: {cable_C1.S.to('mm**2'):~P.0f}", sep="\n" ) ``` -------------------------------- ### Get Cable Voltage Drop (Python) Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Retrieves the pre-calculated steady-state voltage drop across a cable, referenced to ground. It accesses the 'dU' and 'dU_rel' attributes of a Cable object. This assumes the Cable object is already instantiated and loaded. ```python print( f"Absolute voltage drop: {cable_C1.dU.to('V'):~P.2f}", f"Relative voltage drop: {cable_C1.dU_rel.to('pct'):~P.2f}", sep="\n" ) ``` ```python print( f"Absolute voltage drop: {cable_C6.dU.to('V'):~P.2f}", f"Relative voltage drop: {cable_C6.dU_rel.to('pct'):~P.2f}", sep="\n" ) ``` -------------------------------- ### Calculate Cable Voltage Drops During Motor Start-Up Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Calculates the voltage drops across cables W1 (connected to C2) and W2 (connected to C3) during motor start-up. This method directly uses the 'get_voltage_drop' method on the 'Cable' objects, providing the start-up currents and power factors. It also includes the voltage drop from the network connection 'C1' to find the total start-up voltage drop. ```python dU_c2_start, dU_rel_c2_start = cable_W1.get_voltage_drop( U_l=cable_W1.U_l, I_b=Q_(I_sub1_start, 'A'), cos_phi=cos_phi_sub1_start ) dU_c3_start, dU_rel_c3_start = cable_W2.get_voltage_drop( U_l=cable_W2.U_l, I_b=Q_(I_motor_start, 'A'), cos_phi=cos_phi_motor_start ) dU_c1, dU_rel_c1 = network.get_conn_voltage_drop("C1") dU_tot_start = dU_c1 + dU_c2_start + dU_c3_start dU_rel_tot_start = dU_rel_c1 + dU_rel_c2_start + dU_rel_c3_start print(f"Absolute voltage drop cable W1 (C2): {dU_c2_start:~P.2f}") print(f"Relative voltage drop cable W1 (C2): {dU_rel_c2_start.to('pct'):~P.2f}", "\n") print(f"Absolute voltage drop cable W2 (C3): {dU_c3_start:~P.2f}") print(f"Relative voltage drop cable W2 (C3): {dU_rel_c3_start.to('pct'):~P.2f}", "\n") print(f"Absolute total voltage drop: {dU_tot_start.to('V'):~P.2f}") print(f"Relative total voltage drop: {dU_rel_tot_start.to('pct'):~P.2f}") ``` -------------------------------- ### Get Transformer Voltage Drop (Python) Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Retrieves the pre-calculated steady-state voltage drop across a transformer, referenced to ground. It accesses the 'dU' and 'dU_rel' attributes of a Transformer object obtained from the network. Requires the Transformer object to be instantiated. ```python from python_electric import Transformer T1: Transformer = network.get_component("T1") print( f"Absolute voltage drop: {T1.dU.to('V'):~P.2f}", f"Relative voltage drop: {T1.dU_rel.to('pct'):~P.2f}", sep="\n" ) ``` -------------------------------- ### Configure Circuit Breaker and Cable Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Configures a circuit breaker with specific industrial standards and category D, and connects it to a cable. It then prints the circuit breaker details. This is useful for setting up protection devices in an electrical network simulation. ```python cb_w2 = network.connect_circuit_breaker( "cable_W2", standard=CircuitBreaker.Standard.INDUSTRIAL, category=CircuitBreaker.Category.D, I_cu=cb_w2_sug.I_cu, E_t=Q_(5e5, 'A ** 2 * s') ) print(cb_w2) ``` -------------------------------- ### Calculate and Print Voltage Drops - Python Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Iterates through all connections in the network topology, calculates the voltage drop (both absolute and relative), and prints the results. This helps in assessing the voltage regulation of the network. ```python for conn in topo.iter_all_connections(): du, du_rel = topo.get_conn_voltage_drop(conn.name) print(f"voltage drop @ {conn.name}: {du:~P.2f}, {du_rel:~P.2f}") ``` -------------------------------- ### Run and Display Short-Circuit Calculations Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Performs short-circuit calculations for the entire network and then iterates through the results to print detailed information for each bus. This includes maximum and minimum fault types and their corresponding current values. ```python from python_electric import ShortCircuitResult def print_sc_result(bus_id: str, sc: ShortCircuitResult): print( f"bus: {bus_id}", f"-------------", f"MAX [{sc.fault_type_max}]: {sc.max.to('kA'):~P.0f}", f"MIN [{sc.fault_type_min}]: {sc.min.to('kA'):~P.0f}", sep="\n", end="\n\n" ) sc_results = topo.run_shortcircuit_calc() for bus_id, sc in sc_results.items(): print_sc_result(bus_id, sc) ``` -------------------------------- ### Determine Motor Terminal Line Voltage During Start-Up Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Calculates the line voltage at the motor terminals during the start-up phase. This is achieved by accounting for the voltage drops across the main supply (dU_c1), cable W1 (dU_c2_start), and cable W2 (dU_c3_start) from the transformer's phase voltage. It requires the 'math' library. ```python U_ph_main = U_ph_transformer - dU_c1 U_ph_motor_start = U_ph_main - dU_c2_start - dU_c3_start U_l_motor_start = math.sqrt(3) * U_ph_motor_start print(f"Line voltage at motor terminals: {U_l_motor_start.to('V'):~P.2f}") ``` -------------------------------- ### Suggest and Connect Circuit Breakers Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Automates the selection of a circuit breaker based on component requirements and connects it to the network. The suggestion engine considers factors like adjustable settings and safety factors for short-circuit capacity. ```python cb_bb_sug = network.suggest_circuit_breaker( "busbar", prefer_adjustable=True ) cb_bb = network.connect_circuit_breaker( "busbar", standard=CircuitBreaker.Standard.INDUSTRIAL, category=cb_bb_sug.category, I_cu=cb_bb_sug.I_cu, k_m=cb_bb_sug.k_m ) ``` -------------------------------- ### Suggest and Connect Circuit Breaker for Cable C7 Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Recommends and connects a suitable circuit breaker for cable C7, considering safety factors and adjustability preferences. The parameters of the established circuit breaker are then outputted. ```python cb_C7_sug = topo.suggest_circuit_breaker("C7", safety_factor_Icu=1.1, prefer_adjustable=True) print(cb_C7_sug) cb_C7 = topo.connect_circuit_breaker( "C7", standard=cb_C7_sug.standard, category=cb_C7_sug.category, I_cu=cb_C7_sug.I_cu, k_m=cb_C7_sug.k_m ) print(cb_C7) ``` -------------------------------- ### Verify Earthing System Resistance Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Calculates and verifies the earthing resistance for a TN system. It requires the phase voltage and earthing resistance value to determine if the system passes safety criteria. ```python import math from python_electric import Q_ from python_electric.protection.earthing_system.TN import check_earthing_resistance r = check_earthing_resistance( U_phase=topo.U_n / math.sqrt(3), R_e=Q_(30, 'ohm'), final_circuit=True ) print(r) ``` -------------------------------- ### Calculate Motor Start-Up Currents Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Calculates the motor's current draw during start-up, which is 6 times its nominal current with a power factor of 0.45. It then determines the total current to sub-distribution board 'SUB1' during this start-up phase by combining the start-up motor current with the steady-state current of other consumers. This utilizes the 'python_electric.calc' module. ```python I_motor_start = 6 * abs(cI_motor) cos_phi_motor_start = 0.45 cI_motor_start = calc.phasor_from_cos(I_motor_start, cos_phi_motor_start) cI_sub1_start = cI_other + cI_motor_start I_sub1_start = abs(cI_sub1_start) cos_phi_sub1_start = calc.cosphi(cI_sub1_start) print(f"Motor start current: {I_motor_start:.2f} A, cos_phi = {cos_phi_motor_start:.2f}") print(f"Total current (A) to SUB1: {I_sub1_start:.2f} A, cos_phi = {cos_phi_sub1_start:.2f}") ``` -------------------------------- ### Add Transformer Component to Network Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Defines and adds a TransformerInput component to a specific connection ('T1') in the network. This specifies transformer parameters like apparent power, voltages, and winding connections. ```python T1_dat = TransformerInput( name="T1", S_n=Q_(1000, 'kVA'), U_lp=Q_(11, 'kV'), U_ls=network.U_n, u_cc=Q_(6, 'pct'), P_Cu=Q_(12.7, 'kW'), pri_conn=TransformerInput.WindingConn.D, sec_conn=TransformerInput.WindingConn.Y ) network.add_component("T1", T1_dat) ``` -------------------------------- ### Calculate Short-Circuit Currents Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Calculates maximum (three-phase bolted fault) and minimum (line-to-ground bolted fault) short-circuit currents at network buses. The results are then iterated and printed, showing the current in kA with two decimal places. ```python sc_results = network.run_shortcircuit_calc() for bus_id, sc_result in sc_results.items(): print( f"Bus {bus_id}: " f"MAX = {sc_result.max.to('kA'):~P.2f}, " f"MIN = {sc_result.min.to('kA'):~P.2f}." ) ``` -------------------------------- ### Create Network Topology and Add Connections Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Initializes a NetworkTopology object and adds various connections representing the LV network. Each connection can include loads, defining the electrical characteristics of different points in the network, such as main distribution boards and sub-distribution boards. ```python network = NetworkTopology(name="LV-network", U_n = Q_(400, 'V')) # IMPORTANT - SOURCE CONNECTION: DON'T FORGET TO ADD THIS FIRST! network.add_connection( "C0", end_id="MV_BUS", load=None ) network.add_connection( "C1", start_id="MV_BUS", end_id="MAIN", # main distribution board load=Load(cos_phi=0.9, P_e=Q_(325.76, 'kW')) ) network.add_connection( "C2", start_id="MAIN", end_id="SUB1", # sub-distribution board load=Load(cos_phi=0.7, P_e=Q_(108.83, 'kW')) ) network.add_connection( "C3", start_id="SUB1", end_id="MOTOR", load=Load(cos_phi=0.81, P_m=Q_(15, 'kW'), eta=Q_(84, 'pct')) ) ``` -------------------------------- ### Print Cable Sizing Details - Python Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Defines a function to print detailed sizing information for a given cable object. This includes load currents, nominal currents, actual ampacity, conductor size, and whether sizing is based on nominal current. ```python from python_electric import Cable def print_cable(cable: Cable): print( f"name: {cable.name}", f"------------------", f"load current (phase): {cable.I_b_ph.to('A'):~P.0f}", f"nominal current (phase): {cable.I_n_ph.to('A'):~P.0f}", f"actual ampacity (phase): {cable.I_z_ph.to('A'):~P.0f}", f"sizing based on In: {cable.sizing_based_on_I_n}", f"# conductors/phase: {cable.n_phase}", f"load current (conductor): {cable.I_b.to('A'):~P.0f}", f"nominal current (conductor): {cable.I_n.to('A'):~P.0f}", f"actual ampacity (conductor): {cable.I_z.to('A'):~P.0f}", f"stand. ampacity (conductor): {cable.I_z0.to('A'):~P.0f}", f"conductor csa: {cable.S.to('mm**2'):~P.0f}", sep="\n", end="\n\n" ) ``` -------------------------------- ### Plot Cable Characteristics Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Generates and displays a plot representing the characteristics of a specified cable ('cable_W2'). This plot is crucial for visually assessing the cable's performance against short-circuit currents and tripping times. ```python plt_w2 = network.cable_plot("cable_W2") plt_w2.show() ``` -------------------------------- ### Visualize Cable Protection Characteristics Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Generates a plot comparing the cable's thermal characteristics against the circuit breaker's protection parameters. This visualization helps verify that short-circuit currents are properly interrupted within safety limits. ```python plt_w1 = network.cable_plot("cable_W1") plt_w1.show() ``` -------------------------------- ### Define and Add First Cable Component to Network Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Defines and adds a CableInput component named 'cable_W1' to connection 'C2'. This specifies cable length, ambient temperature, number of adjacent circuits, and impedance factors, allowing the library to size the cable. ```python cable_W1_dat = CableInput( name="cable_W1", L=Q_(37, 'm'), k_simul=0.8, k_ext=1.2, T_amb=Q_(35, 'degC'), num_other_circuits=4, z0_r_factor=4.3, z0_x_factor=2.0, earthing_system=EarthingSystem.TN_C ) network.add_component("C2", cable_W1_dat) ``` -------------------------------- ### Size Conductors and Display Cable Properties Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Initiates the sizing process for all protective equipment conductors and then iterates through all cables to print their properties, including earthing system, phase conductor size, and protective conductor size. ```python topo.size_all_pe_conductors() for cable in topo.iter_all_cables(): print( f"cable {cable.name} [{cable.earthing_system}]: " f"S_ph = {cable.n_phase} x {cable.S:~P}, " f"S_pe = {cable.S_pe.to('mm**2'):~P.0f}" ) ``` -------------------------------- ### Retrieve and Print Cable Properties (cable_W1) Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Retrieves the 'cable_W1' component from the network and prints its calculated properties, such as conductor cross-sectional area, load current, nominal current, and ampacity under various conditions. This helps in verifying cable sizing. ```python cable_W1: Cable = network.get_component("cable_W1") print( f"Conductor cross-sectional area: {cable_W1.S.to('mm**2'):~P.0f}", f"Conductor load current: {cable_W1.I_b_ph.to('A'):~P.0f}", f"Conductor nominal current: {cable_W1.I_n.to('A'):~P.0f}", f"Conductor ampacity: {cable_W1.I_z.to('A'):~P.0f}", f"Conductor ampacity at standard conditions: {cable_W1.I_z0.to('A'):~P.0f}", sep="\n" ) ``` -------------------------------- ### Suggest and Connect Circuit Breaker for Cable C3 Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Suggests an appropriate circuit breaker for cable C3 with specific safety factors and preferences, then connects the suggested breaker. The details of the connected circuit breaker are subsequently printed. ```python cb_C3_sug = topo.suggest_circuit_breaker("C3", safety_factor_Icu=1.1, prefer_adjustable=True) print(cb_C3_sug) cb_C3 = topo.connect_circuit_breaker( "C3", standard=cb_C3_sug.standard, category=cb_C3_sug.category, I_cu=cb_C3_sug.I_cu, k_m=cb_C3_sug.k_m ) print(cb_C3) ``` -------------------------------- ### Suggest and Connect Circuit Breaker for Cable C1 Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Suggests an appropriate circuit breaker for cable C1 based on specified safety factors and preferences, then connects the suggested breaker to the cable. The details of the connected breaker are then printed. ```python cb_C1_sug = topo.suggest_circuit_breaker("C1", safety_factor_Icu=1.1, prefer_adjustable=True) print(cb_C1_sug) cb_C1 = topo.connect_circuit_breaker( "C1", standard=cb_C1_sug.standard, category=cb_C1_sug.category, I_cu=cb_C1_sug.I_cu, k_m=cb_C1_sug.k_m ) print(cb_C1) ``` -------------------------------- ### Add BusBar Component to Network Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Defines and adds a BusBarInput component to the network topology at connection 'C1'. This component specifies the physical and electrical characteristics of a busbar, including its dimensions, current carrying capacity, and impedance. ```python busbar_dat = BusBarInput( name="busbar", S=Q_(499, 'mm**2'), I_z=Q_(1142, 'A'), L=Q_(4, 'm'), z0_r_factor=3.0, z0_x_factor=4.0 ) network.add_component("C1", busbar_dat) ``` -------------------------------- ### Add Grid Input Component to Network Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Defines and adds a GridInput component to the network topology at a specific connection point ('C0'). This component represents the characteristics of the upstream power source, including voltage and short-circuit capacity. ```python grid_dat = GridInput( name="grid", U_l=Q_(11, 'kV'), S_sc=Q_(500, 'MVA'), z0_r_factor=0.0, z0_x_factor=0.0 ) network.add_component("C0", grid_dat) ``` -------------------------------- ### Retrieve and Print Cable Properties (cable_W2) Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Retrieves the 'cable_W2' component from the network and prints its calculated properties, including conductor cross-sectional area, load current, nominal current, and ampacity. This allows for verification of the cable's electrical characteristics. ```python cable_W2: Cable = network.get_component("cable_W2") print( f"Conductor cross-sectional area: {cable_W2.S.to('mm**2'):~P.0f}", f"Conductor load current: {cable_W2.I_b_ph.to('A'):~P.0f}", f"Conductor nominal current: {cable_W2.I_n.to('A'):~P.0f}", f"Conductor ampacity: {cable_W2.I_z.to('A'):~P.0f}", f"Conductor ampacity at standard conditions: {cable_W2.I_z0.to('A'):~P.0f}", sep="\n" ) ``` -------------------------------- ### Check Selectivity Between Circuit Breakers C1 and C3 Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Assesses the selectivity between the circuit breakers for cables C1 (upstream) and C3 (downstream). The output indicates the presence of selectivity, its completeness, and relevant tripping time parameters. ```python r = topo.check_selectivity(upcable_id="C1", downcable_id="C3") print(r) ``` -------------------------------- ### Plot Circuit Breaker Characteristics for Cable C3 Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Generates and displays a plot illustrating the characteristics of the circuit breaker associated with cable C3. This visualization aids in analyzing the breaker's operational parameters. ```python cb_C3_plot = topo.cable_plot("C3") cb_C3_plot.show() ``` -------------------------------- ### Check Selectivity Between Circuit Breakers C3 and C7 Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_03/LV_design_03.ipynb Evaluates the selectivity between the circuit breakers for cables C3 (upstream) and C7 (downstream). It reports whether selectivity exists, if it's total, and provides timing margins for tripping. ```python r = topo.check_selectivity(upcable_id="C3", downcable_id="C7") print(r) ``` -------------------------------- ### Add Transformer Component to Network Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Defines and adds a TransformerInput component to the network topology at connection 'C1'. This specifies the transformer's rating, winding connections, and impedance characteristics, crucial for LV network design. ```python transformer_dat = TransformerInput( name="transformer", S_n=Q_(630, 'kVA'), U_lp=grid_dat.U_l, U_ls=network.U_n, u_cc=Q_(4, 'pct'), P_Cu=Q_(4600, 'W'), pri_conn=TransformerInput.WindingConn.D, sec_conn=TransformerInput.WindingConn.YN, z0_r_factor=1.0, z0_x_factor=0.8 ) network.add_component("C1", transformer_dat) ``` -------------------------------- ### Calculate Connection Voltage Drop (Python) Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Calculates the steady-state line-to-ground voltage drop across a specified connection. It returns and prints the absolute and relative voltage drops. This method requires a 'network' object and the connection identifier. ```python dU_C1, dU_rel_C1 = network.get_conn_voltage_drop("C1") print( f"Absolute voltage drop: {dU_C1.to('V'):~P.2f}", f"Relative voltage drop: {dU_rel_C1.to('pct'):~P.2f}", sep="\n" ) ``` ```python dU_C6, dU_rel_C6 = network.get_conn_voltage_drop("C6") print( f"Absolute voltage drop: {dU_C6.to('V'):~P.2f}", f"Relative voltage drop: {dU_rel_C6.to('pct'):~P.2f}", sep="\n" ) ``` -------------------------------- ### Configure and Size Cables with python-electric Source: https://context7.com/tomlxxvi/python-electric/llms.txt Defines cables with specific properties like conductor material, insulation, and installation method. The library automatically sizes cables based on load current, environmental conditions, and other factors. It supports various units and provides access to detailed cable properties after sizing. ```python from python_electric import CableInput, EarthingSystem, Q_ from python_electric.sizing.cable import ( ConductorMaterial, InsulationMaterial, InstallMethod, CableMounting, CableArrangement ) cable_dat = CableInput( name="cable_W1", L=Q_(37, 'm'), # Cable length k_simul=0.8, # Simultaneity factor k_ext=1.2, # Expansion factor conductor_material=ConductorMaterial.COPPER, insulation_material=InsulationMaterial.XLPE, T_amb=Q_(35, 'degC'), # Ambient temperature install_method=InstallMethod.E, # Installation method cable_mounting=CableMounting.PERFORATED_TRAY, cable_arrangement=CableArrangement.MULTICORE, num_other_circuits=4, # Nearby circuits h3_fraction=0.0, # 3rd harmonic content earthing_system=EarthingSystem.TN_C, z0_r_factor=4.3, z0_x_factor=2.0 ) network.add_component("C2", cable_dat) # Access sized cable properties cable = network.get_component("cable_W1") print(f"Cross-sectional area: {cable.S.to('mm**2'):~P.0f}") print(f"Load current: {cable.I_b_ph.to('A'):~P.0f}") print(f"Nominal current: {cable.I_n.to('A'):~P.0f}") print(f"Ampacity: {cable.I_z.to('A'):~P.0f}") print(f"Joule integral: {cable.I2t.to('A**2*s'):~P.0e}") ``` -------------------------------- ### Define and Add Second Cable Component to Network Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Defines and adds a CableInput component named 'cable_W2' to connection 'C3'. This specifies the cable's length, number of adjacent circuits, impedance factors, and earthing system type (TN-S). ```python cable_W2_dat = CableInput( name="cable_W2", L=Q_(31, 'm'), num_other_circuits=4, z0_r_factor=3.0, z0_x_factor=4.0, earthing_system=EarthingSystem.TN_S ) network.add_component("C3", cable_W2_dat) ``` -------------------------------- ### Check Selectivity Between Circuit Breakers Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Evaluates the selectivity between two circuit breakers associated with upstream ('cable_W1') and downstream ('cable_W2') cables. It prints the selectivity results, indicating whether selectivity exists and providing details on tripping times and margins. ```python res = network.check_selectivity(upcable_id="cable_W1", downcable_id="cable_W2") print(res) ``` -------------------------------- ### Size All PE(N)-Conductors and Display Results Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Initiates the sizing process for all PE(N)-conductors in the network based on global configurations. It then iterates through all cables, printing their name, earthing system, main conductor cross-sectional area (S), and sized PE(N) conductor cross-sectional area (S_pe). ```python network.size_all_pe_conductors() for cable in network.iter_all_cables(): print(f"{cable.name} [{cable.earthing_system}]: {cable.S:~P.0f}, PE(N) = {cable.S_pe:~P.0f}") ``` -------------------------------- ### Calculate General Cable Voltage Drop (Python) Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Calculates the steady-state voltage drop across a cable using its 'get_voltage_drop' method. This method allows for specifying the voltage reference, including line-to-line. It requires the Cable object and parameters such as voltage, current, and power factor. ```python dU_cable_C1, dU_rel_cable_C1 = cable_C1.get_voltage_drop( U_l=cable_C1.U_l, I_b=cable_C1.I_b_ph, cos_phi=cable_C1.cos_phi, volt_ref=VoltReference.PH3_LINE_TO_LINE ) print( f"Absolute voltage drop: {dU_cable_C1.to('V'):~P.2f}", f"Relative voltage drop: {dU_rel_cable_C1.to('pct'):~P.2f}", sep="\n" ) ``` ```python dU_cable_C6, dU_rel_cable_C6 = cable_C6.get_voltage_drop( U_l=cable_C6.U_l, I_b=cable_C6.I_b_ph, cos_phi=cable_C6.cos_phi, volt_ref=VoltReference.PH3_LINE_TO_LINE ) print( f"Absolute voltage drop: {dU_cable_C6.to('V'):~P.2f}", f"Relative voltage drop: {dU_rel_cable_C6.to('pct'):~P.2f}", sep="\n" ) ``` -------------------------------- ### Calculate Bus Voltage Drop (Python) Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Calculates the steady-state line-to-ground voltage drop at a specified bus. It retrieves both the absolute and relative voltage drop values and prints them. This function relies on the 'network' object from the python-electric library. ```python dU_T6, dU_rel_T6 = network.get_bus_voltage_drop("T6_BUS") print( f"Absolute voltage drop: {dU_T6.to('V'):~P.2f}", f"Relative voltage drop: {dU_rel_T6.to('pct'):~P.2f}", sep="\n" ) ``` -------------------------------- ### Modify and Size Individual PE-Conductor Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Demonstrates how to individually modify PE-conductor sizing parameters by creating a new PEConductorConfig object and passing it to the `size_pe_conductor` method. It then prints the calculated PE(N) conductor size and the cable's assigned PE(N) conductor size. ```python S_pe_w1 = network.size_pe_conductor( "cable_W1", pe_conductor_cfg=PEConductorConfig( mech_protected=False, separated=True ) ) print(S_pe_w1.to('mm**2')) print(cable_W1.S_pe.to('mm**2')) ``` -------------------------------- ### Check Protection Against Indirect Contact Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Verifies the protection against indirect contact for all final circuits in the network. It iterates through the results, printing details for each final circuit, including whether it passed the checks, fault current, voltage, and allowable durations and lengths. ```python results = network.check_final_circuits() for k, r in results.items(): print(f"Final circuit '{k}'") print( "--------------" + "-" * (len(k) + 2)) print(r) ``` -------------------------------- ### Calculate General Transformer Voltage Drop (Python) Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Calculates the steady-state voltage drop across a transformer using its 'get_voltage_drop' method. This allows specifying the voltage reference, including line-to-line. It requires the Transformer object and relevant parameters like voltage, current, and power factor. ```python dU_T1, dU_rel_T1 = T1.get_voltage_drop( U_l=T1.U_ls, I_b=T1.I_b, cos_phi=T1.cos_phi, volt_ref=VoltReference.PH3_LINE_TO_LINE ) print( f"Absolute voltage drop: {dU_T1.to('V'):~P.2f}", f"Relative voltage drop: {dU_rel_T1.to('pct'):~P.2f}", sep="\n" ) ``` -------------------------------- ### Calculate Load Currents for Steady-State Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_01/LV_design_01.ipynb Determines the phasor representation of load currents for steady-state operation, specifically for components connected to sub-distribution board 'SUB1'. It calculates the current drawn by other consumers by subtracting the motor's nominal current from the total current to 'SUB1'. This requires the 'python_electric.calc' module and assumes 'network' object is available. ```python from python_electric import calc load_sub1 = network.get_load("C2") load_motor = network.get_load("C3") cI_sub1 = calc.phasor_from_cos( magnitude=load_sub1.I_b.to('A').m, cos_phi=load_sub1.cos_phi ) cI_motor = calc.phasor_from_cos( magnitude=load_motor.I_b.to('A').m, cos_phi=load_motor.cos_phi ) cI_other = cI_sub1 - cI_motor I_other = abs(cI_other) cos_phi_other = calc.cosphi(cI_other) print(f"Total current to SUB1: {load_sub1.I_b.to('A'):~P.2f}, cos_phi = {load_sub1.cos_phi:.2f}") print(f"Motor current: {load_motor.I_b.to('A'):~P.2f}, cos_phi = {load_motor.cos_phi:.2f}") print(f"Other current: {I_other:.2f} A, cos_phi = {cos_phi_other:.2f}") ``` -------------------------------- ### Calculate Total Line-to-Line Voltage Drop at Bus T6 (Python) Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/LV_design_02/LV_design_02.ipynb Calculates the total steady-state line-to-line voltage drop at bus T6 by summing the voltage drops from a transformer (T1) and two cables (C1 and C6). It prints both the absolute and relative total voltage drops. ```python dU_T6 = dU_T1 + dU_cable_C1 + dU_cable_C6 dU_rel_T6 = dU_rel_T1 + dU_rel_cable_C1 + dU_rel_cable_C6 print( f"Absolute voltage drop: {dU_T6.to('V'):~P.2f}", f"Relative voltage drop: {dU_rel_T6.to('pct'):~P.2f}", sep="\n" ) ``` -------------------------------- ### Initialize Electrical Load and Calculate Current Source: https://github.com/tomlxxvi/python-electric/blob/master/docs/examples/cable_sizing.ipynb Demonstrates how to import necessary components, define an electrical load with voltage and power parameters using the Q_ quantity wrapper, and calculate the resulting load current. ```python from python_electric import Q_ from python_electric.network import Load load = Load( U_l=Q_(400, 'V'), cos_phi=0.8, P_e=Q_(100, 'kW') ) print(f"load current: {load.I_b.to('A'):~P.0f}") ```