Building Controls Virtual Test Bed

The Building Controls Virtual Test Bed (BCVTB) is a software environment that allows expert users to couple different simulation programs for co-simulation, and to couple simulation programs with actual hardware. For example, the BCVTB allows to simulate a building in EnergyPlus and the HVAC and control system in Modelica, while exchanging data between the software as they simulate. The BCVTB is based on the Ptolemy II software environment. The BCVTB allows expert users of simulation to expand the capabilities of individual programs by linking them to other programs. Due to the different programs that may be involved in distributed simulation, familiarity with configuring programs is essential.

Programs that are linked to the BCVTB are

Modelica Library for Building Energy and Control Systems

The Modelica Buildings library is a free open-source library with dynamic simulation models for building energy and control systems. The library contains models for

  • air-based HVAC systems,
  • water-based heating systems,
  • controls,
  • heat transfer among rooms and the outside, and
  • multizone airflow, including natural ventilation and contaminant transport.

The primary use of the library is for flexible and fast modeling of building energy and control systems to accelerate innovation leading to cost-effective very low energy systems for new and existing buildings. The library is particularly suited for

  • rapid prototyping of new building systems,

  • analysis of the operation of existing building systems,

  • development, specification, verification and deployment of building controls within a model-based design process, and

  • reuse of models during operation for functional testing, for verification of control sequences, for energy-minimizing controls, fault detection and diagnostics.

The Ptolemy Project

The Ptolemy project studies modeling, simulation, and design of concurrent, real-time, embedded systems. The focus is on assembly of concurrent components. The key underlying principle in the project is the use of well-defined models of computation that govern the interaction between components. A major problem area being addressed is the use of heterogeneous mixtures of models of computation. A software system called Ptolemy II is being constructed in Java. The work is conducted in the Center for Hybrid and Embedded Software Systems (CHESS) in the Department of Electrical Engineering and Computer Sciences of the University of California at Berkeley. The project is directed by Prof. Edward Lee. The project is named after Claudius Ptolemaeus, the second century Greek astronomer, mathematician, and geographer.

R: How to change ggplot2 axis position

In ggplot2 it is not so easy to change the scale position, like showing the Y-axis in the right side or using dual axis. Kohske Takahashi is working on it and it is available in the dev version. (!topic/ggplot2-dev/JkJU5CLBkQw). As alternative he provided a solution with gtable For simply change the Y-axis to the right side see

Dual axis:
# two plots
p1 <- ggplot(mtcars, aes(mpg, disp)) + geom_line(colour = "blue") + theme_bw()
p2 <- ggplot(mtcars, aes(mpg, drat)) + geom_line(colour = "red") + theme_bw() %+replace%
theme(panel.background = element_rect(fill = NA))
# extract gtable
g1 <- ggplot_gtable(ggplot_build(p1))
g2 <- ggplot_gtable(ggplot_build(p2))
# overlap the panel of 2nd plot on that of 1st plot
pp <- c(subset(g1$layout, name == "panel", se = t:r))
g <- gtable_add_grob(g1, g2$grobs[[which(g2$layout$name == "panel")]], pp$t,
pp$l, pp$b, pp$l)
# axis tweaks
ia <- which(g2$layout$name == "axis-l")
ga <- g2$grobs[[ia]]
ax <- ga$children[[2]]
ax$widths <- rev(ax$widths)
ax$grobs <- rev(ax$grobs)
ax$grobs[[1]]$x <- ax$grobs[[1]]$x - unit(1, "npc") + unit(0.15, "cm")
g <- gtable_add_cols(g, g2$widths[g2$layout[ia, ]$l], length(g$widths) - 1)
g <- gtable_add_grob(g, ax, pp$t, length(g$widths) - 1, pp$b)
# draw it

Y axis in right:
dat <- data.frame(x<-seq(0, 10, 0.1),y = sin(x * pi))
p <- ggplot(dat, aes(x, y)) + geom_line(colour = "blue") + theme_bw()
# extract gtable
g <- ggplot_gtable(ggplot_build(p))
# axis tweaks
ia <- which(g$layout$name == "axis-l")
ax <- g$grobs[[ia]]$children[[2]]
ax$widths <- rev(ax$widths)
ax$grobs <- rev(ax$grobs)
ax$grobs[[1]]$x <- ax$grobs[[1]]$x - unit(1, "npc") + unit(0.15, "cm")
pp <- c(subset(g$layout, name == "panel", select = t:r))
g <- gtable_add_cols(g, g$widths[g$layout[ia, ]$l], length(g$widths) - 1)
g <- gtable_add_grob(g, ax, pp$t, length(g$widths) - 1, pp$b)
g$grobs[[ia]]$children[[2]] <- NULL
ia <- which(g$layout$name == "ylab")
ylab <- g$grobs[[ia]]
g <- gtable_add_cols(g, g$widths[g$layout[ia, ]$l], length(g$widths) - 1)
g <- gtable_add_grob(g, ylab, pp$t, length(g$widths) - 1, pp$b)
g$grobs[[ia]]$label = ''

Using Git with RStudio

RStudio includes integrated support for Git. To use Git with RStudio, below are the steps to get it working:

  1. Setup a GitHub account here.
  2. Download and install Rstudio.
  3. Download and install the platform-specific version of Git (not GitHub), default options   work well.
  4. Configure Git with global commands. I have found this step necessary both times I     ran through this process. Open up the bash version of Git and type the following:
    git config –global “your GitHub account name”
    git config –global “”
  5. Open Rstudio and set the path to Git executable. Go to Tools > Global Options > Git/SVN