Skip to content

Commit 6bf35bd

Browse files
committed
fix(openstudio): Tweak so it works across multiple OpenStudio versions
1 parent 8d44419 commit 6bf35bd

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

honeybee_openstudio/hvac/standards/hvac_systems.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4219,7 +4219,10 @@ def model_add_window_ac(model, thermal_zones):
42194219
model, name='{} Window AC Cooling Coil'.format(zone_name),
42204220
type='Window AC', cop=cop)
42214221
clg_coil.setRatedSensibleHeatRatio(shr)
4222-
clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate2017(773.3)
4222+
if model.version() < openstudio.VersionString('3.5.0'):
4223+
clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate(773.3)
4224+
else:
4225+
clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate2017(773.3)
42234226
clg_coil.setEvaporativeCondenserEffectiveness(0.9)
42244227
clg_coil.setMaximumOutdoorDryBulbTemperatureForCrankcaseHeaterOperation(10)
42254228
clg_coil.setBasinHeaterSetpointTemperature(2)
@@ -4326,8 +4329,11 @@ def model_add_furnace_central_ac(
43264329
type='Residential Central AC')
43274330
clg_coil.setRatedSensibleHeatRatio(shr)
43284331
clg_coil.setRatedCOP(eer_to_cop_no_fan(eer))
4329-
clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate2017(
4330-
ac_w_per_cfm / FLOW_RATE.to_unit([1.0], 'm3/s', 'cfm')[0])
4332+
ac_w_per_mps = ac_w_per_cfm / FLOW_RATE.to_unit([1.0], 'm3/s', 'cfm')[0]
4333+
if model.version() < openstudio.VersionString('3.5.0'):
4334+
clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate(ac_w_per_mps)
4335+
else:
4336+
clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate2017(ac_w_per_mps)
43314337
clg_coil.setNominalTimeForCondensateRemovalToBegin(1000.0)
43324338
clg_coil.setRatioOfInitialMoistureEvaporationRateAndSteadyStateLatentCapacity(1.5)
43334339
clg_coil.setMaximumCyclingRate(3.0)
@@ -4478,8 +4484,11 @@ def model_add_central_air_source_heat_pump(
44784484
model, name='{} Cooling Coil'.format(loop_name),
44794485
type='Residential Central ASHP', cop=cop)
44804486
clg_coil.setRatedSensibleHeatRatio(shr)
4481-
clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate2017(
4482-
ac_w_per_cfm / FLOW_RATE.to_unit([1.0], 'm3/s', 'cfm')[0])
4487+
ac_w_per_mps = ac_w_per_cfm / FLOW_RATE.to_unit([1.0], 'm3/s', 'cfm')[0]
4488+
if model.version() < openstudio.VersionString('3.5.0'):
4489+
clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate(ac_w_per_mps)
4490+
else:
4491+
clg_coil.setRatedEvaporatorFanPowerPerVolumeFlowRate2017(ac_w_per_mps)
44834492
clg_coil.setNominalTimeForCondensateRemovalToBegin(1000.0)
44844493
clg_coil.setRatioOfInitialMoistureEvaporationRateAndSteadyStateLatentCapacity(1.5)
44854494
clg_coil.setMaximumCyclingRate(3.0)

honeybee_openstudio/openstudio.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,3 @@ def _os_create_vector_ironpython(val_list, vector):
167167
OSMonthOfYear = openstudio.MonthOfYear
168168
OSOutputVariable = openstudio_model.OutputVariable
169169
OSDesignDay = openstudio_model.DesignDay
170-
OSEpwFile = openstudio.EpwFile

honeybee_openstudio/simulation.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from ladybug.designday import ASHRAEClearSky, ASHRAETau
99

1010
from honeybee_openstudio.openstudio import OSModel, OSOutputVariable, \
11-
OSDesignDay, OSEpwFile, OSRunPeriodControlSpecialDays, OSMonthOfYear, \
12-
os_path, os_vector_len, openstudio_model
11+
OSDesignDay, OSRunPeriodControlSpecialDays, OSMonthOfYear, \
12+
openstudio, os_path, os_vector_len, openstudio_model
1313

1414
STANDARD_MAP = {
1515
'DOE_Ref_Pre_1980': 'DOE Ref Pre-1980',
@@ -38,7 +38,10 @@ def assign_epw_to_model(epw_file, os_model, set_climate_zone=False):
3838
assert epw_file.lower().endswith('.epw'), \
3939
'The file does not have .epw extension: {}'.format(epw_file)
4040
full_path = os.path.abspath(epw_file)
41-
os_epw = OSEpwFile(os_path(full_path))
41+
try:
42+
os_epw = openstudio.EpwFile(os_path(full_path))
43+
except AttributeError: # older bindings with no EPW module
44+
return os_model
4245
openstudio_model.WeatherFile.setWeatherFile(os_model, os_epw)
4346
# set the ASHRAE climate zone if requested
4447
if set_climate_zone:

honeybee_openstudio/writer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,10 @@ def room_to_openstudio(room, os_model, adj_map=None, include_infiltration=True,
439439
os_space.setString(11, 'No')
440440
else:
441441
os_space.setPartofTotalFloorArea(False)
442-
os_space.setVolume(room.volume)
442+
try:
443+
os_space.setVolume(room.volume)
444+
except AttributeError: # older OpenStudio bindings where method was not implemented
445+
pass
443446

444447
# assign the construction set if specified
445448
if room.properties.energy._construction_set is not None:

0 commit comments

Comments
 (0)