Skip to content

Commit

Permalink
rubocop edits
Browse files Browse the repository at this point in the history
In the air_loop_hvac_economizer_type_allowable? method in line 1364 of Standards.AirLoopHVAC.rb
effectively changed
  `return true unless oa_sys.is_initialized`
to
  `return false unless oa_sys.is_initialized`
  • Loading branch information
mdahlhausen committed Jun 30, 2021
1 parent 5afb9d1 commit c453c7a
Show file tree
Hide file tree
Showing 57 changed files with 498 additions and 543 deletions.
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ inherit_from:
# =============== OpenStudio Standards Specific ===========
# Ignore file name convention; choices based on OpenStudio C++ class names
Metrics/AbcSize:
Max: 150
Max: 200

Metrics/BlockLength:
Max: 75
Max: 100

Naming/FileName:
Enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class ASHRAE9012004 < ASHRAE901
# @!group Pump

# Determine type of pump part load control type
# @note code_sections [90.1-2004_6.5.4.1]
#
# @code_sections [90.1-2004_6.5.4.1]
# @param pump [OpenStudio::Model::PumpVariableSpeed] OpenStudio pump object
# @param plant_loop_type [String] Type of plant loop
# @param pump_nominal_hp [Float] Pump nominal horsepower
Expand All @@ -19,10 +19,9 @@ def pump_variable_speed_get_control_type(pump, plant_loop_type, pump_nominal_hp)
# Get pump head in Pa
pump_head_pa = pump.ratedPumpHead

if pump_nominal_hp * design_sizing_factor > threshold && pump_head_pa > 300_000 # 100 ft. of head
return 'VSD No Reset'
else
return 'Riding Curve'
end
return 'VSD No Reset' if pump_nominal_hp * design_sizing_factor > threshold && pump_head_pa > 300_000 # 100 ft. of head

# else
return 'Riding Curve'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class ASHRAE9012007 < ASHRAE901
# @!group Pump

# Determine type of pump part load control type
# @note code_sections [90.1-2007_6.5.4.1]
#
# @code_sections [90.1-2007_6.5.4.1]
# @param pump [OpenStudio::Model::PumpVariableSpeed] OpenStudio pump object
# @param plant_loop_type [String] Type of plant loop
# @param pump_nominal_hp [Float] Pump nominal horsepower
Expand All @@ -19,10 +19,9 @@ def pump_variable_speed_get_control_type(pump, plant_loop_type, pump_nominal_hp)
# Get pump head in Pa
pump_head_pa = pump.ratedPumpHead

if pump_nominal_hp * design_sizing_factor > threshold && pump_head_pa > 300_000 # 100 ft. of head
return 'VSD No Reset'
else
return 'Riding Curve'
end
return 'VSD No Reset' if pump_nominal_hp * design_sizing_factor > threshold && pump_head_pa > 300_000 # 100 ft. of head

# else
return 'Riding Curve'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def model_economizer_type(model, climate_zone)
end

# Adjust model to comply with fenestration orientation requirements
# @note code_sections [90.1-2010_5.5.4.5]
#
# @code_sections [90.1-2010_5.5.4.5]
# @param [OpenStudio::Model::Model] OpenStudio model object
# @return [Boolean] Returns true if successful, false otherwise
def model_fenestration_orientation(model, climate_zone)
Expand Down Expand Up @@ -73,8 +73,8 @@ def model_fenestration_orientation(model, climate_zone)
end

