dial_a_device_node 0.0.153 → 0.0.154

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2817cfa9d041a0591217fd74a41b76edf116c87a
4
- data.tar.gz: e1f9fc34d7b650f32cd5cacc9487f7d0ee2d2724
3
+ metadata.gz: c38a708fc864a89ae0257449f4c17a753fef9779
4
+ data.tar.gz: 013644118960d53fd43fa420333b0103e6474f88
5
5
  SHA512:
6
- metadata.gz: 32618cacc9a12bd1c358c0155e6292a20f6eced5d2c2527c6c707d8d01d0d50c156f9475d21f7e8c067337ce935a6c8184212f1a9d22f1894fb8da51bf2a8fa5
7
- data.tar.gz: e88e2af6d245427ac87756eb0dc5d33328908ab10452939e6bb2cb6fbac28817dba68d8204cdd4a7d3138cbc8bccaa35df49b5af28207812247b10ce62ef2ad5
6
+ metadata.gz: aaba9a468595786b46f2f09484aa03e496e846aa862c9dfaef3dc95a2f9a36f7b3e83db5083c0fd880a886b53eb8c89ff9040ebcbb9cccfb3742670a2597d055
7
+ data.tar.gz: 98f2bf5503400e76de6e150722f0a5bf399e94386b78962a466d0f22404bda170e07636f62cc9e5ba3a3c0aab0a5c5e127c14b6294482504af455e598f2cb781
@@ -0,0 +1,270 @@
1
+ (function (exports) {
2
+
3
+ var device_model = {
4
+
5
+ pump_engine: 0,
6
+ in_line_valve: 0,
7
+ coolant_valve: 0,
8
+ venting_valve: 0,
9
+ operation_mode: 1,
10
+
11
+ current_pressure: 0.0,
12
+ current_speed: "HI",
13
+ process_runtime: "0:0",
14
+ pressuresetpoint: 0,
15
+ speedsetpoint: "HI",
16
+
17
+ language: 1,
18
+ pressureunit: 0,
19
+ autostart: 0,
20
+ acousticsignal: 0
21
+
22
+ };
23
+
24
+ exports.init = function (eventbus) {
25
+
26
+ if (typeof String.prototype.startsWith != 'function') {
27
+ String.prototype.startsWith = function (str) {
28
+ return this.indexOf(str) == 0;
29
+ };
30
+ }
31
+
32
+
33
+ eventbus.on("serial.portopened", function () {
34
+
35
+
36
+ setTimeout(function () {
37
+
38
+ eventbus.emit("serial.immediatecommand", "REMOTE 1");
39
+ eventbus.emit("serial.immediatecommand", "CVC 3");
40
+ eventbus.emit("serial.immediatecommand", "STORE");
41
+
42
+ eventbus.emit("serial.command", "IN_VER");
43
+
44
+
45
+ }, 500);
46
+
47
+
48
+
49
+ });
50
+
51
+
52
+ eventbus.on("device.heartbeat", function () {
53
+
54
+ localeventbus.emit("device.command", {
55
+ "command": "get_stat"
56
+ });
57
+
58
+ localeventbus.emit("device.command", {
59
+ "command": "get_pressure"
60
+ });
61
+
62
+ localeventbus.emit("device.command", {
63
+ "command": "get_speed"
64
+ });
65
+
66
+ localeventbus.emit("device.command", {
67
+ "command": "get_time"
68
+ });
69
+
70
+ localeventbus.emit("device.command", {
71
+ "command": "get_pressuresetpoint"
72
+ });
73
+
74
+ localeventbus.emit("device.command", {
75
+ "command": "get_speedsetpoint"
76
+ });
77
+
78
+
79
+ eventbus.emit('ui.update', {
80
+ "component": "all",
81
+ "model": device_model
82
+ });
83
+
84
+ eventbus.emit('device.snapshot', device_model);
85
+
86
+ });
87
+
88
+
89
+ eventbus.on("device.command", function (data) {
90
+
91
+ if (data.command == "get_stat") {
92
+
93
+ eventbus.emit("serial.command", "IN_STAT");
94
+
95
+ }
96
+
97
+ if (data.command == "get_pressure") {
98
+
99
+ eventbus.emit("serial.command", "IN_PV_1");
100
+
101
+ }
102
+
103
+ if (data.command == "get_speed") {
104
+
105
+ eventbus.emit("serial.command", "IN_PV_2");
106
+
107
+ }
108
+
109
+ if (data.command == "get_time") {
110
+
111
+ eventbus.emit("serial.command", "IN_PV_3");
112
+
113
+ }
114
+
115
+
116
+
117
+
118
+ if (data.command == "get_pressuresetpoint") {
119
+
120
+ eventbus.emit("serial.command", "IN_SP_1");
121
+
122
+ }
123
+
124
+ if (data.command == "get_speedsetpoint") {
125
+
126
+ eventbus.emit("serial.command", "IN_SP_2");
127
+
128
+ }
129
+
130
+
131
+
132
+
133
+ if (data.command == "set_pressuresetpoint") {
134
+
135
+
136
+ eventbus.emit("serial.immediatecommand", "OUT_SP_1 "+data.value.toString());
137
+
138
+ }
139
+
140
+ if (data.command == "set_speedsetpoint") {
141
+
142
+ eventbus.emit("serial.immediatecommand", "OUT_SP_2 "+data.value.toString());
143
+
144
+ }
145
+
146
+ if (data.command == "set_pressureunit") {
147
+
148
+ eventbus.emit("serial.immediatecommand", "OUT_CFG "+device_model.language.toString()+data.value.toString()+device_model.autostart.toString()+device_model.acousticsignal.toString());
149
+
150
+ }
151
+
152
+
153
+ if (data.command == "set_start") {
154
+
155
+ eventbus.emit("serial.immediatecommand", "START");
156
+
157
+ }
158
+
159
+ if (data.command == "set_stop") {
160
+
161
+ eventbus.emit("serial.immediatecommand", "STOP 0");
162
+
163
+ }
164
+
165
+ if (data.command == "toggle_ventvalve") {
166
+
167
+ if (device_model.venting_valve == 0) {
168
+
169
+ eventbus.emit("serial.immediatecommand", "OUT_VENT 1");
170
+
171
+ } else {
172
+
173
+ eventbus.emit("serial.immediatecommand", "OUT_VENT 0");
174
+
175
+ }
176
+
177
+ }
178
+
179
+ if (data.command == "set_ventvalve") {
180
+
181
+ eventbus.emit("serial.immediatecommand", "OUT_VENT "+data.value.toString());
182
+
183
+ }
184
+
185
+ if (data.command == "set_runmode") {
186
+
187
+ eventbus.emit("serial.immediatecommand", "OUT_MODE "+data.value.toString());
188
+
189
+ }
190
+
191
+
192
+ });
193
+
194
+
195
+ eventbus.on("device.reply", function (lastmessage, data) {
196
+
197
+
198
+ if (lastmessage.startsWith('IN_STAT')) {
199
+
200
+ device_model.pump_engine = parseInt(data[0]);
201
+
202
+ device_model.in_line_valve = parseInt(data[1]);
203
+
204
+ device_model.coolant_valve = parseInt(data[2]);
205
+
206
+ device_model.venting_valve = parseInt(data[3]);
207
+
208
+ device_model.operation_mode = parseInt(data[4]);
209
+
210
+ eventbus.emit('device.assumeconnected');
211
+
212
+ }
213
+
214
+ if (lastmessage.startsWith('IN_PV_1')) {
215
+
216
+ device_model.current_pressure = parseFloat(data);
217
+
218
+ }
219
+
220
+ if (lastmessage.startsWith('IN_PV_2')) {
221
+
222
+ if (data == "HI") {
223
+
224
+ device_model.current_speed = 100;
225
+
226
+
227
+ } else {
228
+
229
+ device_model.current_speed = parseInt(data);
230
+
231
+ }
232
+
233
+ }
234
+
235
+ if (lastmessage.startsWith('IN_PV_3')) {
236
+
237
+ device_model.process_runtime = data;
238
+
239
+ }
240
+
241
+
242
+ if (lastmessage.startsWith('IN_SP_1')) {
243
+
244
+ device_model.pressuresetpoint = parseFloat(data);
245
+
246
+ }
247
+
248
+ if (lastmessage.startsWith('IN_SP_2')) {
249
+
250
+ if (data == "HI") {
251
+
252
+ device_model.speedsetpoint = 100;
253
+
254
+ } else {
255
+
256
+ device_model.speedsetpoint = parseInt(data);
257
+ }
258
+
259
+ }
260
+
261
+ });
262
+
263
+
264
+ eventbus.emit("device.initialized");
265
+
266
+
267
+ };
268
+
269
+
270
+ })(typeof exports == 'undefined' ? this['device'] = {} : exports);
@@ -0,0 +1,130 @@
1
+ (function (exports) {
2
+
3
+ var device_model_simulation = {
4
+
5
+ amount: 400,
6
+ time: 1000,
7
+ timecounter: 0,
8
+ amountcounter: 0,
9
+ flowrate: 400.0,
10
+ runmode: 0,
11
+ runfunction: 0,
12
+ cyclenumber: 1,
13
+ actualcyclenumber: 1
14
+
15
+ };
16
+
17
+ exports.init = function (eventbus) {
18
+
19
+ setInterval(function () {
20
+
21
+
22
+ if (device_model_simulation.runfunction == 1) {
23
+
24
+ device_model_simulation.timecounter = device_model_simulation.timecounter + 1000;
25
+
26
+
27
+ if (device_model_simulation.runmode == 0) {
28
+
29
+
30
+ device_model_simulation.amountcounter = device_model_simulation.amountcounter + Math.round(device_model_simulation.flowrate / 60);
31
+
32
+ if (device_model_simulation.amountcounter >= device_model_simulation.amount) {
33
+
34
+ device_model_simulation.runfunction = 0;
35
+ }
36
+
37
+ }
38
+
39
+ if (device_model_simulation.runmode == 1) {
40
+
41
+
42
+ device_model_simulation.amountcounter = device_model_simulation.amountcounter + Math.round((device_model_simulation.amount / (device_model_simulation.time/1000)));
43
+
44
+ if (device_model_simulation.timecounter >= device_model_simulation.time) {
45
+
46
+ device_model_simulation.runfunction = 0;
47
+ }
48
+
49
+ }
50
+
51
+ if (device_model_simulation.runmode == 2) {
52
+
53
+
54
+ device_model_simulation.amountcounter = device_model_simulation.amountcounter + Math.round(device_model_simulation.flowrate / 60);
55
+
56
+ if (device_model_simulation.timecounter >= device_model_simulation.time) {
57
+
58
+ device_model_simulation.runfunction = 0;
59
+ }
60
+
61
+ }
62
+
63
+ }
64
+
65
+ if (device_model_simulation.runfunction == 2) {
66
+
67
+ device_model_simulation.timecounter = 2000;
68
+ device_model_simulation.runfunction = 0;
69
+ device_model_simulation.amountcounter = 175;
70
+
71
+ }
72
+
73
+ eventbus.emit('ui.update', {
74
+ "component": "all",
75
+ "model": device_model_simulation
76
+ });
77
+
78
+ eventbus.emit('device.snapshot', device_model_simulation);
79
+
80
+
81
+ }, 1000);
82
+
83
+ eventbus.emit("serial.simulation");
84
+ eventbus.emit("serial.portopened");
85
+
86
+ eventbus.on("device.command", function (data) {
87
+
88
+ if (data.command == "set_amount") {
89
+
90
+ device_model_simulation.amount = data.value;
91
+
92
+ }
93
+
94
+ if (data.command == "set_flowrate") {
95
+
96
+ device_model_simulation.flowrate = data.value;
97
+
98
+ }
99
+
100
+ if (data.command == "set_time") {
101
+
102
+ device_model_simulation.time = data.value;
103
+
104
+ }
105
+
106
+ if (data.command == "set_runmode") {
107
+
108
+ device_model_simulation.runmode = data.value;
109
+
110
+ }
111
+
112
+ if (data.command == "set_function") {
113
+
114
+ if (device_model_simulation.runfunction == 0 && data.value > 0) {
115
+
116
+ device_model_simulation.timecounter = 0;
117
+ device_model_simulation.amountcounter = 0;
118
+
119
+
120
+ }
121
+
122
+ device_model_simulation.runfunction = data.value;
123
+
124
+ }
125
+
126
+ });
127
+
128
+ };
129
+
130
+ })(typeof exports == 'undefined' ? this['simulator'] = {} : exports);
@@ -0,0 +1,150 @@
1
+ (function (exports) {
2
+
3
+
4
+ function pad(n, width, z) {
5
+ z = z || '0';
6
+ n = n + '';
7
+ return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
8
+ }
9
+
10
+
11
+
12
+ exports.init = function (eventbus) {
13
+
14
+ eventbus.on("ui.update", function (data) {
15
+
16
+
17
+ $('#pressure').text(data.model.current_pressure);
18
+
19
+ if (!$('#si_speedsetpoint_input').hasClass("dontupdate")) {
20
+ $('#si_speedsetpoint_input').val(parseInt(data.model.speedsetpoint));
21
+ }
22
+
23
+ if (!$('#si_pressuresetpoint_input').hasClass("dontupdate")) {
24
+ $('#si_pressuresetpoint_input').val(parseInt(data.model.pressuresetpoint));
25
+ }
26
+
27
+ switch (parseInt(data.model.venting_valve)) {
28
+ case 0:
29
+ $('#ventilationicon').removeClass('glyphicon-star-empty');
30
+ $('#ventilationicon').addClass('glyphicon-star');
31
+ $('#ventilationbutton').removeClass('active');
32
+ break;
33
+
34
+ case 1:
35
+ $('#ventilationicon').removeClass('glyphicon-star');
36
+ $('#ventilationicon').addClass('glyphicon-star-empty');
37
+ $('#ventilationbutton').addClass('active');
38
+ break;
39
+
40
+ }
41
+
42
+ switch ((data.model.operation_mode)) {
43
+ case 0:
44
+ $('#runmode').text('VACUU-LAN');
45
+ break;
46
+ case 1:
47
+ $('#runmode').text('Pump down');
48
+ break;
49
+ case 2:
50
+ $('#runmode').text('Vac control');
51
+ break;
52
+ }
53
+
54
+ switch (parseInt(data.model.pressure_unit)) {
55
+ case 0:
56
+ $('#unitpressure').text('mbar');
57
+ break;
58
+ case 1:
59
+ $('#unitpressure').text('Torr');
60
+ break;
61
+ case 2:
62
+ $('#unitpressure').text('hPa');
63
+ break;
64
+ }
65
+
66
+
67
+ g1.refresh(data.model.current_pressure);
68
+ g2.refresh(data.model.current_speed);
69
+
70
+
71
+ });
72
+
73
+ };
74
+
75
+ exports.setRunmode = function setRunmode(data) {
76
+
77
+ localeventbus.emit("ui.command", {
78
+ "command": "set_runmode",
79
+ "value": data
80
+ });
81
+ };
82
+
83
+
84
+ exports.start = function start() {
85
+
86
+ localeventbus.emit("ui.command", {
87
+ "command": "set_start",
88
+ "value": 1
89
+ });
90
+
91
+ };
92
+
93
+
94
+ exports.stop = function stop() {
95
+
96
+ localeventbus.emit("ui.command", {
97
+ "command": "set_stop",
98
+ "value": 0
99
+ });
100
+
101
+ };
102
+
103
+
104
+ exports.setPressureSetpoint = function setPressureSetpoint(data) {
105
+
106
+ localeventbus.emit("ui.command", {
107
+ "command": "set_pressuresetpoint",
108
+ "value": data
109
+ });
110
+
111
+ };
112
+
113
+ exports.setSpeedSetpoint = function setSpeedSetpoint(data) {
114
+
115
+ localeventbus.emit("ui.command", {
116
+ "command": "set_speedsetpoint",
117
+ "value": data
118
+ });
119
+
120
+ };
121
+
122
+ exports.setPressureUnit = function setPressureUnit(data) {
123
+
124
+ localeventbus.emit("ui.command", {
125
+ "command": "set_pressureunit",
126
+ "value": data
127
+ });
128
+
129
+ };
130
+
131
+ exports.setVentValve = function setVentValve(data) {
132
+
133
+ localeventbus.emit("ui.command", {
134
+ "command": "set_ventvalve",
135
+ "value": data
136
+ });
137
+
138
+ };
139
+
140
+ exports.toggleVentValve = function toggleVentValve() {
141
+
142
+ localeventbus.emit("ui.command", {
143
+ "command": "toggle_ventvalve"
144
+ });
145
+
146
+ };
147
+
148
+
149
+
150
+ })(typeof exports == 'undefined' ? this['ui'] = {} : exports);
@@ -0,0 +1,102 @@
1
+
2
+ <div class="row-fluid">
3
+ <div class="span12">
4
+
5
+ <span class="btn-group">
6
+ <button id="startbutton" name="startbutton" class="btn btn-success btn-large" onclick="ui.start(); "><span id="start">Start</span></button>
7
+ <button id="stopbutton" name="stopbutton" class="btn btn-error btn-large" onclick="ui.stop(); "><span id="stop">Stop</span></button>
8
+ </span>
9
+
10
+ <span class="btn-group inline">
11
+ <button id="runmodebutton" name="runmodebutton" class=" btn btn-info btn-large dropdown-toggle" data-toggle="dropdown"><span id="runmode">Evacuate</span>&nbsp;<span class="caret"></span></button>
12
+ <ul class="dropdown-menu">
13
+ <li><a href="#" onclick="ui.setRunmode(0);">VACUU-LAN</a></li>
14
+ <li><a href="#" onclick="ui.setRunmode(1);">Pump down</a></li>
15
+ <li><a href="#" onclick="ui.setRunmode(2);">Vac control</a></li>
16
+ <li><a href="#" onclick="ui.setRunmode(3);">Auto mode</a></li>
17
+ </ul>
18
+ </span>
19
+
20
+ <span class="btn-group inline">
21
+ <button id="ventilationbutton" name="ventilationbutton" class=" btn btn-success btn-large" onclick="ui.toggleVentValve();" data-toggle="button"><span id="ventilationicon" name="ventilationicon" class="glyphicon glyphicon-star" />&nbsp;<span id="coolant">Ventilation</span></button>
22
+ </span>
23
+
24
+
25
+
26
+ </div>
27
+
28
+ </div>
29
+
30
+ <br/>
31
+ <br/>
32
+
33
+
34
+
35
+
36
+ <div class="row-fluid clearfix" style="height: 160px;">
37
+
38
+
39
+
40
+ <div class="col-md-5 col-sm-5">
41
+
42
+ <div id="gauge1" class="200x160px"></div>
43
+
44
+
45
+
46
+ <div class="inline" id="si_pressuresetpoint"> </div>
47
+
48
+ <script type="text/javascript">
49
+
50
+ smartinput ("si_pressuresetpoint", function(val) {
51
+ ui.setPressureSetpoint(val);
52
+ }, "Set (mbar)");
53
+ </script>
54
+
55
+
56
+ </div>
57
+
58
+
59
+
60
+ <div class="col-md-5 col-sm-5">
61
+
62
+ <div id="gauge2" class="200x160px"></div>
63
+
64
+
65
+ <div class="inline" id="si_speedsetpoint"> </div>
66
+
67
+ <script type="text/javascript">
68
+
69
+ smartinput ("si_speedsetpoint", function(val) {
70
+ ui.setSpeedSetpoint(val);
71
+ }, "Set (%)");
72
+ </script>
73
+
74
+ </div>
75
+
76
+
77
+ </div>
78
+
79
+
80
+
81
+
82
+
83
+ <script>
84
+ var g1 = new JustGage({
85
+ id: "gauge1",
86
+ value: 0,
87
+ min: 0,
88
+ max: 1100,
89
+ title: "Pressure",
90
+ label: "mbar"
91
+ });
92
+
93
+ var g2 = new JustGage({
94
+ id: "gauge2",
95
+ value: 0,
96
+ min: 0,
97
+ max: 100,
98
+ title: "Speed",
99
+ label: "%"
100
+ });
101
+
102
+ </script>
@@ -1,3 +1,3 @@
1
1
  module DialADeviceNode
