estimateCurrentCapacity static method

double estimateCurrentCapacity(
  1. double sectionMm2
)

Estimate cable current capacity from section Returns closest match from standard table

Implementation

static double estimateCurrentCapacity(double sectionMm2) {
  // Find closest standard section
  double closestSection = cableCurrentCapacity.keys.first;
  double minDiff = (sectionMm2 - closestSection).abs();

  for (final section in cableCurrentCapacity.keys) {
    final diff = (sectionMm2 - section).abs();
    if (diff < minDiff) {
      minDiff = diff;
      closestSection = section;
    }
  }

  return cableCurrentCapacity[closestSection] ?? 20.0;
}