forked from RnD/valveGroupControl
commit
This commit is contained in:
@@ -94,9 +94,10 @@ class ValveGroupControl {
|
||||
if (child && child.emitter) {
|
||||
child.measurements.emitter.on('change', (data) => {
|
||||
const childName = child.config?.general?.name || `${softwareType}_child`;
|
||||
console.log('🔔 EVENT RECEIVED!', childName, data);
|
||||
console.log('🔔 EVENT RECEIVED!', childName, data.type);
|
||||
console.log('🔔 Data', data);
|
||||
this.logger.info(`Received change event from child ${childName}:`, data);
|
||||
this.handleChildChange(child, data);
|
||||
this.handleChildChange(child, data, softwareType);
|
||||
});
|
||||
console.log(`✅ Event listener added for ${softwareType} child`);
|
||||
} else {
|
||||
@@ -107,11 +108,14 @@ class ValveGroupControl {
|
||||
}
|
||||
}
|
||||
|
||||
handleChildChange(child, data) {
|
||||
handleChildChange(child, data, softwareType) {
|
||||
switch(data.type) {
|
||||
case 'flow':
|
||||
if (child.source === 'mg') {
|
||||
console.log('softwareType', softwareType)
|
||||
if (softwareType === 'machinegroup') {
|
||||
this.logger.info("Total flow change from machineGroupControl detected by valveGroupControl");
|
||||
//Opslaan nieuwe total flow
|
||||
this.measurements.type("flow").variant("predicted").position("atEquipment").value(data.value);
|
||||
// als totalflow van mg veranderd, bereken dan de nieuwe valve flows
|
||||
this.calcValveFlows();
|
||||
};
|
||||
@@ -400,7 +404,7 @@ updateFlow(variant,value,position) {
|
||||
|
||||
//fill in the rest of the output object
|
||||
output["mode"] = this.currentMode;
|
||||
output["maxDeltaP"] = this.maxDeltaP;
|
||||
//output["maxDeltaP"] = this.maxDeltaP;
|
||||
|
||||
//this.logger.debug(`Output: ${JSON.stringify(output)}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user