2
- VERSION = "0.0.153"
2
+ VERSION = "0.0.154"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dial-a-device-node",
3
- "version": "0.0.153",
3
+ "version": "0.0.154",
4
4
  "description": "dial-a-device-node is the device interface for dial-a-device",
5
5
  "main": "dial_a_device_node.js",
6
6
  "dependencies": {
@@ -0,0 +1,2 @@
1
+ localhost:3000
2
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dial_a_device_node
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.153
4
+ version: 0.0.154
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominic Lütjohann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,6 +60,7 @@ files:
60
60
  - app/assets/images/knf_simdos_02.jpg
61
61
  - app/assets/images/pce_balance.jpg
62
62
  - app/assets/images/purebeaglebone.jpg
63
+ - app/assets/images/vacuubrand_pc3001.jpg
63
64
  - app/assets/images/weathercape.jpg
64
65
  - app/assets/javascripts/dial_a_device_node/consolelogger.js
65
66
  - app/assets/javascripts/dial_a_device_node/deviceconnection.js
@@ -96,6 +97,9 @@ files:
96
97
  - app/assets/javascripts/dial_a_device_node/devices/purebeaglebone.js
97
98
  - app/assets/javascripts/dial_a_device_node/devices/purebeaglebone_SIM.js
98
99
  - app/assets/javascripts/dial_a_device_node/devices/purebeaglebone_UI.js
100
+ - app/assets/javascripts/dial_a_device_node/devices/vacuubrand_pc3001.js
101
+ - app/assets/javascripts/dial_a_device_node/devices/vacuubrand_pc3001_SIM.js
102
+ - app/assets/javascripts/dial_a_device_node/devices/vacuubrand_pc3001_UI.js
99
103
  - app/assets/javascripts/dial_a_device_node/devices/weathercape.js
100
104
  - app/assets/javascripts/dial_a_device_node/devices/weathercape_SIM.js
101
105
  - app/assets/javascripts/dial_a_device_node/devices/weathercape_UI.js
@@ -125,6 +129,7 @@ files:
125
129
  - app/views/devices/ui/_knf_simdos_02.html.erb
126
130
  - app/views/devices/ui/_pce_balance.html.erb
127
131
  - app/views/devices/ui/_purebeaglebone.html.erb
132
+ - app/views/devices/ui/_vacuubrand_pc3001.html.erb
128
133
  - app/views/devices/ui/_weathercape.html.erb
129
134
  - beaglebonechip.js
130
135
  - dial-a-device-web.js
@@ -133,6 +138,7 @@ files:
133
138
  - lib/dial_a_device_node.rb
134
139
  - lib/dial_a_device_node/version.rb
135
140
  - package.json
141
+ - server.txt
136
142
  - start.js
137
143
  homepage: ''
138
144
  licenses: