-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smoothing setpoint jumps to prevent unnecessary short-term compressor shutdowns #160
Comments
I will put this logic in the tab WP Control, [Function NightReduction] node. |
:-) Thank you. |
Ease node, i can recreate the logic in a function node. I will try that first. |
Hello,
I searched for this kind of function and found first the following code in Nodered forum- maybe as a suggestion… and than found the ease-node.
Regards Rue
// Limits the slew rate incoming payload values// optionally sending intermediate values at specified ratelet maxRate = 2/60; // max slew rate units/minutelet sendIntermediates = false; // whether to send intermediate valueslet period = 1000; // period in millisecs to send new values (if sendIntermediates)let jumpThreshold = 0.25; // if the step asked for is more that this then goes immediately to that valuevar newValue = Number(msg.payload);var timer = context.get('timer') || 0;// check the value is a numberif (!isNaN(newValue) && isFinite(newValue)) { var target = msg.payload; context.set('target', target); // set last value to new one if first time through var lastValue = context.get('lastValue'); if (typeof lastValue == "undefined" || lastValue === null) { lastValue = newValue; context.set('lastValue', newValue); } // calc new value msg.payload = calcOutput(); // stop the timer if (timer) { clearTimeout(timer); context.set('timer', null); } // restart it if required to send intermediate values if (sendIntermediates) { timer = setInterval(function(){ // the timer has run down calculate next value and send it var newValue = calcOutput(); if (newValue != context.get('lastValueSent')) { context.set('lastValueSent', newValue); node.send({payload: newValue}); } },period); context.set('timer', timer); } context.set('lastValueSent', msg.payload);} else { // payload is not a number so ignore it // also stop the timer as we don't know what to send any more if (timer) { clearTimeout(timer); context.set('timer', null); } msg = null;}return msg;// determines the required output valuefunction calcOutput() { var lastValue = context.get('lastValue'); var target = context.get('target'); // set to current value if first time through or step > threshold if (typeof lastValue == "undefined" || lastValue === null) lastValue = target; var now = new Date(); var lastTime = context.get('lastTime') || now; // limit value to last value +- rate * time var maxDelta = (now.getTime() - lastTime.getTime()) * maxRate / (60 * 1000); if (Math.abs(target - lastValue) > jumpThreshold) { // step > threshold so go there imediately newValue = target; } else if (target > lastValue) { newValue = Math.min( lastValue + maxDelta, target); } else { newValue = Math.max( lastValue - maxDelta, target); } context.set('lastValue', newValue); context.set('lastTime', now); return newValue;}Gesendet mit der GMX Mail AppAm 18.01.24 um 13:50 schrieb Ed ter Bak
Von: "Ed ter Bak" ***@***.***>Datum: 18. Januar 2024An: "edterbak/NodeRed_Heishamon_control" ***@***.***>Cc: "WP-Rue" ***@***.***>,"Author" ***@***.***>Betreff: Re: [edterbak/NodeRed_Heishamon_control] [BUG]:Smoothing setpoint jumps to prevent unnecessary short-term compressor shutdowns (Issue #160)
Ease node, i can recreate the logic in a function node. I will try that first.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Alternative; I need to clean the night reduction function. It has now 2 methods to achieve the same I think a good replacement is to be able to use the scheduler to set the value of night reduction. At your set time. |
I would prefer to have the switch for manual control too.. |
As switching on night-reduction with offset -3 I got a 5 min compressor shutdown...
To avoid this I put a 10 min smoothing function into your flow...
Maybe you have a better idea for the right place...
My implementation only works for the switch and global.var: NightReductionWaterTemp.state and only for the reduction of the setpoint temperature...
Greetings Rue
The text was updated successfully, but these errors were encountered: