P11.5 + B2.1/B2.2: per-command units + description (where applicable)
Adds to scalar setters whose payloads are
plain numbers OR {value, unit}. Skipped where payload is compound or
mode-dependent (control-%, {F, C: [...]}, etc.) — documented inline.
Every command gains a description field for wikiGen consumption.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,17 +50,34 @@ function makeConfig() {
|
||||
};
|
||||
}
|
||||
|
||||
// machineGroups is a registry-backed getter (declareChildGetter) — inject
|
||||
// the fake MGC via the real child-registration handshake so the registry
|
||||
// stays the source of truth across configure() and tick().
|
||||
function registerMockGroup(ps, id, demands) {
|
||||
const mock = {
|
||||
config: {
|
||||
general: { id, name: id },
|
||||
functionality: { softwareType: 'machinegroup', positionVsParent: 'atEquipment' },
|
||||
asset: { category: 'controller' },
|
||||
},
|
||||
measurements: {
|
||||
emitter: { on: () => {} },
|
||||
setChildId: () => {}, setChildName: () => {}, setParentRef: () => {},
|
||||
},
|
||||
handleInput: async (_src, d) => { demands.push(d); },
|
||||
turnOffAllMachines: () => {},
|
||||
};
|
||||
ps.childRegistrationUtils.registerChild(mock, 'atEquipment');
|
||||
return mock;
|
||||
}
|
||||
|
||||
// Build a PS with a fake MGC that captures every demand sent to it,
|
||||
// and a clock we control so _updatePredictedVolume integrates over a
|
||||
// known dt regardless of wall-clock.
|
||||
function buildHarness() {
|
||||
const ps = new PumpingStation(makeConfig());
|
||||
const demands = [];
|
||||
ps.machineGroups['mgc1'] = {
|
||||
config: { general: { name: 'mgc1' } },
|
||||
turnOffAllMachines: () => {},
|
||||
handleInput: async (_src, d) => { demands.push(d); },
|
||||
};
|
||||
registerMockGroup(ps, 'mgc1', demands);
|
||||
// Seed level at startLevel so the run begins idle.
|
||||
ps.calibratePredictedLevel(2.0);
|
||||
// Override Date.now via a controllable clock that advances `step()`.
|
||||
|
||||
Reference in New Issue
Block a user