Subversion Repositories HomeAutomation

Rev

Rev 1765 | Rev 2271 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1765 Rev 2076
Line 205... Line 205...
205
                    if (last_value_string)
205
                    if (last_value_string)
206
                    {
206
                    {
207
                        last_value = eval("(" + last_value_string + ")");
207
                        last_value = eval("(" + last_value_string + ")");
208
                    }
208
                    }
209
                   
209
                   
210
                    last_value["Debug"] = { "P_term" : variables["P_term"],"I_term" : variables["I_term"],"D_term" : variables["D_term"],"Sum" : variables["Sum"], "timestamp" : get_time() };
210
                    last_value["Debug"] = { "value" : { "P_term" : variables["P_term"],"I_term" : variables["I_term"],"D_term" : variables["D_term"],"Sum" : variables["Sum"] }, "timestamp" : get_time() };
211
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
211
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
212
                    //Log("Got message DEBUG");
212
                    //Log("Got message DEBUG");
213
                }
213
                }
214
            break;
214
            break;
215
            case "CONFIG_SENSOR":
215
            case "CONFIG_SENSOR":
Line 221... Line 221...
221
                    if (last_value_string)
221
                    if (last_value_string)
222
                    {
222
                    {
223
                        last_value = eval("(" + last_value_string + ")");
223
                        last_value = eval("(" + last_value_string + ")");
224
                    }
224
                    }
225
                   
225
                   
226
                    last_value["Sensor"] = { "sensorModuleType" : variables["sensorModuleType"],"sensorModuleId" : variables["sensorModuleId"],"sensorId" : variables["sensorId"], "timestamp" : get_time() };
226
                    last_value["Sensor"] = { "value" : { "sensorModuleType" : variables["sensorModuleType"],"sensorModuleId" : variables["sensorModuleId"],"sensorId" : variables["sensorId"] }, "timestamp" : get_time() };
227
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
227
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
228
                }
228
                }
229
            break;
229
            break;
230
            case "CONFIG_ACTUATOR":
230
            case "CONFIG_ACTUATOR":
231
                for (var alias_name in aliases_data)
231
                for (var alias_name in aliases_data)
Line 236... Line 236...
236
                    if (last_value_string)
236
                    if (last_value_string)
237
                    {
237
                    {
238
                        last_value = eval("(" + last_value_string + ")");
238
                        last_value = eval("(" + last_value_string + ")");
239
                    }
239
                    }
240
                   
240
                   
241
                    last_value["Actuator"] = { "actuatorModuleType" : variables["actuatorModuleType"],"actuatorModuleId" : variables["actuatorModuleId"],"actuatorId" : variables["actuatorId"], "timestamp" : get_time() };
241
                    last_value["Actuator"] = { "value" : { "actuatorModuleType" : variables["actuatorModuleType"],"actuatorModuleId" : variables["actuatorModuleId"],"actuatorId" : variables["actuatorId"] }, "timestamp" : get_time() };
242
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
242
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
243
                }
243
                }
244
            break;
244
            break;
245
            case "CONFIG_PARAMETER":
245
            case "CONFIG_PARAMETER":
246
                for (var alias_name in aliases_data)
246
                for (var alias_name in aliases_data)
Line 251... Line 251...
251
                    if (last_value_string)
251
                    if (last_value_string)
252
                    {
252
                    {
253
                        last_value = eval("(" + last_value_string + ")");
253
                        last_value = eval("(" + last_value_string + ")");
254
                    }
254
                    }
255
                   
255
                   
256
                    last_value["Parameters"] = { "K_P" : variables["K_P"],"K_I" : variables["K_I"],"K_D" : variables["K_D"],"TimeUnit" : variables["TimeUnit"],"RegulatorTime" : variables["RegulatorTime"], "timestamp" : get_time() };
256
                    last_value["Parameters"] = { "value" : { "K_P" : variables["K_P"],"K_I" : variables["K_I"],"K_D" : variables["K_D"],"TimeUnit" : variables["TimeUnit"],"RegulatorTime" : variables["RegulatorTime"] }, "timestamp" : get_time() };
257
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
257
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
258
                }
258
                }
259
            break;
259
            break;
260
            case "PID_STATUS":
260
            case "PID_STATUS":
261
                for (var alias_name in aliases_data)
261
                for (var alias_name in aliases_data)
Line 266... Line 266...
266
                    if (last_value_string)
266
                    if (last_value_string)
267
                    {
267
                    {
268
                        last_value = eval("(" + last_value_string + ")");
268
                        last_value = eval("(" + last_value_string + ")");
269
                    }
269
                    }
270
                   
270
                   
271
                    last_value["PID_status"] = { "Measurment" : variables["Measurment"],"Reference" : variables["Reference"],"PWM" : variables["PWM"],"Sum" : variables["Sum"], "timestamp" : get_time() };
271
                    last_value["PID_status"] = { "value" : { "Measurment" : variables["Measurment"],"Reference" : variables["Reference"],"PWM" : variables["PWM"],"Sum" : variables["Sum"] }, "timestamp" : get_time() };
272
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
272
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
273
                }
273
                }
274
    //log("PID status: mea:" + this.Measurment + " ref:" + this.Reference + " pwm:" + this.PWM/100 + " sum:" + this.Sum + "\n");
274
    //log("PID status: mea:" + this.Measurment + " ref:" + this.Reference + " pwm:" + this.PWM/100 + " sum:" + this.Sum + "\n");
275
                //this.callEvent("newValue", canMessage.getData("Id"));
275
                //this.callEvent("newValue", canMessage.getData("Id"));
276
 
276
 
Line 286... Line 286...
286
                    if (last_value_string)
286
                    if (last_value_string)
287
                    {
287
                    {
288
                        last_value = eval("(" + last_value_string + ")");
288
                        last_value = eval("(" + last_value_string + ")");
289
                    }
289
                    }
290
                   
290
                   
291
                    last_value["Reference"] = { "Value" : variables["Value"], "timestamp" : get_time() };
291
                    last_value["Reference"] = { "value" : variables["Value"], "timestamp" : get_time() };
292
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
292
                    Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
293
                }  
293
                }  
294
                break;
294
                break;
295
            case "Report_Interval":
295
            case "Report_Interval":
296
                this.myReportInterval = canMessage.getData("Time");
296
                this.myReportInterval = canMessage.getData("Time");