ElectricalValidationService class
Domain service for electrical validation according to REBT/IEC standards. Encapsulates business rules for voltage drops, impedance limits, and protection coordination.
Architecture Pattern: Factory Constructor Singleton
- Simple instantiation:
final service = ElectricalValidationService(); - Testable: Instance methods can be mocked in tests
- No DI container required (postponed to future refactoring)
Testing:
class MockValidationService extends ElectricalValidationService {
@override
String? validateVoltageDrop(...) => null; // Mock response
}
Regulatory Context: REBT (Spain)
- Target market: Spain only
- Standards: ITC-BT-19, ITC-BT-24
- Future: If expanding internationally, refactor to injectable NormativeConfig
Constructors
- ElectricalValidationService()
-
Factory constructor returns singleton instance
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getMaxVoltage(
{double nominalVoltage = _nominalVoltage}) → double - Gets maximum acceptable voltage.
-
getMinVoltage(
{required LoadType loadType, double nominalVoltage = _nominalVoltage}) → double - Gets minimum acceptable voltage for a load type.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validateContactVoltage(
double voltage) → String? - Validates contact voltage (touch voltage). Returns error message if invalid, null if valid.
-
validateLoopImpedance(
double impedance) → String? - Validates loop impedance (Zs). Returns error message if invalid, null if valid.
-
validateRcdTripCurrent(
{required double tripCurrent, required double sensitivity}) → String? - Validates RCD trip current against sensitivity. Returns error message if invalid, null if valid.
-
validateRcdTripTime(
double tripTime) → String? - Validates RCD trip time. Returns error message if invalid, null if valid.
-
validateVoltageDrop(
{required double measuredVoltage, required LoadType loadType, double nominalVoltage = _nominalVoltage}) → String? - Validates voltage drop for a given load type. Returns error message if invalid, null if valid.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited