|
|
|
@@ -161,10 +161,6 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
this.updateMeasuredFlow(value, position, context);
|
|
|
|
this.updateMeasuredFlow(value, position, context);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'temperature':
|
|
|
|
|
|
|
|
this.updateMeasuredTemperature(value, position, context);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
this.logger.warn(`No handler for measurement type: ${measurementType}`);
|
|
|
|
this.logger.warn(`No handler for measurement type: ${measurementType}`);
|
|
|
|
// Generic handler - just update position
|
|
|
|
// Generic handler - just update position
|
|
|
|
@@ -775,9 +771,9 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
|
|
|
module.exports = Machine;
|
|
|
|
module.exports = Machine;
|
|
|
|
|
|
|
|
|
|
|
|
/*------------------- Testing -------------------*/
|
|
|
|
/*------------------- Testing -------------------*/
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curve = require('C:/Users/zn375/.node-red/public/fallbackData.json');
|
|
|
|
/*
|
|
|
|
|
|
|
|
//curve = require('C:/Users/zn375/.node-red/public/fallbackData.json');
|
|
|
|
|
|
|
|
|
|
|
|
//import a child
|
|
|
|
//import a child
|
|
|
|
const Child = require('../../measurement/src/specificClass');
|
|
|
|
const Child = require('../../measurement/src/specificClass');
|
|
|
|
@@ -793,7 +789,6 @@ const PT1 = new Child(config={
|
|
|
|
},
|
|
|
|
},
|
|
|
|
functionality:{
|
|
|
|
functionality:{
|
|
|
|
softwareType:"measurement",
|
|
|
|
softwareType:"measurement",
|
|
|
|
positionVsParent:"upstream",
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
asset:{
|
|
|
|
asset:{
|
|
|
|
supplier:"Vega",
|
|
|
|
supplier:"Vega",
|
|
|
|
@@ -815,7 +810,6 @@ const PT2 = new Child(config={
|
|
|
|
},
|
|
|
|
},
|
|
|
|
functionality:{
|
|
|
|
functionality:{
|
|
|
|
softwareType:"measurement",
|
|
|
|
softwareType:"measurement",
|
|
|
|
positionVsParent:"upstream",
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
asset:{
|
|
|
|
asset:{
|
|
|
|
supplier:"Vega",
|
|
|
|
supplier:"Vega",
|
|
|
|
@@ -831,18 +825,17 @@ console.log(`Creating machine...`);
|
|
|
|
|
|
|
|
|
|
|
|
const machineConfig = {
|
|
|
|
const machineConfig = {
|
|
|
|
general: {
|
|
|
|
general: {
|
|
|
|
name: "Hydrostal",
|
|
|
|
name: "Hidrostal",
|
|
|
|
logging: {
|
|
|
|
logging: {
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
logLevel: "debug",
|
|
|
|
logLevel: "debug",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
asset: {
|
|
|
|
asset: {
|
|
|
|
supplier: "Hydrostal",
|
|
|
|
supplier: "Hidrostal",
|
|
|
|
type: "pump",
|
|
|
|
type: "pump",
|
|
|
|
category: "centrifugal",
|
|
|
|
category: "centrifugal",
|
|
|
|
model: "H05K-S03R+HGM1X-X280KO", // Ensure this field is present.
|
|
|
|
model: "hidrostal-H05K-S03R", // Ensure this field is present.
|
|
|
|
machineCurve: curve["machineCurves"]["Hydrostal"]["H05K-S03R+HGM1X-X280KO"],
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -871,18 +864,17 @@ const machine = new Machine(machineConfig, stateConfig);
|
|
|
|
machine.logger.info(`Registering child...`);
|
|
|
|
machine.logger.info(`Registering child...`);
|
|
|
|
machine.childRegistrationUtils.registerChild(PT1, "upstream");
|
|
|
|
machine.childRegistrationUtils.registerChild(PT1, "upstream");
|
|
|
|
machine.childRegistrationUtils.registerChild(PT2, "downstream");
|
|
|
|
machine.childRegistrationUtils.registerChild(PT2, "downstream");
|
|
|
|
|
|
|
|
/*
|
|
|
|
//feed curve to the machine class
|
|
|
|
|
|
|
|
//machine.updateCurve(curve["machineCurves"]["Hydrostal"]["H05K-S03R+HGM1X-X280KO"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PT1.logger.info(`Enable sim...`);
|
|
|
|
PT1.logger.info(`Enable sim...`);
|
|
|
|
PT1.toggleSimulation();
|
|
|
|
PT1.toggleSimulation();
|
|
|
|
PT2.logger.info(`Enable sim...`);
|
|
|
|
PT2.logger.info(`Enable sim...`);
|
|
|
|
PT2.toggleSimulation();
|
|
|
|
PT2.toggleSimulation();
|
|
|
|
machine.getOutput();
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//manual test
|
|
|
|
//manual test
|
|
|
|
//machine.handleInput("parent", "execSequence", "startup");
|
|
|
|
//machine.handleInput("parent", "execSequence", "startup");
|
|
|
|
|
|
|
|
/*
|
|
|
|
machine.measurements.type("pressure").variant("measured").position('upstream').value(-200);
|
|
|
|
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('downstream').value(1000);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -892,8 +884,8 @@ const tickLoop = setInterval(changeInput,1000);
|
|
|
|
|
|
|
|
|
|
|
|
function changeInput(){
|
|
|
|
function changeInput(){
|
|
|
|
PT1.logger.info(`tick...`);
|
|
|
|
PT1.logger.info(`tick...`);
|
|
|
|
PT1.tick();
|
|
|
|
//PT1.tick();
|
|
|
|
PT2.tick();
|
|
|
|
//PT2.tick();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function testingSequences(){
|
|
|
|
async function testingSequences(){
|
|
|
|
|