plots.R 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. dev.off()
  2. lt = lapply(s, function(x) x$time_480v - first(x$time_480v))
  3. lc = lapply(s, function(x) ((x$voltage_0 * x$current_0_480v) + (x$voltage_1 * x$current_1_480v) + (x$voltage_2 * x$current_2_480v)) / 1000)
  4. my.palette <- hcl.colors(length(lt), alpha=.2, palette="RdYlBu")
  5. # Create two panels side by side
  6. layout(t(1:2), widths=c(5,1))
  7. # Set margins and turn all axis labels horizontally (with `las=1`)
  8. par(mar=c(4,4,2,1), oma=c(0.5,0.5,0.5,2), las=1)
  9. plot(0, 0, type = "l", ylim = c(0, Reduce(max, unlist(lc))), xlim=c(0,35), xlab = "Sekunden nach Start des Zykluses", ylab="Scheinleistung in kVA")
  10. grid()
  11. for (i in 2:length(lt)) {
  12. #matplot(df$current_10, df[,0])
  13. lines(lt[[i]], lc[[i]], col=my.palette[i])
  14. }
  15. title("Einspeiseleistung pro Zyklus")
  16. # Draw the color legend
  17. image(1, seq_along(lt), t(seq_along(lt)), col=my.palette, axes=FALSE, xlab="", ylab="Zyklus")
  18. axis(4)
  19. lt = lapply(s, function(x) x[x$current_6 > 4,]$time_24v - first(x[x$current_6 > 4,]$time_24v))
  20. lc = lapply(s, function(y) {
  21. x = y[y$current_6 > 4,]
  22. return (x$current_0_24v + x$current_1_24v + x$current_2_24v + x$current_3 +x$current_4+x$current_5+x$current_6+x$current_7+x$current_8+x$current_9+x$current_10+x$current_11+x$current_12+x$current_13+x$current_14+x$current_15)
  23. })
  24. my.palette <- hcl.colors(length(lt), alpha=.2, palette="RdYlBu")
  25. # Create two panels side by side
  26. layout(t(1:2), widths=c(5,1))
  27. # Set margins and turn all axis labels horizontally (with `las=1`)
  28. par(mar=c(4,4,2,1), oma=c(0.5,0.5,0.5,2), las=1)
  29. plot(0, 0, type = "l", ylim = c(0, Reduce(max, unlist(lc))), xlim=c(0,35), xlab = "Sekunden nach Start des Zykluses", ylab="24V Stromaufnahme in A")
  30. grid()
  31. for (i in 2:length(lt)) {
  32. #matplot(df$current_10, df[,0])
  33. lines(lt[[i]], lc[[i]], col=my.palette[i])
  34. }
  35. title("Strom am 24V Netzteil pro Zyklus")
  36. # Draw the color legend
  37. image(1, seq_along(lt), t(seq_along(lt)), col=my.palette, axes=FALSE, xlab="", ylab="Zyklus")
  38. axis(4)