|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
|
const EventEmitter = require('events');
|
|
|
|
|
const {loadCurve,gravity,logger,configUtils,configManager,state, nrmse, MeasurementContainer, predict, interpolation , childRegistrationUtils,coolprop} = require('generalFunctions');
|
|
|
|
|
const {loadCurve,gravity,logger,configUtils,configManager,state, nrmse, MeasurementContainer, predict, interpolation , childRegistrationUtils,coolprop, POSITIONS} = require('generalFunctions');
|
|
|
|
|
|
|
|
|
|
class Machine {
|
|
|
|
|
|
|
|
|
|
@@ -85,6 +85,10 @@ class Machine {
|
|
|
|
|
//perform init for certain values
|
|
|
|
|
this._init();
|
|
|
|
|
|
|
|
|
|
// used for holding the source and sink unit operations or other object with setInfluent / getEffluent method for e.g. recirculation.
|
|
|
|
|
this.upstreamSource = null;
|
|
|
|
|
this.downstreamSink = null;
|
|
|
|
|
|
|
|
|
|
this.child = {}; // object to hold child information so we know on what to subscribe
|
|
|
|
|
this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility
|
|
|
|
|
|
|
|
|
|
@@ -93,43 +97,58 @@ class Machine {
|
|
|
|
|
|
|
|
|
|
_init(){
|
|
|
|
|
//assume standard temperature is 20degrees
|
|
|
|
|
this.measurements.type('temperature').variant('measured').position('atEquipment').value(15).unit('C');
|
|
|
|
|
this.measurements.type('temperature').variant('measured').position(POSITIONS.AT_EQUIPMENT).value(15).unit('C');
|
|
|
|
|
//assume standard atm pressure is at sea level
|
|
|
|
|
this.measurements.type('atmPressure').variant('measured').position('atEquipment').value(101325).unit('Pa');
|
|
|
|
|
this.measurements.type('atmPressure').variant('measured').position(POSITIONS.AT_EQUIPMENT).value(101325).unit('Pa');
|
|
|
|
|
//populate min and max
|
|
|
|
|
if (this.predictFlow) {
|
|
|
|
|
const flowunit = this.config.general.unit;
|
|
|
|
|
this.measurements.type('flow').variant('predicted').position('max').value(this.predictFlow.currentFxyYMax, Date.now() , flowunit)
|
|
|
|
|
this.measurements.type('flow').variant('predicted').position('max').value(this.predictFlow.currentFxyYMax, Date.now() , flowunit);
|
|
|
|
|
this.measurements.type('flow').variant('predicted').position('min').value(this.predictFlow.currentFxyYMin).unit(this.config.general.unit);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_updateState(){
|
|
|
|
|
const isOperational = this._isOperationalState();
|
|
|
|
|
if(!isOperational){
|
|
|
|
|
//overrule the last prediction this should be 0 now
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("downstream").value(0,Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("atEquipment").value(0,Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.DOWNSTREAM).value(0,Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(0,Date.now(),this.config.general.unit);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*------------------- Register child events -------------------*/
|
|
|
|
|
registerChild(child, softwareType) {
|
|
|
|
|
this.logger.debug('Setting up child event for softwaretype ' + softwareType);
|
|
|
|
|
if(!child) {
|
|
|
|
|
this.logger.error(`Invalid ${softwareType} child provided.`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(softwareType === "measurement"){
|
|
|
|
|
const position = child.config.functionality.positionVsParent;
|
|
|
|
|
const distance = child.config.functionality.distanceVsParent || 0;
|
|
|
|
|
const measurementType = child.config.asset.type;
|
|
|
|
|
const key = `${measurementType}_${position}`;
|
|
|
|
|
switch (softwareType) {
|
|
|
|
|
case "measurement":
|
|
|
|
|
this.logger.debug(`Registering measurement child...`);
|
|
|
|
|
this._connectMeasurement(child);
|
|
|
|
|
break;
|
|
|
|
|
case "reactor":
|
|
|
|
|
this.logger.debug(`Registering reactor child...`);
|
|
|
|
|
this._connectReactor(child);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
this.logger.error(`Unrecognized softwareType: ${softwareType}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_connectMeasurement(measurementChild) {
|
|
|
|
|
const position = measurementChild.config.functionality.positionVsParent;
|
|
|
|
|
const measurementType = measurementChild.config.asset.type;
|
|
|
|
|
//rebuild to measurementype.variant no position and then switch based on values not strings or names.
|
|
|
|
|
const eventName = `${measurementType}.measured.${position}`;
|
|
|
|
|
|
|
|
|
|
this.logger.debug(`Setting up listener for ${eventName} from child ${child.config.general.name}`);
|
|
|
|
|
this.logger.debug(`Setting up listener for ${eventName} from child ${measurementChild.config.general.name}`);
|
|
|
|
|
// Register event listener for measurement updates
|
|
|
|
|
child.measurements.emitter.on(eventName, (eventData) => {
|
|
|
|
|
measurementChild.measurements.emitter.on(eventName, (eventData) => {
|
|
|
|
|
this.logger.debug(`🔄 ${position} ${measurementType} from ${eventData.childName}: ${eventData.value} ${eventData.unit}`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.logger.debug(` Emitting... ${eventName} with data:`);
|
|
|
|
|
// Store directly in parent's measurement container
|
|
|
|
|
this.measurements
|
|
|
|
|
.type(measurementType)
|
|
|
|
|
@@ -141,7 +160,6 @@ class Machine {
|
|
|
|
|
this._callMeasurementHandler(measurementType, eventData.value, position, eventData);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Centralized handler dispatcher
|
|
|
|
|
_callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
@@ -166,13 +184,17 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_connectReactor(reactorChild) {
|
|
|
|
|
this.downstreamSink = reactorChild; // downstream from the pumps perpective
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------- END child stuff -------------//
|
|
|
|
|
|
|
|
|
|
// Method to assess drift using errorMetrics
|
|
|
|
|
assessDrift(measurement, processMin, processMax) {
|
|
|
|
|
this.logger.debug(`Assessing drift for measurement: ${measurement} processMin: ${processMin} processMax: ${processMax}`);
|
|
|
|
|
const predictedMeasurement = this.measurements.type(measurement).variant("predicted").position("downstream").getAllValues().values;
|
|
|
|
|
const measuredMeasurement = this.measurements.type(measurement).variant("measured").position("downstream").getAllValues().values;
|
|
|
|
|
const predictedMeasurement = this.measurements.type(measurement).variant("predicted").position(POSITIONS.DOWNSTREAM).getAllValues().values;
|
|
|
|
|
const measuredMeasurement = this.measurements.type(measurement).variant("measured").position(POSITIONS.DOWNSTREAM).getAllValues().values;
|
|
|
|
|
|
|
|
|
|
if (!predictedMeasurement || !measuredMeasurement) return null;
|
|
|
|
|
|
|
|
|
|
@@ -251,11 +273,12 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
case "exitmaintenance":
|
|
|
|
|
return await this.executeSequence(parameter);
|
|
|
|
|
|
|
|
|
|
case "flowmovement":
|
|
|
|
|
case "flowmovement": {
|
|
|
|
|
// Calculate the control value for a desired flow
|
|
|
|
|
const pos = this.calcCtrl(parameter);
|
|
|
|
|
// Move to the desired setpoint
|
|
|
|
|
return await this.setpoint(pos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case "emergencystop":
|
|
|
|
|
this.logger.warn(`Emergency stop activated by '${source}'.`);
|
|
|
|
|
@@ -348,23 +371,23 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
calcFlow(x) {
|
|
|
|
|
if(this.hasCurve) {
|
|
|
|
|
if (!this._isOperationalState()) {
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("downstream").value(0,Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("atEquipment").value(0,Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.DOWNSTREAM).value(0,Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(0,Date.now(),this.config.general.unit);
|
|
|
|
|
this.logger.debug(`Machine is not operational. Setting predicted flow to 0.`);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const cFlow = this.predictFlow.y(x);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("downstream").value(cFlow,Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("atEquipment").value(cFlow,Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.DOWNSTREAM).value(cFlow,Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(cFlow,Date.now(),this.config.general.unit);
|
|
|
|
|
//this.logger.debug(`Calculated flow: ${cFlow} for pressure: ${this.getMeasuredPressure()} and position: ${x}`);
|
|
|
|
|
return cFlow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If no curve data is available, log a warning and return 0
|
|
|
|
|
this.logger.warn(`No curve data available for flow calculation. Returning 0.`);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("downstream").value(0, Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("atEquipment").value(0, Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.DOWNSTREAM).value(0, Date.now(),this.config.general.unit);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(0, Date.now(),this.config.general.unit);
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -373,20 +396,20 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
calcPower(x) {
|
|
|
|
|
if(this.hasCurve) {
|
|
|
|
|
if (!this._isOperationalState()) {
|
|
|
|
|
this.measurements.type("power").variant("predicted").position('atEquipment').value(0);
|
|
|
|
|
this.measurements.type("power").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(0);
|
|
|
|
|
this.logger.debug(`Machine is not operational. Setting predicted power to 0.`);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//this.predictPower.currentX = x; Decrepated
|
|
|
|
|
const cPower = this.predictPower.y(x);
|
|
|
|
|
this.measurements.type("power").variant("predicted").position('atEquipment').value(cPower);
|
|
|
|
|
this.measurements.type("power").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(cPower);
|
|
|
|
|
//this.logger.debug(`Calculated power: ${cPower} for pressure: ${this.getMeasuredPressure()} and position: ${x}`);
|
|
|
|
|
return cPower;
|
|
|
|
|
}
|
|
|
|
|
// If no curve data is available, log a warning and return 0
|
|
|
|
|
this.logger.warn(`No curve data available for power calculation. Returning 0.`);
|
|
|
|
|
this.measurements.type("power").variant("predicted").position('atEquipment').value(0);
|
|
|
|
|
this.measurements.type("power").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(0);
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -404,7 +427,7 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
|
|
|
|
|
// If no curve data is available, log a warning and return 0
|
|
|
|
|
this.logger.warn(`No curve data available for power calculation. Returning 0.`);
|
|
|
|
|
this.measurements.type("power").variant("predicted").position('atEquipment').value(0);
|
|
|
|
|
this.measurements.type("power").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(0);
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -414,14 +437,14 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
if(this.hasCurve) {
|
|
|
|
|
this.predictCtrl.currentX = x;
|
|
|
|
|
const cCtrl = this.predictCtrl.y(x);
|
|
|
|
|
this.measurements.type("ctrl").variant("predicted").position('atEquipment').value(cCtrl);
|
|
|
|
|
this.measurements.type("ctrl").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(cCtrl);
|
|
|
|
|
//this.logger.debug(`Calculated ctrl: ${cCtrl} for pressure: ${this.getMeasuredPressure()} and position: ${x}`);
|
|
|
|
|
return cCtrl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If no curve data is available, log a warning and return 0
|
|
|
|
|
this.logger.warn(`No curve data available for control calculation. Returning 0.`);
|
|
|
|
|
this.measurements.type("ctrl").variant("predicted").position('atEquipment').value(0);
|
|
|
|
|
this.measurements.type("ctrl").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(0);
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -453,7 +476,7 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get downstream
|
|
|
|
|
const downstreamPressure = this.measurements.type('pressure').variant('measured').position('downstream').getCurrentValue();
|
|
|
|
|
const downstreamPressure = this.measurements.type('pressure').variant('measured').position(POSITIONS.DOWNSTREAM).getCurrentValue();
|
|
|
|
|
|
|
|
|
|
// Only downstream => use it, warn that it's partial
|
|
|
|
|
if (downstreamPressure != null) {
|
|
|
|
|
@@ -507,7 +530,7 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get
|
|
|
|
|
const upstreamFlow = this.measurements.type('flow').variant('measured').position('upstream').getCurrentValue();
|
|
|
|
|
const upstreamFlow = this.measurements.type('flow').variant('measured').position(POSITIONS.UPSTREAM).getCurrentValue();
|
|
|
|
|
|
|
|
|
|
// Only upstream => might still accept it, but warn
|
|
|
|
|
if (upstreamFlow != null) {
|
|
|
|
|
@@ -516,7 +539,7 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get
|
|
|
|
|
const downstreamFlow = this.measurements.type('flow').variant('measured').position('downstream').getCurrentValue();
|
|
|
|
|
const downstreamFlow = this.measurements.type('flow').variant('measured').position(POSITIONS.DOWNSTREAM).getCurrentValue();
|
|
|
|
|
|
|
|
|
|
// Only downstream => might still accept it, but warn
|
|
|
|
|
if (downstreamFlow != null) {
|
|
|
|
|
@@ -530,7 +553,7 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleMeasuredPower() {
|
|
|
|
|
const power = this.measurements.type("power").variant("measured").position("atEquipment").getCurrentValue();
|
|
|
|
|
const power = this.measurements.type("power").variant("measured").position(POSITIONS.AT_EQUIPMENT).getCurrentValue();
|
|
|
|
|
// If your system calls it "upstream" or just a single "value", adjust accordingly
|
|
|
|
|
|
|
|
|
|
if (power != null) {
|
|
|
|
|
@@ -559,6 +582,7 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
|
|
|
|
|
// NEW: Flow handler
|
|
|
|
|
updateMeasuredFlow(value, position, context = {}) {
|
|
|
|
|
|
|
|
|
|
if (!this._isOperationalState()) {
|
|
|
|
|
this.logger.warn(`Machine not operational, skipping flow update from ${context.childName || 'unknown'}`);
|
|
|
|
|
return;
|
|
|
|
|
@@ -566,16 +590,26 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
|
|
|
|
|
this.logger.debug(`Flow update: ${value} at ${position} from ${context.childName || 'child'}`);
|
|
|
|
|
|
|
|
|
|
if (this.upstreamSource && this.downstreamSink) {
|
|
|
|
|
this.updateSourceSink();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Store in parent's measurement container
|
|
|
|
|
this.measurements.type("flow").variant("measured").position(position).value(value, context.timestamp, context.unit);
|
|
|
|
|
|
|
|
|
|
// Update predicted flow if you have prediction capability
|
|
|
|
|
if (this.predictFlow) {
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("downstream").value(this.predictFlow.outputY || 0);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position("atEquipment").value(this.predictFlow.outputY || 0);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.DOWNSTREAM).value(this.predictFlow.outputY || 0);
|
|
|
|
|
this.measurements.type("flow").variant("predicted").position(POSITIONS.AT_EQUIPMENT).value(this.predictFlow.outputY || 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateSourceSink() {
|
|
|
|
|
// Handles flow according to the configured "flow number"
|
|
|
|
|
this.logger.debug(`Updating source-sink pair: ${this.upstreamSource.config.functionality.softwareType} - ${this.downstreamSink.config.functionality.softwareType}`);
|
|
|
|
|
this.downstreamSink.setInfluent = this.upstreamSource.getEffluent[this.config.flowNumber];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Helper method for operational state check
|
|
|
|
|
_isOperationalState() {
|
|
|
|
|
const state = this.state.getCurrentState();
|
|
|
|
|
@@ -697,35 +731,35 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
|
|
|
|
|
|
const pressureDiff = this.measurements.type('pressure').variant('measured').difference('Pa');
|
|
|
|
|
const g = gravity.getStandardGravity();
|
|
|
|
|
const temp = this.measurements.type('temperature').variant('measured').position('atEquipment').getCurrentValue('K');
|
|
|
|
|
const atmPressure = this.measurements.type('atmPressure').variant('measured').position('atEquipment').getCurrentValue('Pa');
|
|
|
|
|
const temp = this.measurements.type('temperature').variant('measured').position(POSITIONS.AT_EQUIPMENT).getCurrentValue('K');
|
|
|
|
|
const atmPressure = this.measurements.type('atmPressure').variant('measured').position(POSITIONS.AT_EQUIPMENT).getCurrentValue('Pa');
|
|
|
|
|
|
|
|
|
|
console.log(`--------------------calc efficiency : Pressure diff:${pressureDiff},${temp}, ${g} `);
|
|
|
|
|
const rho = coolprop.PropsSI('D', 'T', temp, 'P', atmPressure, 'WasteWater');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.logger.debug(`temp: ${temp} atmPressure : ${atmPressure} rho : ${rho} pressureDiff: ${pressureDiff?.value || 0}`);
|
|
|
|
|
const flowM3s = this.measurements.type('flow').variant('predicted').position('atEquipment').getCurrentValue('m3/s');
|
|
|
|
|
const powerWatt = this.measurements.type('power').variant('predicted').position('atEquipment').getCurrentValue('W');
|
|
|
|
|
const flowM3s = this.measurements.type('flow').variant('predicted').position(POSITIONS.AT_EQUIPMENT).getCurrentValue('m3/s');
|
|
|
|
|
const powerWatt = this.measurements.type('power').variant('predicted').position(POSITIONS.AT_EQUIPMENT).getCurrentValue('W');
|
|
|
|
|
this.logger.debug(`Flow : ${flowM3s} power: ${powerWatt}`);
|
|
|
|
|
|
|
|
|
|
if (power != 0 && flow != 0) {
|
|
|
|
|
const specificFlow = flow / power;
|
|
|
|
|
const specificEnergyConsumption = power / flow;
|
|
|
|
|
|
|
|
|
|
this.measurements.type("efficiency").variant(variant).position('atEquipment').value(specificFlow);
|
|
|
|
|
this.measurements.type("specificEnergyConsumption").variant(variant).position('atEquipment').value(specificEnergyConsumption);
|
|
|
|
|
this.measurements.type("efficiency").variant(variant).position(POSITIONS.AT_EQUIPMENT).value(specificFlow);
|
|
|
|
|
this.measurements.type("specificEnergyConsumption").variant(variant).position(POSITIONS.AT_EQUIPMENT).value(specificEnergyConsumption);
|
|
|
|
|
|
|
|
|
|
if(pressureDiff?.value != null && flowM3s != null && powerWatt != null){
|
|
|
|
|
const meterPerBar = pressureDiff.value / rho * g;
|
|
|
|
|
const nHydraulicEfficiency = rho * g * flowM3s * (pressureDiff.value * meterPerBar ) / powerWatt;
|
|
|
|
|
this.measurements.type("nHydraulicEfficiency").variant(variant).position('atEquipment').value(nHydraulicEfficiency);
|
|
|
|
|
this.measurements.type("nHydraulicEfficiency").variant(variant).position(POSITIONS.AT_EQUIPMENT).value(nHydraulicEfficiency);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//change this to nhydrefficiency ?
|
|
|
|
|
return this.measurements.type("efficiency").variant(variant).position('atEquipment').getCurrentValue();
|
|
|
|
|
return this.measurements.type("efficiency").variant(variant).position(POSITIONS.AT_EQUIPMENT).getCurrentValue();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -825,7 +859,7 @@ const PT1 = new Child(config={
|
|
|
|
|
},
|
|
|
|
|
functionality:{
|
|
|
|
|
softwareType:"measurement",
|
|
|
|
|
positionVsParent:"upstream",
|
|
|
|
|
positionVsParent: POSITIONS.UPSTREAM,
|
|
|
|
|
},
|
|
|
|
|
asset:{
|
|
|
|
|
supplier:"Vega",
|
|
|
|
|
@@ -847,7 +881,7 @@ const PT2 = new Child(config={
|
|
|
|
|
},
|
|
|
|
|
functionality:{
|
|
|
|
|
softwareType:"measurement",
|
|
|
|
|
positionVsParent:"upstream",
|
|
|
|
|
positionVsParent: POSITIONS.UPSTREAM,
|
|
|
|
|
},
|
|
|
|
|
asset:{
|
|
|
|
|
supplier:"Vega",
|
|
|
|
|
@@ -901,8 +935,8 @@ const machine = new Machine(machineConfig, stateConfig);
|
|
|
|
|
|
|
|
|
|
//machine.logger.info(JSON.stringify(curve["machineCurves"]["Hydrostal"]["H05K-S03R+HGM1X-X280KO"]));
|
|
|
|
|
machine.logger.info(`Registering child...`);
|
|
|
|
|
machine.childRegistrationUtils.registerChild(PT1, "upstream");
|
|
|
|
|
machine.childRegistrationUtils.registerChild(PT2, "downstream");
|
|
|
|
|
machine.childRegistrationUtils.registerChild(PT1, POSITIONS.UPSTREAM);
|
|
|
|
|
machine.childRegistrationUtils.registerChild(PT2, POSITIONS.DOWNSTREAM);
|
|
|
|
|
|
|
|
|
|
//feed curve to the machine class
|
|
|
|
|
//machine.updateCurve(curve["machineCurves"]["Hydrostal"]["H05K-S03R+HGM1X-X280KO"]);
|
|
|
|
|
@@ -915,8 +949,8 @@ machine.getOutput();
|
|
|
|
|
//manual test
|
|
|
|
|
//machine.handleInput("parent", "execSequence", "startup");
|
|
|
|
|
|
|
|
|
|
machine.measurements.type("pressure").variant("measured").position('upstream').value(-200);
|
|
|
|
|
machine.measurements.type("pressure").variant("measured").position('downstream').value(1000);
|
|
|
|
|
machine.measurements.type("pressure").variant("measured").position(POSITIONS.UPSTREAM).value(-200);
|
|
|
|
|
machine.measurements.type("pressure").variant("measured").position(POSITIONS.DOWNSTREAM).value(1000);
|
|
|
|
|
|
|
|
|
|
testingSequences();
|
|
|
|
|
|
|
|
|
|
|