# Is transfer air required?
# @note code_sections [90.1-2010_6.5.7.1.2]
#
# @code_sections [90.1-2010_6.5.7.1.2]
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @return [Boolean] true if transfer air is required, false otherwise
def model_transfer_air_required?(model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class ASHRAE9012010 < ASHRAE901
# @!group Pump

# Determine type of pump part load control type
# @note code_sections [90.1-2010_6.5.4.1]
#
# @code_sections [90.1-2010_6.5.4.1]
# @param pump [OpenStudio::Model::PumpVariableSpeed] OpenStudio pump object
# @param plant_loop_type [String] Type of plant loop
# @param pump_nominal_hp [Float] Pump nominal horsepower
Expand All @@ -16,14 +16,12 @@ def pump_variable_speed_get_control_type(pump, plant_loop_type, pump_nominal_hp)
# increase and ~10% flow increase.
design_sizing_factor = 1.25

if plant_loop_type == 'Heating'
return 'Riding Curve'
else
if pump_nominal_hp * design_sizing_factor > threshold
return 'VSD DP Reset' # Requirement only applies to CHW pumps
else
return 'Riding Curve'
end
end
return 'Riding Curve' if plant_loop_type == 'Heating'

# Requirement only applies to CHW pumps
return 'VSD DP Reset' if pump_nominal_hp * design_sizing_factor > threshold

# else
return 'Riding Curve'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ def model_elevator_lighting_pct_incandescent(model)
# Determines the power of the elevator ventilation fan.
# 90.1-2013 has a requirement for ventilation fan efficiency.
#
# @param model [OpenStudio::Model::Model] the model
# @return [Double] the ventilaton fan power (W)
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @param vent_rate_cfm [Double] the ventilation rate in ft^3/min
# @return [Double] the ventilation fan power in watts
def model_elevator_fan_pwr(model, vent_rate_cfm)
vent_pwr_per_flow_w_per_cfm = 0.33
vent_pwr_w = vent_pwr_per_flow_w_per_cfm * vent_rate_cfm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class ASHRAE9012013 < ASHRAE901
# @!group Pump

# Determine type of pump part load control type
# @note code_sections [90.1-2013_6.5.4.2]
#
# @code_sections [90.1-2013_6.5.4.2]
# @param pump [OpenStudio::Model::PumpVariableSpeed] OpenStudio pump object
# @param plant_loop_type [String] Type of plant loop
# @param pump_nominal_hp [Float] Pump nominal horsepower
Expand All @@ -16,14 +16,12 @@ def pump_variable_speed_get_control_type(pump, plant_loop_type, pump_nominal_hp)
# increase and ~10% flow increase.
design_sizing_factor = 1.25

if plant_loop_type == 'Heating'
return 'Riding Curve'
else
if pump_nominal_hp * design_sizing_factor > threshold
return 'VSD DP Reset' # Requirement only applies to CHW pumps
else
return 'Riding Curve'
end
end
return 'Riding Curve' if plant_loop_type == 'Heating'

# Requirement only applies to CHW pumps
return 'VSD DP Reset' if pump_nominal_hp * design_sizing_factor > threshold

# else
return 'Riding Curve'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ def model_elevator_lighting_pct_incandescent(model)
# Determines the power of the elevator ventilation fan.
# 90.1-2016 has a requirement for ventilation fan efficiency.
#
# @param model [OpenStudio::Model::Model] the model
# @return [Double] the ventilaton fan power (W)
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @param vent_rate_cfm [Double] the ventilation rate in ft^3/min
# @return [Double] the ventilation fan power in watts
def model_elevator_fan_pwr(model, vent_rate_cfm)
vent_pwr_per_flow_w_per_cfm = 0.33
vent_pwr_w = vent_pwr_per_flow_w_per_cfm * vent_rate_cfm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class ASHRAE9012016 < ASHRAE901
# @!group Pump

# Determine type of pump part load control type
# @note code_sections [90.1-2016_6.5.4.2]
#
# @code_sections [90.1-2016_6.5.4.2]
# @param pump [OpenStudio::Model::PumpVariableSpeed] OpenStudio pump object
# @param plant_loop_type [String] Type of plant loop
# @param pump_nominal_hp [Float] Pump nominal horsepower
Expand Down Expand Up @@ -135,10 +135,9 @@ def pump_variable_speed_get_control_type(pump, plant_loop_type, pump_nominal_hp)
return false
end

if pump_nominal_hp * design_sizing_factor > threshold
return 'VSD DP Reset'
else
return 'Riding Curve'
end
return 'VSD DP Reset' if pump_nominal_hp * design_sizing_factor > threshold

# else
return 'Riding Curve'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ def model_elevator_lighting_pct_incandescent(model)
# Determines the power of the elevator ventilation fan.
# 90.1-2019 has a requirement for ventilation fan efficiency.
#
# @param model [OpenStudio::Model::Model] the model
# @return [Double] the ventilaton fan power (W)
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @param vent_rate_cfm [Double] the ventilation rate in ft^3/min
# @return [Double] the ventilation fan power in watts
def model_elevator_fan_pwr(model, vent_rate_cfm)
vent_pwr_per_flow_w_per_cfm = 0.33
vent_pwr_w = vent_pwr_per_flow_w_per_cfm * vent_rate_cfm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ class ASHRAE9012019 < ASHRAE901

# Determine the prototypical economizer type for the model.
#
# @param model [OpenStudio::Model::Model] the model
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @param climate_zone [String] ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'
# @return [String] the economizer type. Possible values are:
# 'NoEconomizer'
# 'FixedDryBulb'
# 'FixedEnthalpy'
# 'DifferentialDryBulb'
# 'DifferentialEnthalpy'
# 'FixedDewPointAndDryBulb'
# 'ElectronicEnthalpy'
# 'DifferentialDryBulbAndEnthalpy'
# 'NoEconomizer'
# 'FixedDryBulb'
# 'FixedEnthalpy'
# 'DifferentialDryBulb'
# 'DifferentialEnthalpy'
# 'FixedDewPointAndDryBulb'
# 'ElectronicEnthalpy'
# 'DifferentialDryBulbAndEnthalpy'
def model_economizer_type(model, climate_zone)
economizer_type = case climate_zone
when 'ASHRAE 169-2006-0A',
Expand All @@ -34,10 +34,11 @@ def model_economizer_type(model, climate_zone)
end

# Adjust model to comply with fenestration orientation requirements
# @note code_sections [90.1-2013_5.5.4.5]
#
# @code_sections [90.1-2013_5.5.4.5]
# @param [OpenStudio::Model::Model] OpenStudio model object
# @return [Boolean] Returns true if successful, false otherwise
# @param climate_zone [String] ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'
# @return [Bool] Returns true if successful, false otherwise
def model_fenestration_orientation(model, climate_zone)
# Building rotation to meet the same code requirement for
# 90.1-2010 are kept
Expand Down Expand Up @@ -228,19 +229,19 @@ def model_fenestration_orientation(model, climate_zone)
end

# Is transfer air required?
# @note code_sections [90.1-2019_6.5.7.1]
#
# @code_sections [90.1-2019_6.5.7.1]
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @return [Boolean] true if transfer air is required, false otherwise
# @return [Bool] true if transfer air is required, false otherwise
def model_transfer_air_required?(model)
return true
end

# Metal coiling door code minimum infiltration rate at 75 Pa
# @note code_sections [90.1-2019_5.4.3.2]
#
# @code_sections [90.1-2019_5.4.3.2]
# @param [String] Climate zone
# @return [Float] Minimum infiltration rate for metal coiling doors
# @param climate_zone [String] ASHRAE climate zone, e.g. 'ASHRAE 169-2013-4A'
# @return [Double] Minimum infiltration rate for metal coiling doors
def model_door_infil_flow_rate_metal_coiling_cfm_ft2(climate_zone)
case climate_zone
when 'ASHRAE 169-2006-7A',
Expand All @@ -258,11 +259,11 @@ def model_door_infil_flow_rate_metal_coiling_cfm_ft2(climate_zone)
end

# Implement occupancy based lighting level threshold (0.02 W/sqft). This is only for ASHRAE 90.1 2016 onwards.
#
# @code_sections [90.1-2016_9.4.1.1.h/i]
# @note code_sections [90.1-2016_9.4.1.1.h/i]
# @author Xuechen (Jerry) Lei, PNNL
# @param model [OpenStudio::Model::Model] OpenStudio Model
#
# @param model [OpenStudio::Model::Model] OpenStudio Model
# @return [Bool] returns true if successful, false if not
def model_add_lights_shutoff(model)
zones = model.getThermalZones
num_zones = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class ASHRAE9012019 < ASHRAE901
# @!group Pump

# Determine type of pump part load control type
# @note code_sections [90.1-2019_6.5.4.2]
#
# @code_sections [90.1-2019_6.5.4.2]
# @param pump [OpenStudio::Model::PumpVariableSpeed] OpenStudio pump object
# @param plant_loop_type [String] Type of plant loop
# @param pump_nominal_hp [Float] Pump nominal horsepower
Expand Down Expand Up @@ -135,10 +135,9 @@ def pump_variable_speed_get_control_type(pump, plant_loop_type, pump_nominal_hp)
return false
end

if pump_nominal_hp * design_sizing_factor > threshold
return 'VSD DP Reset'
else
return 'Riding Curve'
end
return 'VSD DP Reset' if pump_nominal_hp * design_sizing_factor > threshold

# else
return 'Riding Curve'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ class DOERef1980to2004 < ASHRAE901

# Add an elevator the the specified space
#
# @param space [OpenStudio::Model::Space] the space
# to assign the elevators to.
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @param space [OpenStudio::Model::Space] the space to assign the elevators to.
# @param number_of_elevators [Integer] the number of elevators
# @param elevator_type [String] valid choices are
# Traction, Hydraulic
# @param elevator_type [String] valid choices are Traction, Hydraulic
# @param elevator_schedule [String] the name of the elevator schedule
# @param elevator_fan_schedule [String] the name of the elevator fan schedule
# @param elevator_lights_schedule [String] the name of the elevator lights schedule
# @param building_type [String] the building type
# @return [OpenStudio::Model::ElectricEquipment] the resulting elevator
# @todo Inconsistency. Older vintages don't have lights or fans
# in elevators, which is not realistic.
# @todo Inconsistency. Older vintages don't have lights or fans in elevators, which is not realistic.
def model_add_elevator(model,
space,
number_of_elevators,
Expand Down Expand Up @@ -75,11 +73,13 @@ def model_add_elevator(model,
return elevator_equipment
end

# Determines the power required by an individual elevator
# of a given type. Values used by the older vintages
# are slightly higher than those used by the DOE prototypes.
# @param elevator_type [String] valid choices are
# Traction, Hydraulic
# Determines the power required by an individual elevator of a given type.
# Values used by the older vintages are slightly higher than those used by the DOE prototypes.
#
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @param elevator_type [String] valid choices are Traction, Hydraulic
# @param building_type [string] the building type
# @return [Double] elevator lift power in watts
def model_elevator_lift_power(model, elevator_type, building_type)
lift_pwr_w = 0
if elevator_type == 'Traction'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
class DOERef1980to2004 < ASHRAE901
# @!group refrigeration

# Determine the latent case credit curve to use
# for walkins.
# @todo Should probably use the model_add_refrigeration_walkin
# and lookups from the spreadsheet instead of hard-coded values.
# Determine the latent case credit curve to use for walkins.
# @todo Should probably use the model_add_refrigeration_walkin and lookups from the spreadsheet instead of hard-coded values.
#
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @return [String] curve name
def model_walkin_freezer_latent_case_credit_curve(model)
latent_case_credit_curve_name = 'Single Shelf Horizontal Latent Energy Multiplier_Pre2004'
return latent_case_credit_curve_name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
class DOERefPre1980 < ASHRAE901
# @!group CoilHeatingGas

# Updates the efficiency of some gas heating coils
# per the prototype assumptions. Sets heating coils
# inside PSZ-AC systems to 78% efficiency per
# the older vintages.
# Updates the efficiency of some gas heating coils per the prototype assumptions.
# Sets heating coils inside PSZ-AC systems to 78% efficiency per the older vintages.
# @todo Refactor: remove inconsistency in logic; all coils should be lower efficiency
#
# @param coil_heating_gas [OpenStudio::Model::CoilHeatingGas] a gas heating coil
# @return [Bool] returns true if successful, false if not
def coil_heating_gas_apply_prototype_efficiency(coil_heating_gas)
# Only modify coils in PSZ-AC units
name_patterns = ['PSZ-AC Gas Htg Coil',
Expand Down
Loading

0 comments on commit c453c7a

Please sign in to comment.