Browse Source

Tidy up instructions and readme

Shane Weaver 6 years ago
parent
commit
4a8875ef2d
3 changed files with 27 additions and 9 deletions
  1. 7 0
      README.md
  2. 16 5
      ramp-thermostat/ramp-thermostat.html
  3. 4 4
      ramp-thermostat/ramp-thermostat.js

+ 7 - 0
README.md

@@ -23,6 +23,13 @@ A profile has at least 2 points and should typically start at 00:00 and end at 2
 
 
 The hysteresis is used to prevent osciliation. The `[+]` value is added to the target and the `[-]` (absolute) value is subtracted from the target. Within this neutral zone no action accurs.
 The hysteresis is used to prevent osciliation. The `[+]` value is added to the target and the `[-]` (absolute) value is subtracted from the target. Within this neutral zone no action accurs.
 
 
+The ramp limit defines the maximum time prior to a point to apply the 
+gradient for calculating the thermostat value. Prior to this time, the thermostat will
+stay constant, thus avoiding need to add extra points. <br/>
+For example, 2 points `06:00 [10 degrees] - 14:00 [21 degrees]` with no ramp limit will gradually increase thermostate over the 8 hour period. Setting the ramp
+limit to 60 minutes will keep the thermostat at 10 degrees until `13:00` and then will increase only over the last
+hour. Set to `1440` or leave empty to disable this feature.
+
 ## Usage
 ## Usage
 
 
 This node expects a `numeric` msg.payload containing the current temperature (number). The msg.topic should be set to `setCurrent`. It will calculate the target temperature depending on msg.payload at the current time and output 3 values:
 This node expects a `numeric` msg.payload containing the current temperature (number). The msg.topic should be set to `setCurrent`. It will calculate the target temperature depending on msg.payload at the current time and output 3 values:

+ 16 - 5
ramp-thermostat/ramp-thermostat.html

@@ -12,8 +12,8 @@
         <input type="text" id="node-input-hysteresisminus" style="width:50px"> (degrees)
         <input type="text" id="node-input-hysteresisminus" style="width:50px"> (degrees)
     </div>
     </div>
     <div class="form-row">
     <div class="form-row">
-        <label for="node-input-hysteresisleft"><i class="fa fa-arrows-h"></i> Hysteresis</label>
-        <input type="text" id="node-input-hysteresisleft" style="width:50px"> (mins)
+        <label for="node-input-hysteresisleft"><i class="fa fa-stop-circle"></i> Ramp Limit</label>
+        <input type="text" id="node-input-ramplimit" style="width:50px"> (mins)
     </div>    
     </div>    
     <div class="form-row">
     <div class="form-row">
         <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
         <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -25,8 +25,8 @@
     </span>
     </span>
     </div>
     </div>
     <div class="form-tips">
     <div class="form-tips">
-    <span class="fa fa-arrows-h"> Hysteresis defines the maximum time prior to a point to apply the 
-        gradient for calculating the thermostat value. Above this time, the thermostat will
+    <span class="fa fa-stop-circle"> Ramp Limit defines the maximum time prior to a point to apply the 
+        gradient for calculating the thermostat value. Prior to this time, the thermostat will
         stay constant, thus avoiding need to add extra points.
         stay constant, thus avoiding need to add extra points.
     </span>
     </span>
     </div>
     </div>
@@ -97,6 +97,17 @@
     provides the value depending on the current time <code>00:00-24:00</code>.
     provides the value depending on the current time <code>00:00-24:00</code>.
     The profile consists of several points whose connections build a sequence of lines.
     The profile consists of several points whose connections build a sequence of lines.
     The switching moment can be optimized by defining a gradient line like a <code>ramp</code>.</p>
     The switching moment can be optimized by defining a gradient line like a <code>ramp</code>.</p>
+    <p>The hysteresis is used to prevent osciliation. The `[+]` value is added to the target and the `[-]` (absolute) value is subtracted from the target. Within this neutral zone no action accurs.</p>
+    <p>
+    The ramp limit defines the maximum time prior to a point to apply the 
+    gradient for calculating the thermostat value. Prior to this time, the thermostat will
+    stay constant, thus avoiding need to add extra points. <br/>
+    For example, 2 points:<br/><code>06:00: 10 (degrees)</code><br/><code>14:00: 21 (degrees)</code><br/> 
+    with no ramp limit will gradually increase thermostat over the 8 hour period. Setting the ramp
+    limit to 60 minutes will keep the thermostat at 10 degrees until <code>13:00</code> and then will 
+    increase only over the last
+    hour. <br/>Set to <code>1440</code> or leave empty to disable this feature.
+    </p>
 </script>
 </script>
 
 
 <script type="text/javascript">
 <script type="text/javascript">
@@ -108,7 +119,7 @@
             profile: {value:"",type:"profile"},
             profile: {value:"",type:"profile"},
             hysteresisplus: {value:0, validate:RED.validators.number()},
             hysteresisplus: {value:0, validate:RED.validators.number()},
             hysteresisminus: {value:0, validate:RED.validators.number()},
             hysteresisminus: {value:0, validate:RED.validators.number()},
-            hysteresisleft: {value:60, validate:RED.validators.number()}
+            ramplimit: {value:"", validate:RED.validators.regex(/^\d*$/)}
         },
         },
         inputs:1,
         inputs:1,
         outputs:3,
         outputs:3,

+ 4 - 4
ramp-thermostat/ramp-thermostat.js

@@ -28,7 +28,7 @@ module.exports = function(RED) {
     
     
     this.h_plus = Math.abs(parseFloat(config.hysteresisplus)) || 0;
     this.h_plus = Math.abs(parseFloat(config.hysteresisplus)) || 0;
     this.h_minus = Math.abs(parseFloat(config.hysteresisminus)) || 0;
     this.h_minus = Math.abs(parseFloat(config.hysteresisminus)) || 0;
-    this.h_left = Math.abs(parseInt(config.hysteresisleft)) || 1440;
+    this.ramp_limit = Math.abs(parseInt(config.ramplimit)) || 1440;
     
     
     // experimental
     // experimental
     //this.profile = globalContext.get(node_name);
     //this.profile = globalContext.get(node_name);
@@ -190,15 +190,15 @@ module.exports = function(RED) {
       
       
       if (current_mins < point_mins) {
       if (current_mins < point_mins) {
 
 
-        if( point_mins - current_mins > this.h_left ) {
+        if( point_mins - current_mins > this.ramp_limit ) {
           // Not yet in window to start ramping thermostat, stay constant
           // Not yet in window to start ramping thermostat, stay constant
           target = pre_target;
           target = pre_target;
           break;
           break;
         }
         }
 
 
-        if( point_mins - pre_mins > this.h_left && point_mins - current_mins <= this.h_left ) {
+        if( point_mins - pre_mins > this.ramp_limit && point_mins - current_mins <= this.ramp_limit ) {
           // bring the previous point forward to match ramp max
           // bring the previous point forward to match ramp max
-          pre_mins = point_mins - this.h_left;
+          pre_mins = point_mins - this.ramp_limit;
         }
         }
 
 
         gradient = (point_target - pre_target) / (point_mins - pre_mins);
         gradient = (point_target - pre_target) / (point_mins - pre_mins);