diff options
author | Random Hacker <random_hacker@xapek.org> | 2010-08-30 05:18:46 +0200 |
---|---|---|
committer | Random Hacker <random_hacker@xapek.org> | 2010-08-30 05:18:46 +0200 |
commit | 4b04486e2914bcd8fe421d5442a6bdf917835692 (patch) | |
tree | 62fc1579ca32aa585e817a284dbafde2c406d24c | |
parent | 4c33902c84b49218f17d9d9840da37d4fecf7c24 (diff) | |
download | ebus-alt-4b04486e2914bcd8fe421d5442a6bdf917835692.tar.gz ebus-alt-4b04486e2914bcd8fe421d5442a6bdf917835692.zip |
test.r stand Mo 30. Aug 05:18:44 CEST 2010
-rwxr-xr-x | test.r | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -15,8 +15,8 @@ brenner <- dbGetQuery(con, , value_string FROM value WHERE sensor_id IN (select id from sensor where name = 'heizkreisregler1.betriebsdatenFeuerungsautomat.betriebszustand') - AND date_trunc('day',timestamp) = date_trunc('day',now()) - ORDER BY timestamp asc", sep="")) + AND timestamp > now() - interval '1 day'", + " ORDER BY timestamp asc", sep="")) ## Brennerstatus auf Brennerstaotusänderungen reduzieren @@ -33,11 +33,10 @@ brenner <- brennerBla readNumericSensorDay <- function (sensorName) { d <- dbGetQuery(con, - paste("SELECT timestamp", - " , COALESCE(value_int,value_float) \"value\"", + paste("SELECT timestamp,COALESCE(value_int,value_float) \"value\"", " FROM value", " WHERE sensor_id IN (select id from sensor where name = '",sensorName,"')", - " AND date_trunc('day',timestamp) = date_trunc('day',now()) ", + " AND timestamp > now() - interval '1 day'", " ORDER BY timestamp desc", sep="")) d$timestamp <- as.POSIXct(round(d$timestamp, "mins")) dm <- aggregate(d$value, list(timestamp=d$timestamp), mean) @@ -50,17 +49,20 @@ mymerge <- function (a,...,all.x=TRUE) { if ( length(list(...)) > 1) { merge(a,merge(...,all.x=all.x),all.x=all.x) } else { - x<-merge(a,list(...)[1],all.x=all.x) + merge(a,list(...)[1],all.x=all.x) } } warmwasser <- readNumericSensorDay("heizkreisregler9.solarDaten.tempWarmwasserSolar") + kessel <- readNumericSensorDay("heizkreisregler10.betriebsdatenRegler1.kesselTemperatur") + kollektor <- readNumericSensorDay("heizkreisregler9.solarDaten.tempKollektor") names_kollektor <- names(kollektor) kollektor <- supsmu(kollektor$time,kollektor$heizkreisregler9.solarDaten.tempKollektor) names(kollektor) <- names_kollektor -print(kollektor$time) + +aussenTemperatur <- readNumericSensorDay("feuerungsautomat1.betriebsdatenRegler1.aussenTemperatur") # -- TODO ausreißer als punkte darstellen data <- mymerge(kollektor, kessel, warmwasser) @@ -74,12 +76,10 @@ par(lwd=2) lines(data$time, data$heizkreisregler10.betriebsdatenRegler1.kesselTemperatur, col="red") lines(data$time, data$heizkreisregler9.solarDaten.tempWarmwasserSolar, col="orange") lines(data$time, data$heizkreisregler9.solarDaten.tempKollektor, col="blue") - +lines(aussenTemperatur$time, aussenTemperatur$heizkreisregler1.datumZeit.aussenTemperatur, col="green") box() for (i in c(1:nrow(brenner))) { - print(brenner$time[i]) - print(brenner$value_string[i]) text(as.numeric(brenner$time[i]), max(data[2:length(data)],na.rm=TRUE)/2, paste("ab hier", brenner$value_string[i]) ,srt=90) } |