added pumpingStation config, expanded functionality for difference in measurement container
This commit is contained in:
@@ -206,21 +206,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"basin": {
|
"basin": {
|
||||||
"shape": {
|
"volume": {
|
||||||
"default": "cylindrical",
|
"default": "1",
|
||||||
"rules": {
|
"rules": {
|
||||||
"type": "enum",
|
"type": "number",
|
||||||
"values": [
|
"description": "Total volume of empty basin in m3"
|
||||||
{
|
}
|
||||||
"value": "cylindrical",
|
},
|
||||||
"description": "The wet well is primarily cylindrical."
|
"height": {
|
||||||
},
|
"default": "1",
|
||||||
{
|
"rules": {
|
||||||
"value": "rectangular",
|
"type": "number",
|
||||||
"description": "The wet well is rectangular or box shaped."
|
"description": "Total height of basin in m"
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "General geometry of the basin or wet well."
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"levelUnit": {
|
"levelUnit": {
|
||||||
@@ -272,7 +269,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"hydraulics": {
|
"hydraulics": {
|
||||||
|
|
||||||
"maxInflowRate": {
|
"maxInflowRate": {
|
||||||
"default": 200,
|
"default": 200,
|
||||||
"rules": {
|
"rules": {
|
||||||
@@ -281,6 +277,28 @@
|
|||||||
"description": "Maximum expected inflow during peak events (m3/h)."
|
"description": "Maximum expected inflow during peak events (m3/h)."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"refHeight": {
|
||||||
|
"default": "NAP",
|
||||||
|
"rules": {
|
||||||
|
"type": "enum",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"value": "NAP",
|
||||||
|
"description": "NAP (Normaal Amsterdams Peil)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "EVRF",
|
||||||
|
"description": "EVRF (European Vertical Reference Frame)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "EGM2008",
|
||||||
|
"description": "EGM2008 / EGM96 (satellietmetingen) Geopotentieel model earth "
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
"description": "Reference height to use to identify the height vs other basins with. This will say something more about the expected pressure loss in m head"
|
||||||
|
}
|
||||||
|
},
|
||||||
"staticHead": {
|
"staticHead": {
|
||||||
"default": 12,
|
"default": 12,
|
||||||
"rules": {
|
"rules": {
|
||||||
|
|||||||
@@ -248,37 +248,42 @@ class MeasurementContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
differenceUpDown(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Difference calculations between positions
|
// Difference calculations between positions
|
||||||
difference(requestedUnit = null) {
|
difference({ from = "downstream", to = "upstream", unit: requestedUnit } = {}) {
|
||||||
|
if (!this._currentType || !this._currentVariant) {
|
||||||
if (!this._currentType || !this._currentVariant) {
|
throw new Error("Type and variant must be specified for difference calculation");
|
||||||
throw new Error('Type and variant must be specified for difference calculation');
|
|
||||||
}
|
|
||||||
const upstream = this.measurements?.[this._currentType]?.[this._currentVariant]?.['upstream'] || null;
|
|
||||||
const downstream = this.measurements?.[this._currentType]?.[this._currentVariant]?.['downstream'] || null;
|
|
||||||
|
|
||||||
if (!upstream || !downstream || upstream.values.length === 0 || downstream.values.length === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get target unit for conversion
|
|
||||||
const targetUnit = requestedUnit || upstream.unit || downstream.unit;
|
|
||||||
|
|
||||||
// Get values in the same unit
|
|
||||||
const upstreamValue = this._convertValueToUnit(upstream.getCurrentValue(), upstream.unit, targetUnit);
|
|
||||||
const downstreamValue = this._convertValueToUnit(downstream.getCurrentValue(), downstream.unit, targetUnit);
|
|
||||||
|
|
||||||
const upstreamAvg = this._convertValueToUnit(upstream.getAverage(), upstream.unit, targetUnit);
|
|
||||||
const downstreamAvg = this._convertValueToUnit(downstream.getAverage(), downstream.unit, targetUnit);
|
|
||||||
|
|
||||||
return {
|
|
||||||
value: downstreamValue - upstreamValue,
|
|
||||||
avgDiff: downstreamAvg - upstreamAvg,
|
|
||||||
unit: targetUnit
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const get = pos =>
|
||||||
|
this.measurements?.[this._currentType]?.[this._currentVariant]?.[pos] || null;
|
||||||
|
|
||||||
|
const a = get(from);
|
||||||
|
const b = get(to);
|
||||||
|
if (!a || !b || a.values.length === 0 || b.values.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const targetUnit = requestedUnit || a.unit || b.unit;
|
||||||
|
const aVal = this._convertValueToUnit(a.getCurrentValue(), a.unit, targetUnit);
|
||||||
|
const bVal = this._convertValueToUnit(b.getCurrentValue(), b.unit, targetUnit);
|
||||||
|
|
||||||
|
const aAvg = this._convertValueToUnit(a.getAverage(), a.unit, targetUnit);
|
||||||
|
const bAvg = this._convertValueToUnit(b.getAverage(), b.unit, targetUnit);
|
||||||
|
|
||||||
|
return {
|
||||||
|
value: aVal - bVal,
|
||||||
|
avgDiff: aAvg - bAvg,
|
||||||
|
unit: targetUnit,
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Helper methods
|
// Helper methods
|
||||||
_ensureChainIsValid() {
|
_ensureChainIsValid() {
|
||||||
if (!this._currentType || !this._currentVariant || !this._currentPosition) {
|
if (!this._currentType || !this._currentVariant || !this._currentPosition) {
|
||||||
|
|||||||
@@ -213,6 +213,10 @@ const pressureDiff = basicContainer
|
|||||||
|
|
||||||
console.log(`Pressure difference: ${pressureDiff.value} ${pressureDiff.unit}\n`);
|
console.log(`Pressure difference: ${pressureDiff.value} ${pressureDiff.unit}\n`);
|
||||||
|
|
||||||
|
//reversable difference
|
||||||
|
const deltaP = measurements.type("pressure").variant("measured").difference(); // defaults to downstream - upstream
|
||||||
|
const netFlow = measurements.type("flow").variant("measured").difference({ from: "upstream", to: "downstream" });
|
||||||
|
|
||||||
// ====================================
|
// ====================================
|
||||||
// ADVANCED STATISTICS & HISTORY
|
// ADVANCED STATISTICS & HISTORY
|
||||||
// ====================================
|
// ====================================
|
||||||
|
|||||||
Reference in New Issue
Block a user