Calculator [patched] | Fault Loop
def cable_impedance(self, cable: CableData, use_temp_correction: bool = True) -> Tuple[float, float]: """ Calculate cable resistance and reactance Returns: Tuple of (resistance ohms, reactance ohms) """ resistivity = cable.RESISTIVITY[cable.material] # Temperature correction factor temp_factor = cable.TEMP_FACTOR_FAULT if use_temp_correction else 1.0 # Phase conductor resistance r_phase = resistivity * temp_factor * cable.length / cable.cross_section_phase # Earth conductor resistance r_earth = resistivity * temp_factor * cable.length / cable.cross_section_earth # Total loop resistance (phase + earth) r_total = r_phase + r_earth # Reactance (typical for LV cables: ~0.08 ohm/km for 50Hz) reactance_per_km = 0.08 # ohms/km x_total = reactance_per_km * cable.length / 1000 return r_total, x_total
# Quick lookup table print("\n📋 QUICK REFERENCE - MAX CABLE LENGTHS (Copper, 230V, 20A MCB Type C)") print("-" * 70) print(f"{'Cable Size (mm²)':<20} {'Max Length (m)':<15} {'Zs (Ω)':<10}") print("-" * 70) fault loop calculator
# Compare cold and hot cable conditions cable = CableData(length=50, cross_section_phase=4, cross_section_earth=4, material='copper') use_temp_correction: bool = True) ->
# Create calculator instance calc = FaultLoopCalculator(supply_voltage=230, frequency=50) 20} {'Max Length (m)':<
# Resistivity at 20°C (ohm-mm²/m) RESISTIVITY = { 'copper': 0.0175, 'aluminum': 0.0282 }
print(f"\nTotal loop impedance: {multi_result['total_impedance']} Ω") print(f"Prospective fault current: {multi_result['prospective_fault_current']} A")