refactor(units): route all conversions through UnitPolicy.convert
Delete the legacy _convertUnitValue helper on the domain and the duplicate convertUnitValue export on curveNormalizer; both were identical to UnitPolicy.convert. Callers in flowController, the curve normalizer, and buildQHCurve now go through this.unitPolicy. The contract in .claude/refactor/CONTRACTS.md §6 named these as the target migration; this finishes the rollout for rotatingMachine. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -247,12 +247,6 @@ class Machine extends BaseDomain {
|
||||
if (!this.isUnitValidForType(type, u)) throw new Error(`Unsupported unit '${u}' for ${type} measurement.`);
|
||||
return u;
|
||||
}
|
||||
_convertUnitValue(value, from, to, ctx = 'unit conversion') {
|
||||
const n = Number(value);
|
||||
if (!Number.isFinite(n)) throw new Error(`${ctx}: value '${value}' is not finite`);
|
||||
if (!from || !to || from === to) return n;
|
||||
return convert(n).from(from).to(to);
|
||||
}
|
||||
_measurementPositionForMetric(metricId) { return metricId === 'power' ? 'atEquipment' : 'downstream'; }
|
||||
_resolveProcessRangeForMetric(metricId, predicted, measured) {
|
||||
let processMin = NaN; let processMax = NaN;
|
||||
|
||||
Reference in New Issue
Block a user