Skip to content

Commit

Permalink
New Shoebox module helps create EnergyPlus shoeboxes parametrically f…
Browse files Browse the repository at this point in the history
…rom UmiTemplateLibrary files (#61)

* working concept of shoe box

* Adds new HVACTemplate module

* Set wwr

* next

* Finishes hvac properties from template

* fixes wwr

* sets infiltration and natural ventilation in shoebox

* set internal mass based on template

* Adds envelope properties  + ground temp

* adds kgCO2 to unit registry

* Adds "HVACTEMPLATE:ZONE:BASEBOARDHEAT"

* Adds archetypal to requirements

* markdown

* Specify zones to build using list of dict

* Specify zones

* Update python-package.yml

* Adds energyplus install file

* Update python-package.yml
  • Loading branch information
Samuel Letellier-Duchesne authored May 11, 2021
1 parent d73d36c commit c927324
Show file tree
Hide file tree
Showing 12 changed files with 1,417 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9 ]
python-version: [ 3.7, 3.8 ]
energyplus-version: [ 9.2.0 ] # later, add 9.4.0
include:
- energyplus-version: 9.2.0
energyplus-sha: 921312fa1d
energyplus-install: 9-2-0

steps:
- name: Install builder
Expand All @@ -27,6 +32,13 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install EnergyPlus
env:
ENERGYPLUS_VERSION: ${{ matrix.energyplus-version }}
ENERGYPLUS_SHA: ${{ matrix.energyplus-sha }}
ENERGYPLUS_INSTALL_VERSION: ${{ matrix.energyplus-install }}
run: bash ./install_energyplus.sh

- uses: actions/cache@v2
id: cache
with:
Expand Down
10 changes: 10 additions & 0 deletions .idea/markdown-navigator-enh.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions .idea/markdown-navigator.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/pyumi.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions install_energyplus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash
function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
# Check if EnergyPlus env variables exist already. If not use these defaults
if [[ -z "${ENERGYPLUS_VERSION}" ]]; then
export ENERGYPLUS_VERSION=9.2.0
fi
if [[ -z "${ENERGYPLUS_SHA}" ]]; then
export ENERGYPLUS_SHA=921312fa1d
fi
if [[ -z "${ENERGYPLUS_INSTALL_VERSION}" ]]; then
export ENERGYPLUS_INSTALL_VERSION=9-2-0
fi

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if version_gt $ENERGYPLUS_VERSION 9.3.0; then
export EXT="sh"
export PLATFORM=Linux-Ubuntu18.04
else
export EXT="sh"
export PLATFORM=Linux
fi
export ATTCHBASE=97
export ATTCHNUM=8230
elif [[ "$OSTYPE" == "darwin"* ]]; then
if version_gt $ENERGYPLUS_VERSION 9.3.0; then
export EXT=dmg
export PLATFORM=Darwin-macOS10.15
else
export EXT=dmg
export PLATFORM=Darwin
fi
export ATTCHBASE=98
export ATTCHNUM=8232
elif [[ "$OSTYPE" == "win"* || "$OSTYPE" == "msys"* ]]; then
export EXT=zip
export PLATFORM=Windows
export ATTCHBASE=86
export ATTCHNUM=8231
fi
# Download EnergyPlus executable
ENERGYPLUS_DOWNLOAD_BASE_URL=https://github.com/NREL/EnergyPlus/releases/download/v$ENERGYPLUS_VERSION
ENERGYPLUS_DOWNLOAD_FILENAME=EnergyPlus-$ENERGYPLUS_VERSION-$ENERGYPLUS_SHA-$PLATFORM-x86_64
ENERGYPLUS_DOWNLOAD_URL=$ENERGYPLUS_DOWNLOAD_BASE_URL/$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT
echo "$ENERGYPLUS_DOWNLOAD_URL"
curl --fail -SL -C - "$ENERGYPLUS_DOWNLOAD_URL" -o "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT

# Extra downloads
EXTRAS_DOWNLOAD_URL=http://energyplus.helpserve.com/Knowledgebase/Article/GetAttachment/$ATTCHBASE/$ATTCHNUM
curl --fail -SL -C - $EXTRAS_DOWNLOAD_URL -o $ATTCHNUM.zip

