Giter Club home page Giter Club logo

Comments (4)

sabom2d avatar sabom2d commented on June 29, 2024 1

The tip from albertoanta seemes to be the solution.
Issue did not trigger anymore after the change.

Thx

from nodered_heishamon_control.

albertoanta avatar albertoanta commented on June 29, 2024

Same bug for me. Solved it in WP Control Tab, node Cool Function
Just comment initialization of msg3 in first if statement and declare it at the begin of code in node.
The final code is

var F_COOL                      = global.get('F_COOL',"file");
    if (F_COOL === undefined || F_COOL.setpoint_requested === undefined) {return null}
var TOP20_ThreeWay_Valve_State  = global.get('TOP20_ThreeWay_Valve_State');
var TOP4_Operating_Mode_State   = global.get('TOP4_Operating_Mode_State',"file");
var TOP0_Heatpump_State         = global.get('TOP0_Heatpump_State',"file");

let msg1 = {};    // calculated_dew_point
let msg2 = {};    // calculated_setpoint_lower_limit
let msg3 = {};    // final setpoint

//
//  TOP20_ThreeWay_Valve_State  = 0 (ROOM)
//  TOP4_Operating_Mode_State  = 1, 5  TOP20=0
//
//// Operating mode     0=Heat only,     1=Cool only,       2=Auto(Heat),       3=DHW only,       4=Heat+DHW,      5=Cool+DHW,       6=Auto(Heat)+DHW,       7=Auto(Cool),     8=Auto(Cool)+DHW
////////////////////////////////////////////////////////////////////////////////
//                          DEW POINT CALCULATION                             //
////////////////////////////////////////////////////////////////////////////////
if (F_COOL.RelativeHumidity !== undefined && F_COOL.Temperature !== undefined && F_COOL.safety_margin !== undefined && F_COOL.manual_setpoint_lower_limit !== undefined) {
    
    var A = Math.log(F_COOL.RelativeHumidity / 100) / Math.log(2.718282) + 17.62 * F_COOL.Temperature / (243.12 + F_COOL.Temperature);         // BLB 20230405 corrected Td calculation
    var Td = 243.12 * A / (17.62 - A);
    
    // let msg1={};    // calculated_dew_point
    // let msg2={};    // calculated_setpoint_lower_limit
    // let msg3={};    // final setpoint

    msg1.payload = Td;
    msg1.payload = Number(msg1.payload).toFixed(2);
    msg1.payload = parseFloat(msg1.payload);
    msg1.topic = "Dew Point (°C)";
        global.set("F_COOL.calculated_dew_point",msg1.payload,"file");

    msg2.payload = Td + F_COOL.safety_margin;
    msg2.payload = Number(msg2.payload).toFixed(2);
    msg2.payload = parseFloat(msg2.payload);
    msg2.topic = 'Setpoint lower limit';
        global.set("F_COOL.calculated_setpoint_lower_limit",msg2.payload,"file");

    msg3.payload = Math.ceil(msg2.payload);
    if (msg3.payload < F_COOL.manual_setpoint_lower_limit)  { msg3.payload = F_COOL.manual_setpoint_lower_limit; }
    if (F_COOL.setpoint_requested > msg3.payload)           { msg3.payload = F_COOL.setpoint_requested; }

    // Check if heatpump is on. if not, do nothing / exit
    if (TOP0_Heatpump_State === undefined || TOP0_Heatpump_State == 0) { return null } 
    
    // check if COOL is in the current operating mode. if not, do nothing / exit
    if (TOP4_Operating_Mode_State === undefined || TOP4_Operating_Mode_State == 0 || TOP4_Operating_Mode_State == 2 || TOP4_Operating_Mode_State == 3 || TOP4_Operating_Mode_State == 4) { return null }

    msg3.topic = 'new setpoint';
    return msg3 

}


// If there is no humidity or temperature sensor data, the requested setpoint will be sent.
if (F_COOL.RelativeHumidity === undefined && F_COOL.Temperature === undefined) {
    msg3.payload = F_COOL.setpoint_requested
    msg3.topic = 'new setpoint';
    return msg3 
}

from nodered_heishamon_control.

edterbak avatar edterbak commented on June 29, 2024

Yes. You are correct.
In 2 weeks im back behind the pc. And can fix it.
Thanks for the bug Report and also pointing the cause.

from nodered_heishamon_control.

sabom2d avatar sabom2d commented on June 29, 2024

from nodered_heishamon_control.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.