dial_a_device_node 0.0.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +674 -0
- data/README.md +94 -0
- data/Rakefile +1 -0
- data/app/assets/images/denver_summit.jpg +0 -0
- data/app/assets/images/eppendorf_innova_42.jpg +0 -0
- data/app/assets/images/heidolph.jpg +0 -0
- data/app/assets/images/ika_ret_control.jpg +0 -0
- data/app/assets/images/kern.jpg +0 -0
- data/app/assets/images/knf_rc900.jpg +0 -0
- data/app/assets/images/knf_sc920.jpg +0 -0
- data/app/assets/images/knf_simdos_02.jpg +0 -0
- data/app/assets/images/pce_balance.jpg +0 -0
- data/app/assets/images/purebeaglebone.jpg +0 -0
- data/app/assets/images/weathercape.jpg +0 -0
- data/app/assets/javascripts/dial_a_device_node/consolelogger.js +176 -0
- data/app/assets/javascripts/dial_a_device_node/deviceconnection.js +225 -0
- data/app/assets/javascripts/dial_a_device_node/devices/denver_summit.js +153 -0
- data/app/assets/javascripts/dial_a_device_node/devices/denver_summit_SIM.js +111 -0
- data/app/assets/javascripts/dial_a_device_node/devices/denver_summit_UI.js +121 -0
- data/app/assets/javascripts/dial_a_device_node/devices/eppendorf_innova_42.js +128 -0
- data/app/assets/javascripts/dial_a_device_node/devices/eppendorf_innova_42_SIM.js +66 -0
- data/app/assets/javascripts/dial_a_device_node/devices/eppendorf_innova_42_UI.js +46 -0
- data/app/assets/javascripts/dial_a_device_node/devices/heidolph.js +62 -0
- data/app/assets/javascripts/dial_a_device_node/devices/heidolph_SIM.js +24 -0
- data/app/assets/javascripts/dial_a_device_node/devices/heidolph_UI.js +17 -0
- data/app/assets/javascripts/dial_a_device_node/devices/ika_ret_control.js +192 -0
- data/app/assets/javascripts/dial_a_device_node/devices/ika_ret_control_SIM.js +233 -0
- data/app/assets/javascripts/dial_a_device_node/devices/ika_ret_control_UI.js +96 -0
- data/app/assets/javascripts/dial_a_device_node/devices/kern.js +137 -0
- data/app/assets/javascripts/dial_a_device_node/devices/kern_SIM.js +118 -0
- data/app/assets/javascripts/dial_a_device_node/devices/kern_UI.js +121 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_rc900.js +289 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_rc900_SIM.js +188 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_rc900_UI.js +179 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_sc920.js +309 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_sc920_SIM.js +298 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_sc920_UI.js +441 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_simdos_02.js +283 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_simdos_02_SIM.js +130 -0
- data/app/assets/javascripts/dial_a_device_node/devices/knf_simdos_02_UI.js +188 -0
- data/app/assets/javascripts/dial_a_device_node/devices/legacy_vnc.js +106 -0
- data/app/assets/javascripts/dial_a_device_node/devices/legacy_vnc_SIM.js +32 -0
- data/app/assets/javascripts/dial_a_device_node/devices/legacy_vnc_UI.js +26 -0
- data/app/assets/javascripts/dial_a_device_node/devices/pce_balance.js +111 -0
- data/app/assets/javascripts/dial_a_device_node/devices/pce_balance_SIM.js +80 -0
- data/app/assets/javascripts/dial_a_device_node/devices/pce_balance_UI.js +69 -0
- data/app/assets/javascripts/dial_a_device_node/devices/purebeaglebone.js +286 -0
- data/app/assets/javascripts/dial_a_device_node/devices/purebeaglebone_SIM.js +13 -0
- data/app/assets/javascripts/dial_a_device_node/devices/purebeaglebone_UI.js +256 -0
- data/app/assets/javascripts/dial_a_device_node/devices/weathercape.js +75 -0
- data/app/assets/javascripts/dial_a_device_node/devices/weathercape_SIM.js +33 -0
- data/app/assets/javascripts/dial_a_device_node/devices/weathercape_UI.js +42 -0
- data/app/assets/javascripts/dial_a_device_node/folderwatcher.js +43 -0
- data/app/assets/javascripts/dial_a_device_node/helper/WebSocket-Node-wrapper.js +36 -0
- data/app/assets/javascripts/dial_a_device_node/helper/XMLHttpRequest.js +579 -0
- data/app/assets/javascripts/dial_a_device_node/helper/agent.js +125 -0
- data/app/assets/javascripts/dial_a_device_node/helper/ajax.js +300 -0
- data/app/assets/javascripts/dial_a_device_node/helper/type.js +10 -0
- data/app/assets/javascripts/dial_a_device_node/php/comport.php +49 -0
- data/app/assets/javascripts/dial_a_device_node/php/php_serial.class.php +622 -0
- data/app/assets/javascripts/dial_a_device_node/systemstatus.js +124 -0
- data/app/assets/javascripts/dial_a_device_node/webconnection.js +197 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/abstract_connection.js.coffee +45 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/channel.js.coffee +70 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/event.js.coffee +42 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/http_connection.js.coffee +89 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/websocket_connection.js.coffee +37 -0
- data/app/assets/javascripts/dial_a_device_node/websocket_rails/websocket_rails.js.coffee +164 -0
- data/app/views/devices/ui/_denver_summit.html.erb +52 -0
- data/app/views/devices/ui/_eppendorf_innova_42.html.erb +72 -0
- data/app/views/devices/ui/_heidolph.html.erb +54 -0
- data/app/views/devices/ui/_ika_ret_control.html.erb +81 -0
- data/app/views/devices/ui/_kern.html.erb +52 -0
- data/app/views/devices/ui/_knf_rc900.html.erb +143 -0
- data/app/views/devices/ui/_knf_sc920.html.erb +194 -0
- data/app/views/devices/ui/_knf_simdos_02.html.erb +98 -0
- data/app/views/devices/ui/_pce_balance.html.erb +37 -0
- data/app/views/devices/ui/_purebeaglebone.html.erb +137 -0
- data/app/views/devices/ui/_weathercape.html.erb +313 -0
- data/beaglebonechip.js +57 -0
- data/dial-a-device-web.js +84 -0
- data/dial_a_device_node.gemspec +23 -0
- data/dial_a_device_node.js +419 -0
- data/lib/dial_a_device_node.rb +6 -0
- data/lib/dial_a_device_node/version.rb +3 -0
- data/package.json +35 -0
- data/start.js +40 -0
- metadata +161 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
(function (exports) {
|
|
2
|
+
|
|
3
|
+
var device_model_simulation = {
|
|
4
|
+
|
|
5
|
+
runmode: '0',
|
|
6
|
+
pressure: '1013',
|
|
7
|
+
setpoint: '300',
|
|
8
|
+
power: '10',
|
|
9
|
+
ventilation: '0',
|
|
10
|
+
coolant: '0',
|
|
11
|
+
runtime: '0.0',
|
|
12
|
+
pressureunit: '0',
|
|
13
|
+
jashon: [{
|
|
14
|
+
"jso_time": "52",
|
|
15
|
+
"jso_pressure": "20",
|
|
16
|
+
"jso_coolant": "2"
|
|
17
|
+
}, {
|
|
18
|
+
"jso_time": "34",
|
|
19
|
+
"jso_pressure": "54",
|
|
20
|
+
"jso_coolant": "1"
|
|
21
|
+
}, {
|
|
22
|
+
"jso_time": "68",
|
|
23
|
+
"jso_pressure": "44",
|
|
24
|
+
"jso_coolant": "2"
|
|
25
|
+
}, {
|
|
26
|
+
"jso_time": "69",
|
|
27
|
+
"jso_pressure": "89",
|
|
28
|
+
"jso_coolant": "2"
|
|
29
|
+
}, {
|
|
30
|
+
"jso_time": "15",
|
|
31
|
+
"jso_pressure": "89",
|
|
32
|
+
"jso_coolant": "1"
|
|
33
|
+
}, {
|
|
34
|
+
"jso_time": "78",
|
|
35
|
+
"jso_pressure": "55",
|
|
36
|
+
"jso_coolant": "2"
|
|
37
|
+
}, {
|
|
38
|
+
"jso_time": "98",
|
|
39
|
+
"jso_pressure": "21",
|
|
40
|
+
"jso_coolant": "2"
|
|
41
|
+
}, {
|
|
42
|
+
"jso_time": "96",
|
|
43
|
+
"jso_pressure": "85",
|
|
44
|
+
"jso_coolant": "1"
|
|
45
|
+
}, {
|
|
46
|
+
"jso_time": "75",
|
|
47
|
+
"jso_pressure": "18",
|
|
48
|
+
"jso_coolant": "2"
|
|
49
|
+
}, {
|
|
50
|
+
"jso_time": "87",
|
|
51
|
+
"jso_pressure": "10",
|
|
52
|
+
"jso_coolant": "1"
|
|
53
|
+
}, {
|
|
54
|
+
"jso_time": "98",
|
|
55
|
+
"jso_pressure": "25",
|
|
56
|
+
"jso_coolant": "2"
|
|
57
|
+
}, {
|
|
58
|
+
"jso_time": "32",
|
|
59
|
+
"jso_pressure": "19",
|
|
60
|
+
"jso_coolant": "1"
|
|
61
|
+
}],
|
|
62
|
+
pumpengine: false
|
|
63
|
+
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.init = function (eventbus) {
|
|
67
|
+
|
|
68
|
+
setInterval(function () {
|
|
69
|
+
|
|
70
|
+
eventbus.emit('ui.update', {
|
|
71
|
+
"component": "all",
|
|
72
|
+
"model": device_model_simulation
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
eventbus.emit('device.snapshot', device_model_simulation);
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
}, 1000);
|
|
79
|
+
|
|
80
|
+
eventbus.emit("serial.simulation");
|
|
81
|
+
eventbus.emit("serial.portopened");
|
|
82
|
+
|
|
83
|
+
setInterval(function () {
|
|
84
|
+
|
|
85
|
+
// simulation tick
|
|
86
|
+
|
|
87
|
+
if (device_model_simulation.pumpengine) {
|
|
88
|
+
|
|
89
|
+
var rt = parseFloat(device_model_simulation.runtime) + 0.5;
|
|
90
|
+
device_model_simulation.runtime = rt;
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
} else {
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (device_model_simulation.ventilation == 0) {
|
|
99
|
+
|
|
100
|
+
if ((device_model_simulation.runmode == 0) && (device_model_simulation.pumpengine)) {
|
|
101
|
+
// Evacuation
|
|
102
|
+
var oldpressure = parseInt(device_model_simulation.pressure);
|
|
103
|
+
var newpressure = oldpressure - 20;
|
|
104
|
+
if (newpressure <= 0) {
|
|
105
|
+
newpressure = 0;
|
|
106
|
+
}
|
|
107
|
+
device_model_simulation.pressure = newpressure.toString();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if ((device_model_simulation.runmode == 1) && (device_model_simulation.pumpengine)) {
|
|
111
|
+
// Pressure control
|
|
112
|
+
var oldpressure = parseInt(device_model_simulation.pressure);
|
|
113
|
+
|
|
114
|
+
var newpressure = oldpressure;
|
|
115
|
+
|
|
116
|
+
if (oldpressure < device_model_simulation.setpoint) {
|
|
117
|
+
newpressure = oldpressure + 20;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (oldpressure > device_model_simulation.setpoint) {
|
|
121
|
+
newpressure = oldpressure - 20;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (Math.abs(oldpressure - newpressure) < 20) {
|
|
125
|
+
newpressure = device_model_simulation.setpoint;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
device_model_simulation.pressure = newpressure.toString();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
} else {
|
|
132
|
+
// Increase pressure, because ventilation is open
|
|
133
|
+
var oldpressure = parseInt(device_model_simulation.pressure);
|
|
134
|
+
var newpressure = oldpressure + 300;
|
|
135
|
+
if (newpressure > 1013) {
|
|
136
|
+
newpressure = 1013;
|
|
137
|
+
}
|
|
138
|
+
device_model_simulation.pressure = newpressure.toString();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
}, 500);
|
|
142
|
+
|
|
143
|
+
eventbus.emit("serial.simulation");
|
|
144
|
+
eventbus.emit("serial.portopened");
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
if (typeof String.prototype.startsWith != 'function') {
|
|
148
|
+
String.prototype.startsWith = function (str) {
|
|
149
|
+
return this.indexOf(str) == 0;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
eventbus.on("serial.command", function (message) {
|
|
154
|
+
|
|
155
|
+
var value = "1";
|
|
156
|
+
|
|
157
|
+
// get
|
|
158
|
+
|
|
159
|
+
if (message.startsWith('pP')) {
|
|
160
|
+
value = device_model_simulation.runtime + ";" + device_model_simulation.pressure + ";" + device_model_simulation.setpoint + ";" + device_model_simulation.power + ";" + " 50";
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (message.startsWith('gM')) {
|
|
164
|
+
value = device_model_simulation.runmode + ";" + " 1";
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (message.startsWith('gUp')) {
|
|
168
|
+
value = device_model_simulation.pressureunit + ";" + " 1";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (message.startsWith('gV')) {
|
|
172
|
+
value = device_model_simulation.ventilation + ";" + " 1";
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (message.startsWith('gW')) {
|
|
176
|
+
value = device_model_simulation.coolant + ";" + " 1";
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (message.startsWith('gFv')) {
|
|
180
|
+
value = "1";
|
|
181
|
+
value = message.substr(3);
|
|
182
|
+
splitter = value.split(';');
|
|
183
|
+
index_chk = parseInt(splitter[0].trim());
|
|
184
|
+
value = index_chk + ";" + device_model_simulation.jashon[index_chk].jso_time + ";" + device_model_simulation.jashon[index_chk].jso_pressure + " ; " + device_model_simulation.jashon[index_chk].jso_coolant + ";1";
|
|
185
|
+
}
|
|
186
|
+
// set
|
|
187
|
+
|
|
188
|
+
if (message.startsWith('cM')) {
|
|
189
|
+
d = message.substr(2);
|
|
190
|
+
|
|
191
|
+
switch (d) {
|
|
192
|
+
|
|
193
|
+
case 'n':
|
|
194
|
+
d = "0";
|
|
195
|
+
|
|
196
|
+
break;
|
|
197
|
+
case 'r':
|
|
198
|
+
d = "1";
|
|
199
|
+
break;
|
|
200
|
+
case 'a':
|
|
201
|
+
d = "2";
|
|
202
|
+
break;
|
|
203
|
+
case 'f':
|
|
204
|
+
d = "3";
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
device_model_simulation.runmode = d;
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (message.startsWith('cUp')) {
|
|
213
|
+
d = message.substr(3);
|
|
214
|
+
device_model_simulation.pressureunit = d;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (message.startsWith('dV')) {
|
|
218
|
+
d = message.substr(2);
|
|
219
|
+
device_model_simulation.ventilation = d;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (message.startsWith('dW')) {
|
|
223
|
+
d = message.substr(2);
|
|
224
|
+
device_model_simulation.coolant = d;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (message.startsWith('dB')) {
|
|
228
|
+
device_model_simulation.pumpengine = true;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (message.startsWith('dE')) {
|
|
232
|
+
device_model_simulation.pumpengine = false;
|
|
233
|
+
device_model_simulation.runtime = "0.0";
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (message.startsWith('cS')) {
|
|
237
|
+
|
|
238
|
+
d = message.substr(2);
|
|
239
|
+
device_model_simulation.power = d;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (message.startsWith('cC')) {
|
|
243
|
+
|
|
244
|
+
d = message.substr(2);
|
|
245
|
+
|
|
246
|
+
device_model_simulation.setpoint = d;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (message.startsWith('cFs')) {
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
d = message.substr(3);
|
|
253
|
+
splitter = d.split(';');
|
|
254
|
+
index_chk = parseInt(splitter[0].trim());
|
|
255
|
+
|
|
256
|
+
device_model_simulation.jashon[index_chk].jso_time = splitter[1].trim();
|
|
257
|
+
device_model_simulation.jashon[index_chk].jso_pressure = splitter[2].trim();
|
|
258
|
+
device_model_simulation.jashon[index_chk].jso_coolant = splitter[3].trim();
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
if (message.startsWith('cFd')) {
|
|
265
|
+
|
|
266
|
+
d = message.substr(3);
|
|
267
|
+
splitter = d.split(';');
|
|
268
|
+
index_chk = parseInt(splitter[0].trim());
|
|
269
|
+
for (i = index_chk; i < 11; i++) {
|
|
270
|
+
device_model_simulation.jashon[i].jso_time = device_model_simulation.jashon[i + 1].jso_time;
|
|
271
|
+
device_model_simulation.jashon[i].jso_pressure = device_model_simulation.jashon[i + 1].jso_pressure;
|
|
272
|
+
device_model_simulation.jashon[i].jso_coolant = device_model_simulation.jashon[i + 1].jso_coolant;
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
device_model_simulation.jashon[11].jso_time = "";
|
|
276
|
+
device_model_simulation.jashon[11].jso_pressure = "";
|
|
277
|
+
device_model_simulation.jashon[11].jso_coolant = "";
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (message.startsWith('cFc')) {
|
|
281
|
+
|
|
282
|
+
d = message.substr(3);
|
|
283
|
+
splitter = d.split(';');
|
|
284
|
+
index_chk = parseInt(splitter[0].trim());
|
|
285
|
+
for (i = index_chk; i < 12; i++) {
|
|
286
|
+
device_model_simulation.jashon[i].jso_time = "";
|
|
287
|
+
device_model_simulation.jashon[i].jso_pressure = "";
|
|
288
|
+
device_model_simulation.jashon[i].jso_coolant = "";
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
eventbus.emit("device.reply", message, value);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
})(typeof exports == 'undefined' ? this['simulator'] = {} : exports);
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
(function (exports) {
|
|
2
|
+
|
|
3
|
+
var localeventbus;
|
|
4
|
+
|
|
5
|
+
var temp_device_model;
|
|
6
|
+
|
|
7
|
+
var datacurve = new Array();
|
|
8
|
+
|
|
9
|
+
var functionvisible = false;
|
|
10
|
+
|
|
11
|
+
exports.init = function (eventbus) {
|
|
12
|
+
|
|
13
|
+
localeventbus = eventbus;
|
|
14
|
+
|
|
15
|
+
eventbus.on("ui.update", function (data) {
|
|
16
|
+
|
|
17
|
+
temp_device_model = data.model;
|
|
18
|
+
|
|
19
|
+
runtime = parseFloat(data.model.runtime);
|
|
20
|
+
|
|
21
|
+
if (runtime > 0) {
|
|
22
|
+
$('#startstopicon').removeClass('glyphicon-play');
|
|
23
|
+
$('#startstopicon').addClass('glyphicon-stop');
|
|
24
|
+
$('#startstop').addClass('active');
|
|
25
|
+
|
|
26
|
+
$('#runmode').addClass('disabled');
|
|
27
|
+
} else {
|
|
28
|
+
$('#startstopicon').removeClass('glyphicon-stop');
|
|
29
|
+
$('#startstopicon').addClass('glyphicon-play');
|
|
30
|
+
$('#startstop').removeClass('active');
|
|
31
|
+
|
|
32
|
+
$('#runmode').removeClass('disabled');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
$('#pressure').text(data.model.pressure);
|
|
36
|
+
|
|
37
|
+
if (!$('#si_power_input').hasClass("dontupdate")) {
|
|
38
|
+
$('#si_power_input').val(parseInt(data.model.power));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!$('#si_setpoint_input').hasClass("dontupdate")) {
|
|
42
|
+
$('#si_setpoint_input').val(parseInt(data.model.setpoint));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
switch (parseInt(data.model.ventilation)) {
|
|
46
|
+
case 0:
|
|
47
|
+
$('#ventilationicon').removeClass('glyphicon-star-empty');
|
|
48
|
+
$('#ventilationicon').addClass('glyphicon-star');
|
|
49
|
+
$('#ventilationbutton').removeClass('active');
|
|
50
|
+
break;
|
|
51
|
+
|
|
52
|
+
case 1:
|
|
53
|
+
$('#ventilationicon').removeClass('glyphicon-star');
|
|
54
|
+
$('#ventilationicon').addClass('glyphicon-star-empty');
|
|
55
|
+
$('#ventilationbutton').addClass('active');
|
|
56
|
+
break;
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
switch (parseInt(data.model.coolant)) {
|
|
61
|
+
case 0:
|
|
62
|
+
$('#coolanticon').removeClass('glyphicon-star-empty');
|
|
63
|
+
$('#coolanticon').addClass('glyphicon-star');
|
|
64
|
+
$('#coolantbutton').removeClass('active');
|
|
65
|
+
break;
|
|
66
|
+
|
|
67
|
+
case 1:
|
|
68
|
+
$('#coolanticon').removeClass('glyphicon-star');
|
|
69
|
+
$('#coolanticon').addClass('glyphicon-star-empty');
|
|
70
|
+
$('#coolantbutton').addClass('active');
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
switch ((data.model.runmode)) {
|
|
75
|
+
case '0':
|
|
76
|
+
$('#runmode').text('Evacuate');
|
|
77
|
+
$("#tab2").show();
|
|
78
|
+
$("#tab3").hide();
|
|
79
|
+
$("#tab4").hide();
|
|
80
|
+
$("#container").show();
|
|
81
|
+
$('#myModal').modal('hide');
|
|
82
|
+
functionvisible = false;
|
|
83
|
+
break;
|
|
84
|
+
case '1':
|
|
85
|
+
$('#runmode').text('Pressure Control');
|
|
86
|
+
$("#tab2").hide();
|
|
87
|
+
$("#tab3").show();
|
|
88
|
+
$("#tab4").hide();
|
|
89
|
+
$("#container").show();
|
|
90
|
+
$('#myModal').modal('hide');
|
|
91
|
+
functionvisible = false;
|
|
92
|
+
break;
|
|
93
|
+
case '2':
|
|
94
|
+
$('#runmode').text('Automatic');
|
|
95
|
+
$("#tab2").hide();
|
|
96
|
+
$("#tab3").hide();
|
|
97
|
+
$("#tab4").hide();
|
|
98
|
+
$("#container").show();
|
|
99
|
+
$('#myModal').modal('hide');
|
|
100
|
+
functionvisible = false;
|
|
101
|
+
break;
|
|
102
|
+
case '3':
|
|
103
|
+
$('#runmode').text('Function');
|
|
104
|
+
$("#tab2").hide();
|
|
105
|
+
$("#tab3").hide();
|
|
106
|
+
$("#tab4").show();
|
|
107
|
+
$("#container").show();
|
|
108
|
+
eventbus.emit("device.update.list", [data.model]);
|
|
109
|
+
functionvisible = true;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
switch (parseInt(data.model.pressureunit)) {
|
|
114
|
+
case 0:
|
|
115
|
+
$('#unitpressure').text('mbar');
|
|
116
|
+
break;
|
|
117
|
+
case 1:
|
|
118
|
+
$('#unitpressure').text('bar');
|
|
119
|
+
break;
|
|
120
|
+
case 2:
|
|
121
|
+
$('#unitpressure').text('hPa');
|
|
122
|
+
break;
|
|
123
|
+
case 3:
|
|
124
|
+
$('#unitpressure').text('Torr');
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
eventbus.on("ui.update.functionrow", function (index, device_model) {
|
|
132
|
+
temp_device_model = device_model;
|
|
133
|
+
|
|
134
|
+
var clock = parseInt(temp_device_model.jashon[index].jso_time);
|
|
135
|
+
var c_date = new Date(clock * 1000);
|
|
136
|
+
var c_hour = parseInt(c_date.getHours()) - 16;
|
|
137
|
+
var c_minute = c_date.getMinutes();
|
|
138
|
+
var c_second = c_date.getSeconds();
|
|
139
|
+
document.getElementById('tbl').rows[index].cells[0].innerHTML = c_hour + ":" + c_minute + ":" + c_second;
|
|
140
|
+
document.getElementById('tbl').rows[index].cells[1].innerHTML = temp_device_model.jashon[index].jso_pressure;
|
|
141
|
+
document.getElementById('tbl').rows[index].cells[2].innerHTML = temp_device_model.jashon[index].jso_coolant;
|
|
142
|
+
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
eventbus.on("ui.refreshdatacurve", function (datac) {
|
|
146
|
+
datacurve = datac;
|
|
147
|
+
ui.updateChart();
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
exports.setPressureunit = function setPressureunit(data) {
|
|
153
|
+
|
|
154
|
+
localeventbus.emit("ui.command", {
|
|
155
|
+
"command": "setpressureunit",
|
|
156
|
+
"value": data
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
exports.setRunmode = function setRunmode(data) {
|
|
161
|
+
|
|
162
|
+
localeventbus.emit("ui.command", {
|
|
163
|
+
"command": "setrunmode",
|
|
164
|
+
"value": data
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
exports.setVentilation = function setVentilation(data) {
|
|
169
|
+
|
|
170
|
+
localeventbus.emit("ui.command", {
|
|
171
|
+
"command": "setventilation",
|
|
172
|
+
"value": data
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
exports.setCoolant = function setCoolant(data) {
|
|
177
|
+
|
|
178
|
+
localeventbus.emit("ui.command", {
|
|
179
|
+
"command": "setcoolant",
|
|
180
|
+
"value": data
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
exports.toggleStartstop = function toggleStartstop() {
|
|
185
|
+
if ($('#startstop').hasClass('active')) {
|
|
186
|
+
data = 'E';
|
|
187
|
+
} else {
|
|
188
|
+
data = 'B';
|
|
189
|
+
}
|
|
190
|
+
localeventbus.emit("ui.command", {
|
|
191
|
+
"command": "setstartstop",
|
|
192
|
+
"value": data
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
exports.toggleVentilation = function toggleVentilation() {
|
|
198
|
+
if ($('#ventilationbutton').hasClass('active')) {
|
|
199
|
+
data = '0';
|
|
200
|
+
} else {
|
|
201
|
+
data = '1';
|
|
202
|
+
}
|
|
203
|
+
localeventbus.emit("ui.command", {
|
|
204
|
+
"command": "setventilation",
|
|
205
|
+
"value": data
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
exports.toggleCoolant = function toggleCoolant() {
|
|
210
|
+
if ($('#coolantbutton').hasClass('active')) {
|
|
211
|
+
data = '0';
|
|
212
|
+
} else {
|
|
213
|
+
data = '1';
|
|
214
|
+
}
|
|
215
|
+
localeventbus.emit("ui.command", {
|
|
216
|
+
"command": "setcoolant",
|
|
217
|
+
"value": data
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
exports.setPower = function setPower(data) {
|
|
223
|
+
localeventbus.emit("ui.command", {
|
|
224
|
+
"command": "setpower",
|
|
225
|
+
"value": data
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
exports.setSetpoint = function setSetpoint(data) {
|
|
231
|
+
localeventbus.emit("ui.command", {
|
|
232
|
+
"command": "setsetpoint",
|
|
233
|
+
"value": data
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
exports.edit_cell = function edit_cell(row) {
|
|
242
|
+
var t_row = row;
|
|
243
|
+
document.getElementById("j_t").value = temp_device_model.jashon[t_row].jso_time;
|
|
244
|
+
document.getElementById("j_p").value = temp_device_model.jashon[t_row].jso_pressure;
|
|
245
|
+
document.getElementById("j_c").value = temp_device_model.jashon[t_row].jso_coolant;
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
//document.getElementById("r_t").value = temp_device_model.jashon[t_row].jso_time;
|
|
250
|
+
//document.getElementById("r_p").value = temp_device_model.jashon[t_row].jso_pressure;
|
|
251
|
+
|
|
252
|
+
$('#row').val(parseInt(row));
|
|
253
|
+
$('#myModal').modal('show');
|
|
254
|
+
g_row = row;
|
|
255
|
+
if (temp_device_model.jashon[t_row].jso_coolant == 10) {
|
|
256
|
+
document.getElementById('rad2').checked = true;
|
|
257
|
+
} else {
|
|
258
|
+
document.getElementById('rad').checked = true;
|
|
259
|
+
document.getElementById("j_coo").style.visibility = "visible";
|
|
260
|
+
}
|
|
261
|
+
// $('#myModal').modal('show');
|
|
262
|
+
//var prompty = prompt("enter value","0");
|
|
263
|
+
//localeventbus.emit ("device.set.pressure", [row],[column],[prompty]);
|
|
264
|
+
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
exports.inc_func = function inc_func() {
|
|
269
|
+
// $('#myModal').modal('show');
|
|
270
|
+
//var prompty = prompt("enter value","0");
|
|
271
|
+
//localeventbus.emit ("device.set.pressure", [row],[column],[prompty]);
|
|
272
|
+
for (i = 0; i < 12; i++) {
|
|
273
|
+
localeventbus.emit("device.set.inc_func", [i]);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
exports.save_row = function save_row() {
|
|
279
|
+
g_row = document.getElementById('row').value;
|
|
280
|
+
var temp = g_row;
|
|
281
|
+
|
|
282
|
+
//xjason[temp].jso_time
|
|
283
|
+
|
|
284
|
+
var time_copier = $("input#j_t").val();
|
|
285
|
+
//xjason[temp].jso_pressure
|
|
286
|
+
var pressure_copier = $("input#j_p").val();
|
|
287
|
+
//xjason[temp].jso_coolant
|
|
288
|
+
var coolant_copier = $("input#j_c").val();
|
|
289
|
+
|
|
290
|
+
var q3 = parseInt(coolant_copier);
|
|
291
|
+
var q2 = parseInt(pressure_copier);
|
|
292
|
+
var q1 = parseInt(time_copier);
|
|
293
|
+
document.getElementById('rad').checked = true;
|
|
294
|
+
localeventbus.emit("device.set.function", [temp, time_copier, pressure_copier, coolant_copier]);
|
|
295
|
+
|
|
296
|
+
//console.log(jason);
|
|
297
|
+
// $('#myModal').modal('show')
|
|
298
|
+
//var prompty = prompt("enter value","0");
|
|
299
|
+
//localeventbus.emit ("device.set.pressure", [row],[column],[prompty]);
|
|
300
|
+
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
exports.delete1 = function delete1() {
|
|
305
|
+
g_row = document.getElementById('row').value;
|
|
306
|
+
for (i = g_row; i < 12; i++) {
|
|
307
|
+
//xjason[i].jso_time = xjason[i+1].jso_time;
|
|
308
|
+
//xjason[i].jso_pressure = xjason[i+1].jso_pressure;
|
|
309
|
+
//xjason[i].jso_coolant = xjason[i+1].jso_coolant;
|
|
310
|
+
}
|
|
311
|
+
//xjason[11].jso_time = "";
|
|
312
|
+
//xjason[11].jso_pressure = "";
|
|
313
|
+
//xjason[11].jso_coolant = "";
|
|
314
|
+
|
|
315
|
+
localeventbus.emit("device.del1.function", [g_row]);
|
|
316
|
+
alert('deleted');
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
exports.deleteAll = function deleteAll() {
|
|
320
|
+
g_row = document.getElementById('row').value;
|
|
321
|
+
for (i = g_row; i < 12; i++) {
|
|
322
|
+
//xjason[i].jso_time = "";
|
|
323
|
+
//xjason[i].jso_pressure = "";
|
|
324
|
+
//xjason[i].jso_coolant = "";
|
|
325
|
+
}
|
|
326
|
+
localeventbus.emit("device.delAll.function", [g_row]);
|
|
327
|
+
alert('deleted');
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
exports.handleChange2 = function handleChange2() {
|
|
331
|
+
document.getElementById("j_coo").style.visibility = "hidden";
|
|
332
|
+
document.getElementById("j_c").value = "10";
|
|
333
|
+
document.getElementById('rad2').checked = true;
|
|
334
|
+
}
|
|
335
|
+
exports.handleChange1 = function handleChange1() {
|
|
336
|
+
document.getElementById("j_coo").style.visibility = "visible";
|
|
337
|
+
|
|
338
|
+
//document.getElementById("j_c").value="10";
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
exports.getData = function getData() {
|
|
342
|
+
|
|
343
|
+
var myarray = new Array();
|
|
344
|
+
|
|
345
|
+
if (functionvisible) {
|
|
346
|
+
|
|
347
|
+
var myrow = new Array();
|
|
348
|
+
var mycell = new Array();
|
|
349
|
+
myrow[0] = parseInt(temp_device_model.jashon[0].jso_time);
|
|
350
|
+
mycell[0] = parseInt(temp_device_model.jashon[0].jso_pressure);
|
|
351
|
+
for (i = 1; i < 12; i++) {
|
|
352
|
+
myrow[i] = myrow[i - 1] + parseInt(temp_device_model.jashon[i].jso_time);
|
|
353
|
+
mycell[i] = parseInt(temp_device_model.jashon[i].jso_pressure);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
myarray.push({
|
|
357
|
+
name: 'Function',
|
|
358
|
+
animation: false,
|
|
359
|
+
// Define the data points. All series have a dummy year
|
|
360
|
+
// of 1970/71 in order to be compared on the same x axis. Note
|
|
361
|
+
// that in JavaScript, months start at 0 for January, 1 for February etc.
|
|
362
|
+
data: [
|
|
363
|
+
[myrow[0], mycell[0]],
|
|
364
|
+
[myrow[1], mycell[1]],
|
|
365
|
+
[myrow[2], mycell[2]],
|
|
366
|
+
[myrow[3], mycell[3]],
|
|
367
|
+
[myrow[4], mycell[4]],
|
|
368
|
+
[myrow[5], mycell[5]],
|
|
369
|
+
[myrow[6], mycell[6]],
|
|
370
|
+
[myrow[7], mycell[7]],
|
|
371
|
+
[myrow[8], mycell[8]],
|
|
372
|
+
[myrow[9], mycell[9]],
|
|
373
|
+
[myrow[10], mycell[10]],
|
|
374
|
+
[myrow[11], mycell[11]]
|
|
375
|
+
]
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
myarray.push({
|
|
380
|
+
name: 'Data',
|
|
381
|
+
animation: false,
|
|
382
|
+
// Define the data points. All series have a dummy year
|
|
383
|
+
// of 1970/71 in order to be compared on the same x axis. Note
|
|
384
|
+
// that in JavaScript, months start at 0 for January, 1 for February etc.
|
|
385
|
+
data: datacurve
|
|
386
|
+
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
return myarray;
|
|
390
|
+
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
exports.updateChart = function () {
|
|
394
|
+
|
|
395
|
+
$('#container').highcharts({
|
|
396
|
+
chart: {
|
|
397
|
+
type: 'spline',
|
|
398
|
+
animation: false,
|
|
399
|
+
events: {
|
|
400
|
+
load: function () {
|
|
401
|
+
setInterval(function () {
|
|
402
|
+
series = ui.getData();
|
|
403
|
+
}, 1000);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
title: {
|
|
408
|
+
text: 'Pressure'
|
|
409
|
+
},
|
|
410
|
+
exporting: {
|
|
411
|
+
enabled: false
|
|
412
|
+
},
|
|
413
|
+
xAxis: {
|
|
414
|
+
type: 'datetime',
|
|
415
|
+
dateTimeLabelFormats: { // don't display the dummy year
|
|
416
|
+
//month: '%e. %b',
|
|
417
|
+
//year: '%b',
|
|
418
|
+
hour: '%H:%M',
|
|
419
|
+
//second: '%H:%M:%S',
|
|
420
|
+
//minute: '%H:%M'
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
yAxis: {
|
|
424
|
+
title: {
|
|
425
|
+
text: 'Pressure'
|
|
426
|
+
},
|
|
427
|
+
min: 0
|
|
428
|
+
},
|
|
429
|
+
tooltip: {
|
|
430
|
+
formatter: function () {
|
|
431
|
+
return '<b>' + this.series.name + '</b><br/>' + Highcharts.dateFormat('%H:%M:%S', this.x * 1000) + ': ' + this.y + ' m';
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
|
|
435
|
+
series: ui.getData()
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
})(typeof exports == 'undefined' ? this['ui'] = {} : exports);
|