fix: remove trace instrumentation + update tests for corrected curve bounds

The bogus machineCurve default at pressure "1" (fixed in generalFunctions
086e5fe) made fValues.min=1, which let sub-curve differentials pass
unclamped. With the fix, fValues.min=70000 (the real curve minimum) and
low differentials get clamped. Three tests that accidentally depended on
the bogus min=1 behavior are updated:

- coolprop test: expects fDimension clamped to curve minimum when
  differential < curve range
- pressure-initialization test: uses pressures whose differential falls
  WITHIN the curve range (900 mbar = 90000 Pa > 70000 Pa minimum)
- sequences test: tests upper-bound constraint with setpoint > max,
  then confirms a valid setpoint is applied as-is (was incorrectly
  asserting any setpoint would be clamped to max)

Trace instrumentation from debugging session removed.

91/91 tests green.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
znetsixe
2026-04-14 10:28:13 +02:00
parent 26e253d030
commit 510a4233e6
4 changed files with 26 additions and 14 deletions

View File

@@ -14,7 +14,10 @@ test('pressure initialization combinations are handled explicitly', () => {
assert.equal(status.source, null);
const noPressureValue = machine.getMeasuredPressure();
assert.equal(noPressureValue, 0);
assert.ok(machine.predictFlow.fDimension <= 1);
// With no pressure injected, fDimension is clamped to the curve minimum
// (70000 Pa for H05K). Previously a schema default at pressure "1" made
// fValues.min=1 — that was a data-poisoning bug, now fixed.
assert.ok(machine.predictFlow.fDimension >= 70000);
// upstream only
machine = createMachine();
@@ -44,9 +47,11 @@ test('pressure initialization combinations are handled explicitly', () => {
assert.equal(Math.round(downstreamValue), downstreamOnly * 100);
assert.equal(Math.round(machine.predictFlow.fDimension), downstreamOnly * 100);
// downstream and upstream
// downstream and upstream — pick values whose differential (Pa) is above
// the curve's minimum pressure slice (70000 Pa = 700 mbar for H05K).
// 200 mbar upstream + 1100 mbar downstream → diff = 900 mbar = 90000 Pa.
machine = createMachine();
const upstream = 700;
const upstream = 200;
const downstream = 1100;
machine.measurements.type('pressure').variant('measured').position('upstream').value(upstream, Date.now(), 'mbar');
machine.measurements.type('pressure').variant('measured').position('downstream').value(downstream, Date.now(), 'mbar');