Calculator High Quality — Fault Loop

print("=" * 60) print("ELECTRICAL FAULT LOOP CALCULATOR") print("=" * 60)

def verify_disconnection_time(self, fault_current: float, protection_type: str, protection_rating: float) -> dict: """ Verify disconnection time meets safety requirements Args: fault_current: Prospective fault current (A) protection_type: 'MCB', 'RCD', or 'fuse' protection_rating: Rated current of protection device (A) Returns: Verification result """ # Standard disconnection time requirements (IEC 60364) max_disconnection_time = { 'TN_230': 0.4, # seconds for 230V TN system 'TT_230': 0.2, # seconds for 230V TT system 'final_circuit': 0.4 } # Simple MCB tripping curve estimation (Type C) if protection_type == 'MCB': if fault_current >= 10 * protection_rating: # Instantaneous trip disconnection_time = 0.02 # 20ms elif fault_current >= 5 * protection_rating: disconnection_time = 0.1 else: disconnection_time = 5.0 # Thermal trip, may not clear quickly elif protection_type == 'RCD': disconnection_time = 0.04 # 40ms for RCD else: # fuse disconnection_time = 0.4 # Approximate meets_requirement = disconnection_time <= max_disconnection_time['TN_230'] return { 'disconnection_time': disconnection_time, 'max_allowed_time': max_disconnection_time['TN_230'], 'meets_requirement': meets_requirement, 'recommendation': 'Compliant' if meets_requirement else 'Non-compliant - Increase conductor size or reduce length' }

multi_result = calc.calculate_fault_loop_impedance(multi_cables, 8000) fault loop calculator

verification = calc.verify_disconnection_time( fault_current=result['prospective_fault_current'], protection_type='MCB', protection_rating=20 # 20A circuit breaker )

# Recommendation print("\n💡 RECOMMENDATION") print("-" * 40) protection_rating: float) -&gt

I'll produce a feature for electrical engineering applications. This calculates prospective fault current and earth fault loop impedance for electrical installations. Fault Loop Calculator import math from dataclasses import dataclass from typing import Optional, Tuple @dataclass class CableData: """Cable parameters for fault loop calculation""" length: float # meters cross_section_phase: float # mm² cross_section_earth: float # mm² material: str # 'copper' or 'aluminum'

print(f"Cold resistance: {r_cold:.4f} Ω") print(f"Hot resistance (fault condition): {r_hot:.4f} Ω") print(f"Resistance increase: {(r_hot/r_cold - 1) * 100:.1f}%") x_cold = calc.cable_impedance(cable

# Cold condition (no temp correction) r_cold, x_cold = calc.cable_impedance(cable, use_temp_correction=False) # Hot condition (fault temperature) r_hot, x_hot = calc.cable_impedance(cable, use_temp_correction=True)