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
# Define cable segments cables = [ CableData( length=25, # meters cross_section_phase=2.5, # mm² cross_section_earth=2.5, # mm² material='copper' ) ] fault loop calculator
multi_cables = [ CableData(length=30, cross_section_phase=16, cross_section_earth=16, material='copper'), CableData(length=20, cross_section_phase=6, cross_section_earth=6, material='copper'), CableData(length=15, cross_section_phase=2.5, cross_section_earth=2.5, material='copper') ] use_temp_correction: bool = True) ->
# Temperature correction factors TEMP_FACTOR_OPERATING = 1.25 # for cables at operating temperature TEMP_FACTOR_FAULT = 1.50 # for fault condition class FaultLoopCalculator: """Calculates earth fault loop impedance and prospective fault current""" # meters cross_section_phase=2.5
print("=" * 60) print("ELECTRICAL FAULT LOOP CALCULATOR") print("=" * 60)
# Verify protection print("\n🔒 PROTECTION VERIFICATION") print("-" * 40)
# Compare cold and hot cable conditions cable = CableData(length=50, cross_section_phase=4, cross_section_earth=4, material='copper')