# Install EnergyPlus and Extra Downloads
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo chmod +x "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
printf "y\r" | sudo ./"$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
sudo tar zxvf $ATTCHNUM.zip -C /usr/local/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/PreProcess/IDFVersionUpdater
sudo chmod -R a+rwx /usr/local/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/PreProcess/IDFVersionUpdater
sudo chmod -R a+rwx /usr/local/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/ExampleFiles
# cleanup
sudo rm "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
sudo rm $ATTCHNUM.zip
elif [[ "$OSTYPE" == "darwin"* ]]; then
# getting custom install script https://github.com/NREL/EnergyPlus/pull/7615
curl -SL -C - https://raw.githubusercontent.com/jmarrec/EnergyPlus/40afb275f66201db5305f54df6c070d0b0cb4fc3/cmake/qtifw/install_script.qs -o install_script.qs
sudo hdiutil attach "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
sudo /Volumes/"$ENERGYPLUS_DOWNLOAD_FILENAME"/"$ENERGYPLUS_DOWNLOAD_FILENAME".app/Contents/MacOS/"$ENERGYPLUS_DOWNLOAD_FILENAME" --verbose --script install_script.qs
sudo tar zxvf $ATTCHNUM.zip -C /Applications/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/PreProcess
sudo chmod -R a+rwx /Applications/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/PreProcess/IDFVersionUpdater
sudo chmod -R a+rwx /Applications/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/ExampleFiles
# cleanup
sudo rm install_script.qs
sudo rm "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
sudo rm $ATTCHNUM.zip
elif [[ "$OSTYPE" == "win"* || "$OSTYPE" == "msys"* ]]; then
# On windows, we are simply extracting the zip file to c:\\
echo "Extracting and Copying files to... C:\\"
powershell Expand-Archive -Path $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT -DestinationPath C:\\
powershell Rename-Item -Path c:\\$ENERGYPLUS_DOWNLOAD_FILENAME -NewName EnergyPlusV"$ENERGYPLUS_INSTALL_VERSION"
# extract extra downloads to destination
DEST=C:\\EnergyPlusV"$ENERGYPLUS_INSTALL_VERSION"\\PreProcess\\IDFVersionUpdater
echo "Extracting and Copying files to... $DEST"
powershell Expand-Archive -Path $ATTCHNUM.zip -DestinationPath "$DEST" -Force
# cleanup
rm -v $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT
rm -v $ATTCHNUM.zip
IDD=C:\\EnergyPlusV"$ENERGYPLUS_INSTALL_VERSION"\\Energy+.idd
if [ -f "$IDD" ]; then
echo "$IDD" exists
else
echo "$IDD" does not exist
travis_terminate 1
fi
fi
6 changes: 6 additions & 0 deletions pyumi/shoeboxer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Shoeboxer module."""

__all__ = ["ShoeBox", "HVACTemplates"]

from .shoebox import ShoeBox
from .hvac_templates import HVACTemplates
133 changes: 133 additions & 0 deletions pyumi/shoeboxer/hvac_templates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
"""HVAC Templates Module."""


class HVACTemplate:
"""Allows for the specification of simple zone thermostats and HVAC systems with
automatically generated node names.
"""

def create_from(self, zone, zoneDefinition):
"""Create HVAC Template from zone and from zoneDefinition.
Args:
zone (EpBunch):
zoneDefinition (ZoneDefinition):
"""
pass


class SimpleIdealLoadsSystem(HVACTemplate):
"""For a simple ideal loads system for sizing and loads oriented simulations."""

REQUIRED = ["HVACTemplate:Thermostat", "HVACTemplate:Zone:BaseboardHeat"]
OPTIONAL = []

def create_from(self, zone, zoneDefinition):
"""Create SimpleIdealLoadsSystem.
Args:
zone (EpBunch): The zone EpBunch object.
zoneDefinition (ZoneDefinition): The archetypal template ZoneDefinition
object.
"""
idf = zone.theidf
stat = idf.newidfobject(
"HVACTEMPLATE:THERMOSTAT",
Name=f"Zone {zone.Name} Thermostat",
Constant_Heating_Setpoint=zoneDefinition.Conditioning.HeatingSetpoint,
Constant_Cooling_Setpoint=zoneDefinition.Conditioning.CoolingSetpoint,
)
idf.newidfobject(
key="HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM",
Zone_Name=zone.Name,
Template_Thermostat_Name=stat.Name,
System_Availability_Schedule_Name="",
Maximum_Heating_Supply_Air_Temperature="50",
Minimum_Cooling_Supply_Air_Temperature="13",
Maximum_Heating_Supply_Air_Humidity_Ratio="0.0156",
Minimum_Cooling_Supply_Air_Humidity_Ratio="0.0077",
Heating_Limit=zoneDefinition.Conditioning.HeatingLimitType.name,
Maximum_Heating_Air_Flow_Rate=zoneDefinition.Conditioning.MaxHeatFlow,
Maximum_Sensible_Heating_Capacity=zoneDefinition.Conditioning.MaxHeatingCapacity,
Cooling_Limit=zoneDefinition.Conditioning.CoolingLimitType.name,
Maximum_Cooling_Air_Flow_Rate=zoneDefinition.Conditioning.MaxCoolFlow,
Maximum_Total_Cooling_Capacity=zoneDefinition.Conditioning.MaxCoolingCapacity,
Heating_Availability_Schedule_Name="",
Cooling_Availability_Schedule_Name="",
Dehumidification_Control_Type="ConstantSensibleHeatRatio",
Cooling_Sensible_Heat_Ratio="0.7",
Dehumidification_Setpoint=60.0,
Humidification_Control_Type="None",
Humidification_Setpoint=30.0,
Outdoor_Air_Method="Sum",
Outdoor_Air_Flow_Rate_per_Person=zoneDefinition.Conditioning.MinFreshAirPerPerson,
Outdoor_Air_Flow_Rate_per_Zone_Floor_Area=zoneDefinition.Conditioning.MinFreshAirPerArea,
Outdoor_Air_Flow_Rate_per_Zone=0.0,
Design_Specification_Outdoor_Air_Object_Name=f"Zone {zone.Name} Outdoor Air",
Demand_Controlled_Ventilation_Type="None",
Outdoor_Air_Economizer_Type=zoneDefinition.Conditioning.EconomizerType.name,
Heat_Recovery_Type=zoneDefinition.Conditioning.HeatRecoveryType.name,
Sensible_Heat_Recovery_Effectiveness=zoneDefinition.Conditioning.HeatRecoveryEfficiencySensible,
Latent_Heat_Recovery_Effectiveness=zoneDefinition.Conditioning.HeatRecoveryEfficiencyLatent,
)


class PTHP(HVACTemplate):
"""For packaged terminal air-to-air heat pump (PTHP) systems."""

REQUIRED = ["HVACTemplate:Thermostat", "HVACTemplate:Zone:PTHP"]
OPTIONAL = []

def create_from(self, zone, zoneDefinition):
idf = zone.theidf
stat = idf.newidfobject(
"HVACTEMPLATE:THERMOSTAT",
Name=f"Zone {zone.Name} Thermostat",
Constant_Heating_Setpoint=zoneDefinition.Conditioning.HeatingSetpoint,
Constant_Cooling_Setpoint=zoneDefinition.Conditioning.CoolingSetpoint,
)
idf.newidfobject(
"HVACTEMPLATE:ZONE:PTHP",
Zone_Name=zone.Name,
Template_Thermostat_Name=stat.Name,
Cooling_Coil_Gross_Rated_COP=zoneDefinition.Conditioning.CoolingCoeffOfPerf,
Heating_Coil_Gross_Rated_COP=zoneDefinition.Conditioning.HeatingCoeffOfPerf,
)


class BaseboardHeatingSystem(HVACTemplate):
"""For baseboard heating systems with optional hot water boiler."""

REQUIRED = ["HVACTemplate:Thermostat", "HVACTemplate:Zone:BaseboardHeat"]
OPTIONAL = ["HVACTemplate:Plant:HotWaterLoop", "HVACTemplate:Plant:Boiler"]

def create_from(self, zone, zoneDefinition):
"""Create the hvac template from the Zone EpBunch and the ZoneDefiniion."""
idf = zone.theidf
stat = idf.newidfobject(
"HVACTEMPLATE:THERMOSTAT",
Name=f"Zone {zone.Name} Thermostat",
Constant_Heating_Setpoint=zoneDefinition.Conditioning.HeatingSetpoint,
Constant_Cooling_Setpoint=zoneDefinition.Conditioning.CoolingSetpoint,
)
idf.newidfobject(
key="HVACTEMPLATE:ZONE:BASEBOARDHEAT",
Zone_Name=zone.Name,
Template_Thermostat_Name=stat.Name,
Zone_Heating_Sizing_Factor="",
Baseboard_Heating_Type="HotWater",
Baseboard_Heating_Availability_Schedule_Name="",
Baseboard_Heating_Capacity="autosize",
Dedicated_Outdoor_Air_System_Name="",
Outdoor_Air_Method="Flow/Person",
Outdoor_Air_Flow_Rate_per_Person="0.00944",
Outdoor_Air_Flow_Rate_per_Zone_Floor_Area="0.0",
Outdoor_Air_Flow_Rate_per_Zone=0.0,
)


HVACTemplates = {
"BaseboardHeatingSystem": BaseboardHeatingSystem(),
"SimpleIdealLoadsSystem": SimpleIdealLoadsSystem(),
"PTHP": PTHP(),
}
Loading

0 comments on commit c927324

Please sign in to comment.