Compare commits
6 Commits
d91609b3a4
...
dev-Rene
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7efd3b0a07 | ||
|
|
c81ee1b470 | ||
|
|
955c17a466 | ||
|
|
052ded7b6e | ||
|
|
321ea33bf7 | ||
|
|
288bd244dd |
@@ -53,7 +53,16 @@
|
|||||||
hasDistance: { value: false },
|
hasDistance: { value: false },
|
||||||
distance: { value: 0 },
|
distance: { value: 0 },
|
||||||
distanceUnit: { value: "m" },
|
distanceUnit: { value: "m" },
|
||||||
distanceDescription: { value: "" }
|
distanceDescription: { value: "" },
|
||||||
|
|
||||||
|
// control strategy
|
||||||
|
controlMode: { value: "none" },
|
||||||
|
startLevel: { value: null },
|
||||||
|
stopLevel: { value: null },
|
||||||
|
minFlowLevel: { value: null },
|
||||||
|
maxFlowLevel: { value: null },
|
||||||
|
flowSetpoint: { value: null },
|
||||||
|
flowDeadband: { value: null }
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -129,6 +138,32 @@
|
|||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// control mode toggle UI
|
||||||
|
const toggleModeSections = (val) => {
|
||||||
|
document.querySelectorAll('.ps-mode-section').forEach((el) => el.style.display = 'none');
|
||||||
|
const active = document.getElementById(`ps-mode-${val}`);
|
||||||
|
if (active) active.style.display = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const modeSelect = document.getElementById('node-input-controlMode');
|
||||||
|
if (modeSelect) {
|
||||||
|
modeSelect.value = this.controlMode || 'none';
|
||||||
|
toggleModeSections(modeSelect.value);
|
||||||
|
modeSelect.addEventListener('change', (e) => toggleModeSections(e.target.value));
|
||||||
|
}
|
||||||
|
|
||||||
|
const setNumberField = (id, val) => {
|
||||||
|
const el = document.getElementById(id);
|
||||||
|
if (el) el.value = Number.isFinite(val) ? val : '';
|
||||||
|
};
|
||||||
|
|
||||||
|
setNumberField('node-input-startLevel', this.startLevel);
|
||||||
|
setNumberField('node-input-stopLevel', this.stopLevel);
|
||||||
|
setNumberField('node-input-minFlowLevel', this.minFlowLevel);
|
||||||
|
setNumberField('node-input-maxFlowLevel', this.maxFlowLevel);
|
||||||
|
setNumberField('node-input-flowSetpoint', this.flowSetpoint);
|
||||||
|
setNumberField('node-input-flowDeadband', this.flowDeadband);
|
||||||
|
|
||||||
//------------------- END OF CUSTOM config UI ELEMENTS ------------------- //
|
//------------------- END OF CUSTOM config UI ELEMENTS ------------------- //
|
||||||
},
|
},
|
||||||
oneditsave: function () {
|
oneditsave: function () {
|
||||||
@@ -151,6 +186,18 @@
|
|||||||
node.refHeight = document.getElementById("node-input-refHeight").value || "";
|
node.refHeight = document.getElementById("node-input-refHeight").value || "";
|
||||||
node.enableDryRunProtection = document.getElementById("node-input-enableDryRunProtection").checked;
|
node.enableDryRunProtection = document.getElementById("node-input-enableDryRunProtection").checked;
|
||||||
node.enableOverfillProtection = document.getElementById("node-input-enableOverfillProtection").checked;
|
node.enableOverfillProtection = document.getElementById("node-input-enableOverfillProtection").checked;
|
||||||
|
|
||||||
|
// control strategy
|
||||||
|
node.controlMode = document.getElementById('node-input-controlMode').value || 'none';
|
||||||
|
|
||||||
|
const parseNum = (id) => parseFloat(document.getElementById(id)?.value);
|
||||||
|
node.startLevel = parseNum('node-input-startLevel');
|
||||||
|
node.stopLevel = parseNum('node-input-stopLevel');
|
||||||
|
node.minFlowLevel = parseNum('node-input-minFlowLevel');
|
||||||
|
node.maxFlowLevel = parseNum('node-input-maxFlowLevel');
|
||||||
|
node.flowSetpoint = parseNum('node-input-flowSetpoint');
|
||||||
|
node.flowDeadband = parseNum('node-input-flowDeadband');
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -160,7 +207,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="pumpingStation">
|
<script type="text/html" data-template-name="pumpingStation">
|
||||||
|
|
||||||
<!-- Simulator toggle -->
|
<h4>Simulation</h4>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-simulator"><i class="fa fa-play-circle"></i> Simulator</label>
|
<label for="node-input-simulator"><i class="fa fa-play-circle"></i> Simulator</label>
|
||||||
<input type="checkbox" id="node-input-simulator" style="width:20px;vertical-align:baseline;" />
|
<input type="checkbox" id="node-input-simulator" style="width:20px;vertical-align:baseline;" />
|
||||||
@@ -169,7 +216,7 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<!-- Basin geometry -->
|
<h4>Basin Geometry</h4>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-basinVolume"><i class="fa fa-cube"></i> Basin Volume (m³)</label>
|
<label for="node-input-basinVolume"><i class="fa fa-cube"></i> Basin Volume (m³)</label>
|
||||||
<input type="number" id="node-input-basinVolume" min="0" step="0.1" />
|
<input type="number" id="node-input-basinVolume" min="0" step="0.1" />
|
||||||
@@ -195,6 +242,50 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
<h4>Control Strategy</h4>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-controlMode"><i class="fa fa-sliders"></i> Control mode</label>
|
||||||
|
<select id="node-input-controlMode">
|
||||||
|
<option value="none">None / Manual</option>
|
||||||
|
<option value="levelbased">Level-based</option>
|
||||||
|
<option value="flowbased">Flow-based</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="ps-mode-levelbased" class="ps-mode-section">
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-startLevel">startLevel</label>
|
||||||
|
<input type="number" id="node-input-startLevel" placeholder="m" />
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-stopLevel">stopLevel</label>
|
||||||
|
<input type="number" id="node-input-stopLevel" placeholder="m" />
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-minFlowLevel">Min flow (m)</label>
|
||||||
|
<input type="number" id="node-input-minFlowLevel" placeholder="m" />
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-maxFlowLevel">Max flow (m)</label>
|
||||||
|
<input type="number" id="node-input-maxFlowLevel" placeholder="m" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="ps-mode-flowbased" class="ps-mode-section" style="display:none">
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-flowSetpoint">Flow setpoint</label>
|
||||||
|
<input type="number" id="node-input-flowSetpoint" placeholder="m3/h" />
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-flowDeadband">Deadband</label>
|
||||||
|
<input type="number" id="node-input-flowDeadband" placeholder="m3/h" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<h4>Reference</h4>
|
||||||
|
|
||||||
<!-- Reference data -->
|
<!-- Reference data -->
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-minHeightBasedOn"><i class="fa fa-arrows-v"></i> Minimum Height Based On</label>
|
<label for="node-input-minHeightBasedOn"><i class="fa fa-arrows-v"></i> Minimum Height Based On</label>
|
||||||
@@ -217,6 +308,8 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
<h4>Safety</h4>
|
||||||
|
|
||||||
<!-- Safety settings -->
|
<!-- Safety settings -->
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-timeleftToFullOrEmptyThresholdSeconds"><i class="fa fa-clock-o"></i> Time To Empty/Full (s)</label>
|
<label for="node-input-timeleftToFullOrEmptyThresholdSeconds"><i class="fa fa-clock-o"></i> Time To Empty/Full (s)</label>
|
||||||
@@ -246,7 +339,7 @@
|
|||||||
<label for="node-input-overfillThresholdPercent" style="padding-left:20px;">High Volume Threshold (%)</label>
|
<label for="node-input-overfillThresholdPercent" style="padding-left:20px;">High Volume Threshold (%)</label>
|
||||||
<input type="number" id="node-input-overfillThresholdPercent" min="0" max="100" step="0.1" />
|
<input type="number" id="node-input-overfillThresholdPercent" min="0" max="100" step="0.1" />
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
<!-- Shared asset/logger/position menus -->
|
<!-- Shared asset/logger/position menus -->
|
||||||
<div id="asset-fields-placeholder"></div>
|
<div id="asset-fields-placeholder"></div>
|
||||||
<div id="logger-fields-placeholder"></div>
|
<div id="logger-fields-placeholder"></div>
|
||||||
|
|||||||
@@ -66,6 +66,15 @@ class nodeClass {
|
|||||||
minHeightBasedOn: uiConfig.minHeightBasedOn,
|
minHeightBasedOn: uiConfig.minHeightBasedOn,
|
||||||
basinBottomRef: uiConfig.basinBottomRef,
|
basinBottomRef: uiConfig.basinBottomRef,
|
||||||
},
|
},
|
||||||
|
control:{
|
||||||
|
mode: uiConfig.controlMode,
|
||||||
|
levelbased:{
|
||||||
|
startLevel:uiConfig.startLevel,
|
||||||
|
stopLevel:uiConfig.stopLevel,
|
||||||
|
minFlowLevel:uiConfig.minFlowLevel,
|
||||||
|
maxFlowLevel:uiConfig.maxFlowLevel
|
||||||
|
}
|
||||||
|
},
|
||||||
safety:{
|
safety:{
|
||||||
enableDryRunProtection: uiConfig.enableDryRunProtection,
|
enableDryRunProtection: uiConfig.enableDryRunProtection,
|
||||||
dryRunThresholdPercent: uiConfig.dryRunThresholdPercent,
|
dryRunThresholdPercent: uiConfig.dryRunThresholdPercent,
|
||||||
@@ -209,13 +218,23 @@ class nodeClass {
|
|||||||
this.source.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
|
this.source.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
|
||||||
break;
|
break;
|
||||||
case 'calibratePredictedVolume':
|
case 'calibratePredictedVolume':
|
||||||
const calibratedVolume = this.source.measurements
|
const injectedVol = parseFloat(msg.payload);
|
||||||
.type('volume')
|
this.source.calibratePredictedVolume(injectedVol);
|
||||||
.variant('measured')
|
|
||||||
.position('atequipment')
|
|
||||||
.getCurrentValue('m3');
|
|
||||||
this.source.calibratePredictedVolume(calibratedVolume);
|
|
||||||
break;
|
break;
|
||||||
|
case 'calibratePredictedLevel':
|
||||||
|
const injectedLevel = parseFloat(msg.payload);
|
||||||
|
this.source.calibratePredictedLevel(injectedLevel);
|
||||||
|
break;
|
||||||
|
case 'q_in': {
|
||||||
|
// payload can be number or { value, unit, timestamp }
|
||||||
|
const val = Number(msg.payload);
|
||||||
|
const unit = msg?.unit;
|
||||||
|
const ts = msg?.timestamp || Date.now();
|
||||||
|
this.source.setManualInflow(val, ts, unit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
1282
src/specificClass.js
1282
src/specificClass.js
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user