Interruption Causes



load(RpadBaseFile("interruptions.RData"))
allcauses = rev(levels(ints$cause))
HTMLon()
cat("<form>")
for (i in seq(along=allcauses)) {
  cat( HTMLcheckbox(paste("c",i,sep=""), allcauses[i],checked=FALSE), 
       "<br>")
}
cat("</form>")

Weather

allweather = levels(ints$weather)
HTMLon()
cat("<form>")
for (i in seq(along=allweather)) {
    cat( HTMLcheckbox(paste("w",i,sep=""), allweather[i],checked=TRUE),
         "<br>")
}
chosencauses=list()
for (i in seq(along=allcauses)) 
    if (get(paste("c",i,sep="")))
      chosencauses = c(chosencauses,allcauses[i])
if (allCauses) chosencauses = allcauses
chosenweather = list()
for (i in seq(along=allweather)) 
    if (get(paste("w",i,sep="")))
      chosenweather = c(chosenweather,allweather[i])

newgraph(width=6, height=6)
ints.subset = subset(ints, cause %in% chosencauses & 
                     weather %in% chosenweather)
count = xtabs(~ year, ints.subset)
custcount = xtabs(restmeters ~ year, ints.subset)
custmin = xtabs(restmeters*duratnminutes ~ year, ints.subset)
par(mfcol=c(2,2),mar=c(3, 3, 2, 1))
plot(custcount, type = "p", pch = 19, col = "red", 
     xlab = "", ylab = "")
mtext("Customer interruptions", side = 3, line = .5)
plot(custmin, type = "p", pch = 19, col = "red", xlab = "", ylab = "")
mtext("Customer minutes of interruption", side = 3, line = .5)
plot(count, type = "p", pch = 19, col = "red", xlab = "", ylab = "")
mtext("Interruption count", side = 3, line = .5)
HTMLon()
showgraph()
start.date = as.Date("1994-01-01")
ints.subset$days =
    as.numeric(as.Date(as.character(ints.subset$intdate), format = "%Y%m%d") - 
               start.date)
end.days = as.numeric(as.Date("2003-12-31") - start.date)
r=length(ints.subset$days)
z=sqrt(12*r)*sum(ints.subset$days[1:r] - end.days/2)/r/end.days
cat("<br>Laplace statistic = ",z)



by Tom Short, tshort@eprisolutions..com, Copyright 2005. EPRI, license: GNU GPL v2 or greater