Sunday, March 20, 2016

Output Level of Water Treatment Plant

On this chart is very nicely visible what happened in last 24 hours - it is clearly visible when we sleep and after analysis of several days one can deduct information when nobody is at home, how many people lives here. 



Data are gathered by the Siemens Logo! PLC I use for this kind of automation. In later posts I'll be sharing details, schematics, photos and how to with you.

Here is a code in R used for the processing of these data:

##########################################
## Set working directory with the file downloaded 
## from Logo! PLC
##########################################

working_directory <- c("/Users/C000-Generic-Stats/0006-Water_treatment/00 - DATA")
setwd(working_directory)

##########################################
## Loading data
##########################################

WATER_LEVEL <- read.csv ("data.csv",header=TRUE)

##########################################
## Formatting date and time
##########################################

WATER_LEVEL$Time_Formated <- strptime(WATER_LEVEL$Time,format='%m/%d/%y %H:%M:%S')

###########################################
### Printing data into chart
###########################################

gg <- ggplot(data= WATER_LEVEL,
                     aes(WATER_LEVEL$Time_Formated,
                            WATER_LEVEL$L1  ))
gg <- gg + geom_line() 
gg <- gg + ggtitle(c('Output Level of Water Treatment Plant'))
gg <- gg + labs(x=NULL, y=NULL, title=c('Output Level of Water Treatment Plant'))
gg <- gg + theme_bw(base_family="Helvetica")
gg <- gg + ylab("Water Level [%]")
gg <- gg + xlab("Date & Time")
gg <- gg + theme(panel.grid.major=element_line(size = 0.5),
                   axis.text.x=element_text(angle = 90, hjust = 0.5))
gg


No comments:

Post a Comment