Skip to content

Commit

Permalink
Add support for EnergyPlus v9.2 (#138)
Browse files Browse the repository at this point in the history
* Add support for EnergyPlus v9.2.

* Support v9.2 Windows installer

See NREL/EnergyPlus#7396

From EnergyPlus v9.2, the installer will be packaged using QtIFW instead of NSIS. Right now, QtIFW did not support silent installation. I follow this thread to write a controller script to achieve this.

https://stackoverflow.com/questions/25105269/silent-install-qt-run-installer-on-ubuntu-server

* Add transition for v9.2.

* Update NEWS.

* Fix tests.
  • Loading branch information
Hongyuan Jia authored Oct 17, 2019
2 parents 79e5f7b + 1e03cbd commit f710bf9
Show file tree
Hide file tree
Showing 8 changed files with 3,998 additions and 17 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
* A new parameter named `.empty` has been added in `$set()`, `$insert()`,
`$load()`, `$update()`, `$paste()` methods in `Idf` class and `$set()` method
in `IdfObject` class (#133).
* EnergyPlus v9.2 support has been added (#138).

## Bug fixes

Expand Down
5 changes: 3 additions & 2 deletions R/constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ALL_EPLUS_VER <- c(
paste0("7.", 0:2, ".0"),
paste0("8.", 0:9, ".0"), paste0("8.3.", 1:3),
"9.0.0", "9.0.1", "9.1.0"
"9.0.0", "9.0.1", "9.1.0", "9.2.0"
)

LATEST_EPLUS_VER <- ALL_EPLUS_VER[length(ALL_EPLUS_VER)]
Expand All @@ -18,11 +18,12 @@ ALL_IDD_VER <- c(
paste0("7.", 0:2, ".0"),
paste0("8.", 0:9, ".0"),
paste0("9.0.", 0:1),
paste0("9.1.0")
paste0("9.", 1:2, ".0")
)

ALL_EPLUS_RELEASE_COMMIT <- data.table::fread(
"version , commit
9.2.0 , 921312fa1d
9.1.0 , 08d2e308bb
9.0.1 , bb7ca4f0da
9.0.0 , 2ef880da82
Expand Down
50 changes: 47 additions & 3 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ install_eplus <- function (ver = "latest", force = FALSE) {

inst <- attr(dl, "file")
res <- switch(os_type(),
windows = install_eplus_win(inst),
windows = install_eplus_win(inst, qtifw = ver >= 9.2),
linux = install_eplus_linux(inst),
macos = install_eplus_macos(inst))

Expand Down Expand Up @@ -167,8 +167,52 @@ download_file <- function (url, dest) {
}
# }}}
# install_eplus_win {{{
install_eplus_win <- function (exec) {
system(sprintf("%s /S", exec))
install_eplus_win <- function (exec, qtifw = FALSE) {
if (!qtifw) {
system(sprintf("%s /S", exec))
} else {
# create a tempfile of QTIFW control script
ctrl <- tempfile(fileext = ".qs")
write_lines(file = ctrl, x = "
function Controller() {
installer.autoRejectMessageBoxes();
installer.installationFinished.connect(function() {
gui.clickButton(buttons.NextButton);
})
}
Controller.prototype.IntroductionPageCallback = function() {
// click delay here because the next button is initially disabled for ~1 second
gui.clickButton(buttons.NextButton, 3000);
}
Controller.prototype.TargetDirectoryPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ComponentSelectionPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.LicenseAgreementPageCallback = function() {
gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
gui.clickButton(buttons.NextButton);
}
Controller.prototype.StartMenuDirectoryPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ReadyForInstallationPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.FinishedPageCallback = function() {
gui.clickButton(buttons.FinishButton);
}
")
system(sprintf("%s --script %s", exec, ctrl))
}
}
# }}}
# install_eplus_macos {{{
Expand Down
Loading

0 comments on commit f710bf9

Please sign in to comment.