analyzeNode static method

List<ForensicFinding> analyzeNode(
  1. ElectricalNode node
)

Implementation

static List<ForensicFinding> analyzeNode(ElectricalNode node) {
  // Si no hay medidas, no hay análisis forense posible (solo validación teórica, que ya se hace en ValidationEngine)
  final measurement = node.map(
    source: (n) => n.lastMeasurement,
    panel: (n) => n.lastMeasurement,
    protection: (n) => n.lastMeasurement,
    load: (n) => n.lastMeasurement,
  );

  if (measurement == null) return [];

  final findings = <ForensicFinding>[];

  // Obtener valores teóricos del cálculo
  // Usamos el state también ya que contiene voltajes calculados
  final theoreticalVoltage = node.state.voltageVolts; // Volts
  final theoreticalCurrent = node.state.currentAmps; // Amps

  // 1. REGLA: LOOSE CONNECTION (Conexión Floja)
  _analyzeLooseConnection(measurement, theoreticalVoltage, findings);

  // 2. REGLA: PHANTOM LOAD (Carga Fantasma / Fuga)
  _analyzePhantomLoad(measurement, theoreticalCurrent, findings);

  // 3. REGLA: THERMAL STRESS (Estrés Térmico)
  _analyzeThermalStress(measurement, findings);

  // 4. REGLA: MAGNETIC FAILURE (Solo Protecciones)
  if (node is ProtectionNode) {
    _analyzeMagneticFailure(node, measurement, findings);
  }

  return findings;
}