-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathself-adjusting-threshold.html
More file actions
184 lines (177 loc) · 7.03 KB
/
Copy pathself-adjusting-threshold.html
File metadata and controls
184 lines (177 loc) · 7.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<script type="text/javascript">
RED.nodes.registerType('self-adjusting-threshold', {
category: 'function',
color: '#80dfff',
defaults: {
name: {
value: ""
},
payloadtype: {
value: "literal"
},
invert: {
value: false
},
max: {
value: 80,
validate: function(v) {
if (isNaN(v)) {
return false;
}
if (v < 0) {
return false;
}
return true;
}
},
head: {
value: 15,
validate: function(v) {
if (isNaN(v)) {
return false;
}
if (v < 0) {
return false;
}
if (v > 25) {
return false;
}
return true;
}
},
period: {
value: 12,
validate: function(v) {
if (isNaN(v)) {
return false;
}
if (v < 1) {
return false;
}
if (v > 48) {
return false;
}
return true;
}
},
interval: {
value: 1,
validate: function(v) {
if (isNaN(v)) {
return false;
}
if (v < 0) {
return false;
}
if (v > 15) {
return false;
}
return true;
}
}
},
inputs: 1,
outputs: 2,
icon: "function.png",
paletteLabel: "threshold",
inputLabels: "",
outputLabels: ["setpoint(s)", "threshold"],
label: function() {
return this.name || "threshold";
}
});
</script>
<script type="text/x-red" data-template-name="self-adjusting-threshold">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-period"><i class="fa fa-wrench"></i> Period</label>
<input type="text" id="node-input-period" placeholder="1 - 48">
<p>Time period for average calculation in hours.
</div>
<div class="form-row">
<label for="node-input-head"><i class="fa fa-wrench"></i> Overhead</label>
<input type="text" id="node-input-head" placeholder="0 - 25">
<p>Threshold overhead percentage.
</div>
<div class="form-row">
<label for="node-input-interval"><i class="fa fa-wrench"></i> Interval</label>
<input type="text" id="node-input-interval" placeholder="0 - 15">
<p>Minimum delay between threshold messages in minutes to prevent osciliation .
</div>
<div class="form-row">
<label for="node-input-max"><i class="fa fa-wrench"></i> Max</label>
<input type="text" id="node-input-max" placeholder="80">
<p>Threshold upper limit.
</div>
<div class="form-row">
<label for="node-input-payloadtype"><i class="fa fa-wrench"></i> Payload type</label>
<select type="text" id="node-input-payloadtype" style="display: inline-block; vertical-align: top;">
<option value="literal">literal</option>
<option value="boolean">boolean</option>
<option value="numeric">numeric</option>
</select>
<p>Type of the payload for threshold msg
<p>literal - ON/OFF, boolean - true/false, numeric - 1/0
</div>
<div class="form-row" align=left>
<label for="node-input-invert"><i class="fa fa-random"></i> Invert payload</label>
<div> <input type="checkbox" id="node-input-invert" style="display:inline-block; width:20px; vertical-align:baseline;"> Invert payload</div>
</div>
</script>
<script type="text/x-red" data-help-name="self-adjusting-threshold">
<p>Self adjusting threshold to control humidity in multiple zones with single exhoust ventilator</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">number</span>
</dt>
<dd> measured humidity Input is validated to be a number between 0 and 100</dd>
<dt class="optional">topic <span class="property-type">string</span></dt>
<dd> Identifier for zone. Required if node used for multiple zones</dd>
</dl>
<dl class="message-properties">
<dt>payload
<span class="property-type">string</span>
</dt>
<dt>
<dd>use <code>"clear"</code> to whipe collected data</dd>
<dd>use <code>"status"</code> to to ask current conditions.
Message is routed to first output.
</dd>
</dt>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Threshold value
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>Threshold value of zone.Calculated hourly, emitted if changed</dd>
<dt>topic <span class="property-type">string</span></dt>
<dd>Identifier for zone.</dd>
</dl>
</li>
<li>Control output
<dl class="message-properties">
<dt>payload <span class="property-type">number|string|boolean</span></dt>
<dd>Calculated state for device (ventilator). Payload type by choosed option. Calculated on
every input. Emitted if changed.
</dd>
</dl>
</li>
</ol>
<h3>Details</h3>
<p>Working principle</p>
<p>This node is dedicated to control single exhoust ventilator. If that ventilator takes care of multiple zones
and zones have their own humidity sensors installed, zones can have different thresholds.
</p>
<p>Threshold for every zone adjusted hourly. New value is calculated based on long term storage of collected
humidity values per every zone.
</p>
<p>State considered to be <b>over</b> the limit if humidity value of <b>any</b> of zones is over it's threshold.
<p>State considered to be <b>under</b> the limit if humidity values of <b>all</b> the zones are under the threshold.
<p>Output can be configured to emit opposite value.</p>
<p>For best results, input should be given about with 1 minute interval per zone and Period should be configured as long as reasonable.
</script>