Class: ECMS

Inherits:
NECB2011 show all
Defined in:
lib/openstudio-standards/standards/necb/ECMS/nv.rb,
lib/openstudio-standards/standards/necb/ECMS/erv.rb,
lib/openstudio-standards/standards/necb/ECMS/ecms.rb,
lib/openstudio-standards/standards/necb/ECMS/loads.rb,
lib/openstudio-standards/standards/necb/ECMS/pv_ground.rb,
lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb

Constant Summary

Constants inherited from Standard

Standard::STANDARDS_LIST

Instance Attribute Summary

Attributes inherited from NECB2011

#fuel_type_set, #qaqc_data, #space_multiplier_map, #space_type_map, #standards_data, #tbd, #template

Attributes inherited from Standard

#space_multiplier_map, #standards_data, #template

Instance Method Summary collapse

Methods inherited from NECB2011

#add_all_spacetypes_to_model, #add_onespeed_DX_coil, #add_onespeed_htg_DX_coil, #add_ptac_dx_cooling, #add_sys1_unitary_ac_baseboard_heating, #add_sys1_unitary_ac_baseboard_heating_multi_speed, #add_sys1_unitary_ac_baseboard_heating_single_speed, #add_sys2_FPFC_sys5_TPFC, #add_sys3_and_8_zone_equip, #add_sys3and8_single_zone_packaged_rooftop_unit_with_baseboard_heating, #add_sys3and8_single_zone_packaged_rooftop_unit_with_baseboard_heating_multi_speed, #add_sys3and8_single_zone_packaged_rooftop_unit_with_baseboard_heating_single_speed, #add_sys4_single_zone_make_up_air_unit_with_baseboard_heating, #add_sys6_multi_zone_built_up_system_with_baseboard_heating, #add_sys6_multi_zone_reference_hp_with_baseboard_heating, #add_system_3_and_8_airloop, #add_system_3_and_8_airloop_multi_speed, #add_zone_baseboards, #adjust_wildcard_spacetype_schedule, #air_loop_hvac_apply_economizer_integration, #air_loop_hvac_apply_energy_recovery_ventilator, #air_loop_hvac_apply_multizone_vav_outdoor_air_sizing, #air_loop_hvac_apply_single_zone_controls, #air_loop_hvac_apply_vav_damper_action, #air_loop_hvac_demand_control_ventilation_required?, #air_loop_hvac_economizer_required?, #air_loop_hvac_enable_unoccupied_fan_shutoff, #air_loop_hvac_energy_recovery_ventilator_required?, #air_loop_hvac_motorized_oa_damper_limits, #air_loop_hvac_static_pressure_reset_required?, #air_terminal_single_duct_vav_reheat_set_heating_cap, #apply_auto_zoning, #apply_building_default_constructionset, #apply_default_constructionsets_to_spacetypes, #apply_economizers, #apply_envelope, #apply_fdwr_srr_daylighting, #apply_kiva_foundation, #apply_limit_fdwr, #apply_loads, #apply_loop_pump_power, #apply_max_fdwr_nrcan, #apply_max_srr_nrcan, #apply_standard_construction_properties, #apply_standard_efficiencies, #apply_standard_lights, #apply_standard_skylight_to_roof_ratio, #apply_standard_window_to_wall_ratio, #apply_systems, #apply_systems_and_efficiencies, #apply_thermal_bridging, #apply_weather_data, #are_space_loads_similar?, #are_zone_loads_similar?, #assign_base_sys_name, #assign_contruction_to_adiabatic_surfaces, #auto_size_shw_capacity, #auto_size_shw_pump_head, #auto_system_all_other_spaces, #auto_system_dwelling_units, #auto_system_storage_spaces, #auto_system_wet_spaces, #auto_system_wild_spaces, #auto_zone_all_other_spaces, #auto_zone_dwelling_units, #auto_zone_wet_spaces, #auto_zone_wild_spaces, #boiler_hot_water_apply_efficiency_and_curves, #boiler_hot_water_find_search_criteria, #check_boolean_value, #check_datapoint_weather_folder, #chiller_electric_eir_apply_efficiency_and_curves, #clean_and_scale_model, #coil_cooling_dx_multi_speed_apply_efficiency_and_curves, #coil_dx_heating_type, #coil_heating_dx_single_speed_find_capacity, #coil_heating_gas_apply_efficiency_and_curves, #coil_heating_gas_find_capacity, #coil_heating_gas_find_search_criteria, #coil_heating_gas_multi_stage_apply_efficiency_and_curves, #coil_heating_gas_standard_minimum_thermal_efficiency, #common_air_loop, #convert_arg_to_bool, #convert_arg_to_f, #convert_arg_to_string, #corrupt_standards_database, #create_base_data, #create_ems_to_turn_on_AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_for_night_cycle, #create_heating_cooling_on_off_availability_schedule, #create_hw_loop_if_required, #create_necb_system, #determine_control_zone, #determine_dominant_necb_schedule_type, #determine_dominant_schedule, #determine_necb_schedule_type, #determine_spacetype_vintage, #distance, #download_and_save_file, #extract_weather_data, #fan_baseline_impeller_efficiency, #fan_constant_volume_apply_prototype_fan_pressure_rise, #fan_standard_minimum_motor_efficiency_and_size, #fan_variable_volume_apply_prototype_fan_pressure_rise, #fan_variable_volume_part_load_fan_power_limitation?, #find_mech_room, #friction_factor, #get_all_spacetype_names, #get_any_number_ppm, #get_climate_zone_index, #get_climate_zone_name, #get_max_space_height_for_space_type, #get_necb_hdd18, #get_necb_spacetype_system_selection, #get_necb_thermal_zone_system_selection, #get_parameters_sidelighting, #get_parameters_skylight, #get_qaqc_table, #get_sql_table_to_json, #get_sql_tables_to_json, #get_standard_constant_value, #get_standards_constant, #get_standards_formula, #get_standards_table, #get_surface_exp_per, #get_weather_file_from_repo, #group_similar_zones_together, #heat_exchanger_air_to_air_sensible_and_latent_apply_effectiveness, #init_qaqc, #is_a_necb_dwelling_unit?, #is_an_necb_storage_space?, #is_an_necb_wet_space?, #is_an_necb_wildcard_space?, #load_building_type_from_library, #load_qaqc_database_new, #look_up_csv_data, #max_fwdr, #merge_recursively, #model_add_construction_set_from_osm, #model_add_constructions, #model_add_daylighting_controls, #model_add_hvac, #model_add_loads, #model_add_schedule, #model_add_swh, #model_apply_sizing_parameters, #model_apply_standard, #model_create_prototype_model, #model_create_thermal_zones, #model_enable_demand_controlled_ventilation, #model_find_climate_zone_set, #necb_design_supply_temp_compliance, #necb_economizer_compliance, #necb_envelope_compliance, #necb_exterior_fenestration_compliance, #necb_exterior_ground_surfaces_compliance, #necb_exterior_opaque_compliance, #necb_hrv_compliance, #necb_hrv_compliance_for_single_airloop, #necb_hrv_compliance_inc_murb, #necb_infiltration_compliance, #necb_plantloop_sanity, #necb_qaqc, #necb_section_test, #necb_space_compliance, #necb_vav_fan_power_compliance, #necb_zone_sizing_compliance, #new_add_sys6_multi_zone_built_up_system_with_baseboard_heating, #percentage_difference, #pump_standard_minimum_motor_efficiency_and_size, #pump_variable_speed_control_type, #qaqc_only, #replace_massless_material_with_std_material, #sanity_check, #scale_model_geometry, #set_boiler_cap_ratios, #set_lighting_per_area, #set_lighting_per_area_led_lighting, #set_necb_external_subsurface_conductance, #set_necb_external_surface_conductance, #set_occ_sensor_spacetypes, #set_output_meters, #set_output_variables, #set_random_rendering_color, #set_wildcard_schedules_to_dominant_building_schedule, #set_zones_thermostat_schedule_based_on_space_type_schedules, #setup_chw_loop_with_components, #setup_cw_loop_with_components, #setup_hw_loop_with_components, #space_apply_infiltration_rate, #space_surface_report, #space_type_apply_internal_loads, #store_space_sizing_loads, #stored_space_cooling_load, #stored_space_heating_load, #stored_zone_cooling_load, #stored_zone_heating_load, #surfaces_are_in_contact?, #thermal_zone_demand_control_ventilation_required?, #thermal_zone_get_centroid_per_floor, #three_vertices_same_line_and_dir?, #update_sys_name, #validate_and_upate_space_types, #validate_primary_heating_fuel, #water_heater_mixed_apply_efficiency, #zone_hvac_component_occupancy_ventilation_control

Methods inherited from Standard

#adjust_sizing_system, #afue_to_thermal_eff, #air_loop_hvac_add_motorized_oa_damper, #air_loop_hvac_adjust_minimum_vav_damper_positions, #air_loop_hvac_adjust_minimum_vav_damper_positions_outpatient, #air_loop_hvac_allowable_system_brake_horsepower, #air_loop_hvac_apply_baseline_fan_pressure_rise, #air_loop_hvac_apply_economizer_integration, #air_loop_hvac_apply_economizer_limits, #air_loop_hvac_apply_energy_recovery_ventilator, #air_loop_hvac_apply_energy_recovery_ventilator_efficiency, #air_loop_hvac_apply_maximum_reheat_temperature, #air_loop_hvac_apply_minimum_vav_damper_positions, #air_loop_hvac_apply_multizone_vav_outdoor_air_sizing, #air_loop_hvac_apply_prm_baseline_controls, #air_loop_hvac_apply_prm_baseline_economizer, #air_loop_hvac_apply_prm_baseline_fan_power, #air_loop_hvac_apply_prm_sizing_temperatures, #air_loop_hvac_apply_single_zone_controls, #air_loop_hvac_apply_standard_controls, #air_loop_hvac_apply_vav_damper_action, #air_loop_hvac_data_center_area_served, #air_loop_hvac_dcv_required_when_erv, #air_loop_hvac_demand_control_ventilation_limits, #air_loop_hvac_demand_control_ventilation_required?, #air_loop_hvac_disable_multizone_vav_optimization, #air_loop_hvac_dx_cooling?, #air_loop_hvac_economizer?, #air_loop_hvac_economizer_limits, #air_loop_hvac_economizer_required?, #air_loop_hvac_economizer_type_allowable?, #air_loop_hvac_enable_demand_control_ventilation, #air_loop_hvac_enable_multizone_vav_optimization, #air_loop_hvac_enable_optimum_start, #air_loop_hvac_enable_supply_air_temperature_reset_delta, #air_loop_hvac_enable_supply_air_temperature_reset_outdoor_temperature, #air_loop_hvac_enable_supply_air_temperature_reset_warmest_zone, #air_loop_hvac_enable_unoccupied_fan_shutoff, #air_loop_hvac_energy_recovery?, #air_loop_hvac_energy_recovery_ventilator_flow_limit, #air_loop_hvac_energy_recovery_ventilator_heat_exchanger_type, #air_loop_hvac_energy_recovery_ventilator_required?, #air_loop_hvac_energy_recovery_ventilator_type, #air_loop_hvac_fan_power_limitation_pressure_drop_adjustment_brake_horsepower, #air_loop_hvac_find_design_supply_air_flow_rate, #air_loop_hvac_floor_area_served, #air_loop_hvac_floor_area_served_exterior_zones, #air_loop_hvac_floor_area_served_interior_zones, #air_loop_hvac_get_occupancy_schedule, #air_loop_hvac_get_relief_fan_power, #air_loop_hvac_get_return_fan_power, #air_loop_hvac_get_supply_fan, #air_loop_hvac_get_supply_fan_power, #air_loop_hvac_has_parallel_piu_air_terminals?, #air_loop_hvac_has_simple_transfer_air?, #air_loop_hvac_humidifier_count, #air_loop_hvac_include_cooling_coil?, #air_loop_hvac_include_economizer?, #air_loop_hvac_include_evaporative_cooler?, #air_loop_hvac_include_hydronic_cooling_coil?, #air_loop_hvac_include_unitary_system?, #air_loop_hvac_include_wshp?, #air_loop_hvac_integrated_economizer_required?, #air_loop_hvac_minimum_zone_ventilation_efficiency, #air_loop_hvac_motorized_oa_damper_limits, #air_loop_hvac_motorized_oa_damper_required?, #air_loop_hvac_multi_stage_dx_cooling?, #air_loop_hvac_multizone_vav_optimization_required?, #air_loop_hvac_multizone_vav_system?, #air_loop_hvac_optimum_start_required?, #air_loop_hvac_prm_baseline_economizer_required?, #air_loop_hvac_prm_economizer_type_and_limits, #air_loop_hvac_remove_erv, #air_loop_hvac_remove_motorized_oa_damper, #air_loop_hvac_residential_area_served, #air_loop_hvac_return_air_plenum, #air_loop_hvac_set_minimum_damper_position, #air_loop_hvac_set_vsd_curve_type, #air_loop_hvac_single_zone_controls_num_stages, #air_loop_hvac_standby_mode_occupancy_control, #air_loop_hvac_static_pressure_reset_required?, #air_loop_hvac_supply_air_temperature_reset_required?, #air_loop_hvac_supply_return_exhaust_relief_fans, #air_loop_hvac_system_fan_brake_horsepower, #air_loop_hvac_system_multiplier, #air_loop_hvac_terminal_reheat?, #air_loop_hvac_total_cooling_capacity, #air_loop_hvac_unitary_system?, #air_loop_hvac_unoccupied_fan_shutoff_required?, #air_loop_hvac_unoccupied_threshold, #air_loop_hvac_vav_damper_action, #air_loop_hvac_vav_system?, #air_terminal_single_duct_parallel_piu_reheat_apply_minimum_primary_airflow_fraction, #air_terminal_single_duct_parallel_piu_reheat_apply_prm_baseline_fan_power, #air_terminal_single_duct_parallel_piu_reheat_fan_on_flow_fraction, #air_terminal_single_duct_parallel_reheat_piu_minimum_primary_airflow_fraction, #air_terminal_single_duct_vav_reheat_apply_initial_prototype_damper_position, #air_terminal_single_duct_vav_reheat_apply_minimum_damper_position, #air_terminal_single_duct_vav_reheat_minimum_damper_position, #air_terminal_single_duct_vav_reheat_reheat_type, #air_terminal_single_duct_vav_reheat_set_heating_cap, #apply_lighting_schedule, #apply_limit_to_subsurface_ratio, #boiler_get_eff_fplr, #boiler_hot_water_apply_efficiency_and_curves, #boiler_hot_water_find_capacity, #boiler_hot_water_find_design_water_flow_rate, #boiler_hot_water_find_search_criteria, #boiler_hot_water_standard_minimum_thermal_efficiency, build, #chiller_electric_eir_apply_efficiency_and_curves, #chiller_electric_eir_find_search_criteria, #chiller_electric_eir_get_cap_f_t_curve_name, #chiller_electric_eir_get_eir_f_plr_curve_name, #chiller_electric_eir_get_eir_f_t_curve_name, #chiller_electric_eir_standard_minimum_full_load_efficiency, #chw_sizing_control, #coil_cooling_dx_multi_speed_apply_efficiency_and_curves, #coil_cooling_dx_multi_speed_find_capacity, #coil_cooling_dx_multi_speed_standard_minimum_cop, #coil_cooling_dx_single_speed_apply_efficiency_and_curves, #coil_cooling_dx_single_speed_find_capacity, #coil_cooling_dx_single_speed_standard_minimum_cop, #coil_cooling_dx_two_speed_apply_efficiency_and_curves, #coil_cooling_dx_two_speed_find_capacity, #coil_cooling_dx_two_speed_standard_minimum_cop, #coil_cooling_water_to_air_heat_pump_apply_efficiency_and_curves, #coil_cooling_water_to_air_heat_pump_find_capacity, #coil_cooling_water_to_air_heat_pump_standard_minimum_cop, #coil_heating_dx_multi_speed_apply_efficiency_and_curves, #coil_heating_dx_single_speed_apply_defrost_eir_curve_limits, #coil_heating_dx_single_speed_apply_efficiency_and_curves, #coil_heating_dx_single_speed_find_capacity, #coil_heating_dx_single_speed_standard_minimum_cop, #coil_heating_gas_additional_search_criteria, #coil_heating_gas_apply_efficiency_and_curves, #coil_heating_gas_apply_prototype_efficiency, #coil_heating_gas_find_capacity, #coil_heating_gas_multi_stage_apply_efficiency_and_curves, #coil_heating_gas_multi_stage_find_capacity, #coil_heating_gas_multi_stage_find_search_criteria, #coil_heating_water_to_air_heat_pump_apply_efficiency_and_curves, #coil_heating_water_to_air_heat_pump_find_capacity, #coil_heating_water_to_air_heat_pump_standard_minimum_cop, #combustion_eff_to_thermal_eff, #controller_water_coil_set_convergence_limits, #convert_curve_biquadratic, #cooling_tower_single_speed_apply_efficiency_and_curves, #cooling_tower_two_speed_apply_efficiency_and_curves, #cooling_tower_variable_speed_apply_efficiency_and_curves, #cop_heating_to_cop_heating_no_fan, #cop_no_fan_to_eer, #cop_no_fan_to_seer, #cop_to_eer, #cop_to_kw_per_ton, #cop_to_seer, #create_air_conditioner_variable_refrigerant_flow, #create_boiler_hot_water, #create_central_air_source_heat_pump, #create_coil_cooling_dx_single_speed, #create_coil_cooling_dx_two_speed, #create_coil_cooling_water, #create_coil_cooling_water_to_air_heat_pump_equation_fit, #create_coil_heating_dx_single_speed, #create_coil_heating_electric, #create_coil_heating_gas, #create_coil_heating_water, #create_coil_heating_water_to_air_heat_pump_equation_fit, #create_curve_bicubic, #create_curve_biquadratic, #create_curve_cubic, #create_curve_exponent, #create_curve_quadratic, #create_fan_constant_volume, #create_fan_constant_volume_from_json, #create_fan_on_off, #create_fan_on_off_from_json, #create_fan_variable_volume, #create_fan_variable_volume_from_json, #create_fan_zone_exhaust, #create_fan_zone_exhaust_from_json, #define_space_multiplier, #eer_to_cop, #eer_to_cop_no_fan, #ems_friendly_name, #enthalpy_recovery_ratio_design_to_typical_adjustment, #fan_constant_volume_airloop_fan_pressure_rise, #fan_constant_volume_apply_prototype_fan_pressure_rise, #fan_on_off_airloop_or_unitary_fan_pressure_rise, #fan_on_off_apply_prototype_fan_pressure_rise, #fan_variable_volume_airloop_fan_pressure_rise, #fan_variable_volume_apply_prototype_fan_pressure_rise, #fan_variable_volume_cooling_system_type, #fan_variable_volume_part_load_fan_power_limitation?, #fan_variable_volume_part_load_fan_power_limitation_capacity_limit, #fan_variable_volume_part_load_fan_power_limitation_hp_limit, #fan_variable_volume_set_control_type, #fan_zone_exhaust_apply_prototype_fan_pressure_rise, #find_exposed_conditioned_roof_surfaces, #find_exposed_conditioned_vertical_surfaces, #find_highest_roof_centre, #fluid_cooler_apply_minimum_power_per_flow, #get_avg_of_other_zones, #get_default_surface_cons_from_surface_type, #get_fan_object_for_airloop, #get_fan_schedule_for_each_zone, #get_group_heat_types, #get_outdoor_subsurface_ratio, #get_weekday_values_from_8760, #get_wtd_avg_of_other_zones, #headered_pumps_variable_speed_set_control_type, #heat_exchanger_air_to_air_sensible_and_latent_apply_effectiveness, #heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_efficiency, #heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_efficiency_enthalpy_recovery_ratio, #heat_exchanger_air_to_air_sensible_and_latent_apply_prototype_nominal_electric_power, #heat_exchanger_air_to_air_sensible_and_latent_enthalpy_recovery_ratio_to_effectiveness, #heat_exchanger_air_to_air_sensible_and_latent_minimum_effectiveness, #heat_exchanger_air_to_air_sensible_and_latent_prototype_default_fan_efficiency, #hspf_to_cop, #hspf_to_cop_no_fan, #interior_lighting_get_prm_data, #kw_per_ton_to_cop, #load_hvac_map, #load_initial_osm, #load_standards_database, #make_ruleset_sched_from_8760, #make_week_ruleset_sched_from_168, #model_add_baseboard, #model_add_cav, #model_add_central_air_source_heat_pump, #model_add_chw_loop, #model_add_construction, #model_add_construction_set, #model_add_crac, #model_add_crah, #model_add_curve, #model_add_cw_loop, #model_add_data_center_hvac, #model_add_data_center_load, #model_add_daylighting_controls, #model_add_district_ambient_loop, #model_add_doas, #model_add_doas_cold_supply, #model_add_elevator, #model_add_elevators, #model_add_evap_cooler, #model_add_exhaust_fan, #model_add_four_pipe_fan_coil, #model_add_furnace_central_ac, #model_add_ground_hx_loop, #model_add_high_temp_radiant, #model_add_hp_loop, #model_add_hvac, #model_add_hvac_system, #model_add_hw_loop, #model_add_ideal_air_loads, #model_add_low_temp_radiant, #model_add_material, #model_add_minisplit_hp, #model_add_plant_supply_water_temperature_control, #model_add_prm_baseline_system, #model_add_prm_elevators, #model_add_psz_ac, #model_add_psz_vav, #model_add_ptac, #model_add_pthp, #model_add_pvav, #model_add_pvav_pfp_boxes, #model_add_radiant_basic_controls, #model_add_radiant_proportional_controls, #model_add_refrigeration_case, #model_add_refrigeration_compressor, #model_add_refrigeration_system, #model_add_refrigeration_walkin, #model_add_residential_erv, #model_add_residential_ventilator, #model_add_schedule, #model_add_split_ac, #model_add_swh, #model_add_swh_end_uses_by_space, #model_add_transformer, #model_add_typical_exterior_lights, #model_add_typical_refrigeration, #model_add_typical_swh, #model_add_unitheater, #model_add_vav_pfp_boxes, #model_add_vav_reheat, #model_add_vrf, #model_add_water_source_hp, #model_add_waterside_economizer, #model_add_window_ac, #model_add_zone_erv, #model_add_zone_heat_cool_request_count_program, #model_add_zone_ventilation, #model_apply_baseline_exterior_lighting, #model_apply_hvac_efficiency_standard, #model_apply_infiltration_standard, #model_apply_multizone_vav_outdoor_air_sizing, #model_apply_prm_baseline_sizing_schedule, #model_apply_prm_baseline_skylight_to_roof_ratio, #model_apply_prm_baseline_window_to_wall_ratio, #model_apply_prm_construction_types, #model_apply_prm_sizing_parameters, #model_apply_standard_constructions, #model_apply_standard_infiltration, #model_baseline_system_vav_fan_type, #model_create_exterior_lighting_area_length_count_hash, #model_create_multizone_fan_schedule, #model_create_prm_any_baseline_building, #model_create_prm_baseline_building, #model_create_prm_baseline_building_requires_proposed_model_sizing_run, #model_create_prm_baseline_building_requires_vlt_sizing_run, #model_create_prm_proposed_building, #model_create_prm_stable_baseline_building, #model_create_space_type_hash, #model_create_story_hash, #model_cw_loop_cooling_tower_fan_type, #model_differentiate_primary_secondary_thermal_zones, #model_effective_num_stories, #model_elevator_fan_pwr, #model_elevator_lift_power, #model_elevator_lighting_pct_incandescent, #model_eliminate_outlier_zones, #model_find_and_add_construction, #model_find_ashrae_hot_water_demand, #model_find_climate_zone_set, #model_find_icc_iecc_2015_hot_water_demand, #model_find_icc_iecc_2015_internal_loads, #model_find_object, #model_find_objects, #model_find_prototype_floor_area, #model_find_target_eui, #model_find_target_eui_by_end_use, #model_find_water_heater_capacity_volume_and_parasitic, #model_get_baseline_system_type_by_zone, #model_get_building_properties, #model_get_climate_zone_set_from_list, #model_get_construction_properties, #model_get_construction_set, #model_get_district_heating_zones, #model_get_lookup_name, #model_get_or_add_ambient_water_loop, #model_get_or_add_chilled_water_loop, #model_get_or_add_ground_hx_loop, #model_get_or_add_heat_pump_loop, #model_get_or_add_hot_water_loop, #model_is_hvac_autosized, #model_legacy_results_by_end_use_and_fuel_type, #model_make_name, #model_prm_baseline_system_change_fuel_type, #model_prm_baseline_system_groups, #model_prm_baseline_system_number, #model_prm_baseline_system_type, #model_prm_skylight_to_roof_ratio_limit, #model_process_results_for_datapoint, #model_remap_office, #model_remove_external_shading_devices, #model_remove_prm_ems_objects, #model_remove_prm_hvac, #model_remove_unused_resource_objects, #model_set_vav_terminals_to_control_for_outdoor_air, #model_system_outdoor_air_sizing_vrp_method, #model_two_pipe_loop, #model_typical_display_case_zone, #model_typical_hvac_system_type, #model_typical_walkin_zone, #model_validate_standards_spacetypes_in_model, #model_ventilation_method, #model_walkin_freezer_latent_case_credit_curve, #model_zones_with_occ_and_fuel_type, #planar_surface_apply_standard_construction, #plant_loop_adiabatic_pipes_only, #plant_loop_apply_prm_baseline_chilled_water_pumping_type, #plant_loop_apply_prm_baseline_chilled_water_temperatures, #plant_loop_apply_prm_baseline_condenser_water_pumping_type, #plant_loop_apply_prm_baseline_condenser_water_temperatures, #plant_loop_apply_prm_baseline_hot_water_pumping_type, #plant_loop_apply_prm_baseline_hot_water_temperatures, #plant_loop_apply_prm_baseline_pump_power, #plant_loop_apply_prm_baseline_pumping_type, #plant_loop_apply_prm_baseline_temperatures, #plant_loop_apply_prm_number_of_boilers, #plant_loop_apply_prm_number_of_chillers, #plant_loop_apply_prm_number_of_cooling_towers, #plant_loop_apply_standard_controls, #plant_loop_capacity_w_by_maxflow_and_delta_t_forwater, #plant_loop_enable_supply_water_temperature_reset, #plant_loop_find_maximum_loop_flow_rate, #plant_loop_prm_baseline_condenser_water_temperatures, #plant_loop_set_chw_pri_sec_configuration, #plant_loop_supply_water_temperature_reset_required?, #plant_loop_swh_loop?, #plant_loop_swh_system_type, #plant_loop_total_cooling_capacity, #plant_loop_total_floor_area_served, #plant_loop_total_heating_capacity, #plant_loop_total_rated_w_per_gpm, #plant_loop_variable_flow_system?, #prototype_apply_condenser_water_temperatures, #prototype_condenser_water_temperatures, #pump_variable_speed_control_type, #pump_variable_speed_get_control_type, #pump_variable_speed_set_control_type, register_standard, #remove_all_hvac, #remove_all_plant_loops, #remove_all_zone_equipment, #remove_hvac, #remove_plant_loops, #remove_unused_curves, #remove_vrf, #remove_zone_equipment, #rename_air_loop_nodes, #rename_plant_loop_nodes, #safe_load_model, #seer_to_cop, #seer_to_cop_no_fan, #set_maximum_fraction_outdoor_air_schedule, #space_add_daylighting_controls, #space_apply_infiltration_rate, #space_conditioning_category, #space_daylighted_area_window_width, #space_daylighted_areas, #space_daylighting_control_required?, #space_daylighting_fractions_and_windows, #space_get_equip_annual_array, #space_get_loads_for_all_equips, #space_infiltration_rate_75_pa, #space_internal_load_annual_array, #space_occupancy_annual_array, #space_remove_daylighting_controls, #space_set_baseline_daylighting_controls, #space_sidelighting_effective_aperture, #space_skylight_effective_aperture, #space_type_apply_int_loads_prm, #space_type_apply_internal_load_schedules, #space_type_apply_internal_loads, #space_type_apply_rendering_color, #space_type_get_construction_properties, #space_type_get_standards_data, #space_type_light_sch_change, #standard_design_sizing_temperatures, #standards_lookup_table_first, #standards_lookup_table_many, #strip_model, #sub_surface_create_centered_subsurface_from_scaled_surface, #sub_surface_create_scaled_subsurfaces_from_surface, #surface_adjust_fenestration_in_a_surface, #surface_subsurface_ua, #thermal_eff_to_afue, #thermal_eff_to_comb_eff, #thermal_zone_add_exhaust, #thermal_zone_add_exhaust_fan_dcv, #thermal_zone_apply_prm_baseline_supply_temperatures, #thermal_zone_conditioning_category, #thermal_zone_demand_control_ventilation_limits, #thermal_zone_demand_control_ventilation_required?, #thermal_zone_exhaust_fan_dcv_required?, #thermal_zone_fossil_or_electric_type, #thermal_zone_get_annual_operating_hours, #thermal_zone_get_zone_fuels_for_occ_and_fuel_type, #thermal_zone_infer_system_type, #thermal_zone_occupancy_eflh, #thermal_zone_occupancy_type, #thermal_zone_peak_internal_load, #thermal_zone_prm_baseline_cooling_design_supply_temperature, #thermal_zone_prm_baseline_heating_design_supply_temperature, #thermal_zone_prm_lab_delta_t, #thermal_zone_prm_unitheater_design_supply_temperature, #true?, #validate_initial_model, #water_heater_convert_energy_factor_to_thermal_efficiency_and_ua, #water_heater_convert_uniform_energy_factor_to_energy_factor, #water_heater_determine_sub_type, #water_heater_mixed_additional_search_criteria, #water_heater_mixed_apply_efficiency, #water_heater_mixed_apply_prm_baseline_fuel_type, #water_heater_mixed_find_capacity, #water_heater_mixed_get_efficiency_requirement, #zone_hvac_component_apply_prm_baseline_fan_power, #zone_hvac_component_apply_standard_controls, #zone_hvac_component_apply_vestibule_heating_control, #zone_hvac_component_occupancy_ventilation_control, #zone_hvac_component_prm_baseline_fan_efficacy, #zone_hvac_component_vestibule_heating_control_required?, #zone_hvac_get_fan_object, #zone_hvac_model_standby_mode_occupancy_control, #zone_hvac_unoccupied_threshold

Methods included from PrototypeFan

apply_base_fan_variables, #create_fan_by_name, #get_fan_from_standards, #lookup_fan_curve_coefficients_from_json, #prototype_fan_apply_prototype_fan_efficiency

Methods included from CoilDX

#coil_dx_find_search_criteria, #coil_dx_heat_pump?, #coil_dx_heating_type, #coil_dx_subcategory

Methods included from CoolingTower

#cooling_tower_apply_minimum_power_per_flow, #cooling_tower_apply_minimum_power_per_flow_gpm_limit

Methods included from Pump

#pump_apply_prm_pressure_rise_and_motor_efficiency, #pump_apply_standard_minimum_motor_efficiency, #pump_brake_horsepower, #pump_motor_horsepower, #pump_pumppower, #pump_rated_w_per_gpm, #pump_standard_minimum_motor_efficiency_and_size

Methods included from Fan

#fan_adjust_pressure_rise_to_meet_fan_power, #fan_apply_standard_minimum_motor_efficiency, #fan_baseline_impeller_efficiency, #fan_brake_horsepower, #fan_change_impeller_efficiency, #fan_change_motor_efficiency, #fan_design_air_flow, #fan_fanpower, #fan_motor_horsepower, #fan_rated_w_per_cfm, #fan_small_fan?, #fan_standard_minimum_motor_efficiency_and_size

Constructor Details

#initializeECMS

Returns a new instance of ECMS.



36
37
38
39
40
# File 'lib/openstudio-standards/standards/necb/ECMS/ecms.rb', line 36

def initialize
  super()
  @standards_data = load_standards_database_new
  @standards_data['curves'] = standards_data['tables']['curves']['table']
end

Instance Method Details

#add_air_system(model:, zones:, sys_abbr:, sys_vent_type:, sys_heat_rec_type:, sys_htg_eqpt_type:, sys_supp_htg_eqpt_type:, sys_clg_eqpt_type:, sys_supp_fan_type:, sys_ret_fan_type:, sys_setpoint_mgr_type:) ⇒ Object

add air system with all its components



775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 775

def add_air_system(model:,
                   zones:,
                   sys_abbr:,
                   sys_vent_type:,
                   sys_heat_rec_type:,
                   sys_htg_eqpt_type:,
                   sys_supp_htg_eqpt_type:,
                   sys_clg_eqpt_type:,
                   sys_supp_fan_type:,
                   sys_ret_fan_type:,
                   sys_setpoint_mgr_type:)

  # create all the needed components and the air loop
  airloop = create_airloop(model, sys_vent_type)
  setpoint_mgr = create_air_sys_spm(model, sys_setpoint_mgr_type, zones)
  supply_fan = create_air_sys_fan(model, sys_supp_fan_type)
  supply_fan.setName('Supply Fan') if supply_fan
  return_fan = create_air_sys_fan(model, sys_ret_fan_type)
  return_fan.setName('Return Fan') if return_fan
  htg_eqpt = create_air_sys_htg_eqpt(model, sys_htg_eqpt_type)
  supp_htg_eqpt = create_air_sys_htg_eqpt(model, sys_supp_htg_eqpt_type)
  clg_eqpt = create_air_sys_clg_eqpt(model, sys_clg_eqpt_type)
  # add components to the air loop
  clg_eqpt.addToNode(airloop.supplyOutletNode) if clg_eqpt
  htg_eqpt.addToNode(airloop.supplyOutletNode) if htg_eqpt
  supp_htg_eqpt.addToNode(airloop.supplyOutletNode) if supp_htg_eqpt
  supply_fan.addToNode(airloop.supplyOutletNode) if supply_fan
  setpoint_mgr.addToNode(airloop.supplyOutletNode) if setpoint_mgr

  # OA controller
  oa_controller = OpenStudio::Model::ControllerOutdoorAir.new(model)
  oa_controller.autosizeMinimumOutdoorAirFlowRate
  oa_system = OpenStudio::Model::AirLoopHVACOutdoorAirSystem.new(model, oa_controller)
  oa_system.addToNode(airloop.supplyInletNode)

  # Set airloop name
  sys_name_pars = {}
  sys_name_pars['sys_hr'] = 'none'
  sys_name_pars['sys_clg'] = sys_clg_eqpt_type
  sys_name_pars['sys_htg'] = sys_htg_eqpt_type
  sys_name_pars['sys_sf'] = 'cv' if sys_supp_fan_type == 'constant_volume'
  sys_name_pars['sys_sf'] = 'vv' if sys_supp_fan_type == 'variable_volume'
  sys_name_pars['zone_htg'] = 'none'
  sys_name_pars['zone_clg'] = 'none'
  sys_name_pars['sys_rf'] = 'none'
  sys_name_pars['sys_rf'] = 'cv' if sys_ret_fan_type == 'constant_volume'
  sys_name_pars['sys_rf'] = 'vv' if sys_ret_fan_type == 'variable_volume'
  assign_base_sys_name(airloop, sys_abbr: sys_abbr, sys_oa: sys_vent_type, sys_name_pars: sys_name_pars)
  return airloop, clg_eqpt, htg_eqpt, return_fan
end

#add_airloop_economizer(model:, airloop_economizer_type:) ⇒ Object

Add air side economizer for each airloop



3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3657

def add_airloop_economizer(model:, airloop_economizer_type:)
  return if airloop_economizer_type.nil? || (airloop_economizer_type.to_s == 'NECB_Default')

  if airloop_economizer_type.downcase == "differentialenthalpy"
    economizer_type = 'DifferentialEnthalpy'
  elsif airloop_economizer_type.downcase == "differentialdrybulb"
    economizer_type = 'DifferentialDryBulb'
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.airLoopHVACOutdoorAirSystem', "The air loop economizer type #{airloop_economizer_type} is not recognized.  Please make sure that the economizer being applied by the ECM is either a DifferentialEnthalpy or DifferentialDryBulb type.  No economizer will be applied.")
    return
  end

  model.getAirLoopHVACs.sort.each do |air_loop|
    oa_sys = air_loop.airLoopHVACOutdoorAirSystem
    if oa_sys.is_initialized
      oa_sys = oa_sys.get
      oa_control = oa_sys.getControllerOutdoorAir
      oa_control.setEconomizerControlType(economizer_type)
    end
  end
end

#add_ecm_hs08_ccashp_vrf(model:, system_zones_map:, system_doas_flags:, ecm_system_zones_map_option:, standard:, air_sys_eqpt_type: 'ccashp') ⇒ Object

Add equipment for ECM ‘hs08_ccashp_vrf’:

-Constant-volume DOAS with air-source heat pump for heating and cooling and electric backup
-Zonal terminal VRF units connected to an outdoor VRF condenser unit
-Zonal electric or hot-water backup


502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 502

def add_ecm_hs08_ccashp_vrf(
  model:,
  system_zones_map:,
  system_doas_flags:,
  ecm_system_zones_map_option:,
  standard:,
  air_sys_eqpt_type: 'ccashp')

  # Get the heating fuel type from the system fuels object defined by the standards object
  heating_fuel = standard.fuel_type_set.ecm_fueltype

  # Create one hot-water loop for hot-water baseboards if required
  hw_loop = nil
  hw_loop = add_hotwater_loop(model: model, fuel_type_set: standard.fuel_type_set) if standard.fuel_type_set.baseboard_type == 'Hot Water'

  # Update system zones map if needed
  system_zones_map = update_system_zones_map_keys(system_zones_map,'sys_1')
  system_zones_map = update_system_zones_map(model,system_zones_map,ecm_system_zones_map_option,'sys_1') if ecm_system_zones_map_option != 'NECB_Default'
  # Add outdoor VRF unit
  outdoor_vrf_unit = add_outdoor_vrf_unit(model: model, ecm_name: 'hs08_ccashp_vrf')
  eqpt_name = 'Mitsubishi_Hyper_Heating_VRF_Outdoor_Unit'
  airconditioner_variablerefrigerantflow_cooling_apply_curves(outdoor_vrf_unit,eqpt_name)
  airconditioner_variablerefrigerantflow_heating_apply_curves(outdoor_vrf_unit,eqpt_name)
  # Update system doas flags
  system_doas_flags = {}
  system_zones_map.keys.each { |sname| system_doas_flags[sname] = true }

  # use system zones map and generate new air system and zonal equipment
  system_zones_map.sort.each do |sys_name, zones|
    sys_info = air_sys_comps_assumptions(sys_name: sys_name,
                                         zones: zones,
                                         system_doas_flags: system_doas_flags)
    sys_supp_htg_eqpt_type = 'coil_electric'
    sys_supp_htg_eqpt_type = 'coil_gas' if heating_fuel == 'NaturalGas'
    airloop,clg_dx_coil,htg_dx_coil,return_fan = add_air_system(model: model,
                                         zones: zones,
                                         sys_abbr: sys_info['sys_abbr'],
                                         sys_vent_type: sys_info['sys_vent_type'],
                                         sys_heat_rec_type: sys_info['sys_heat_rec_type'],
                                         sys_htg_eqpt_type: air_sys_eqpt_type,
                                         sys_supp_htg_eqpt_type: sys_supp_htg_eqpt_type,
                                         sys_clg_eqpt_type: air_sys_eqpt_type,
                                         sys_supp_fan_type: sys_info['sys_supp_fan_type'],
                                         sys_ret_fan_type: sys_info['sys_ret_fan_type'],
                                         sys_setpoint_mgr_type: sys_info['sys_setpoint_mgr_type'])
    # Appy performance curves
    if air_sys_eqpt_type == 'ccashp'
      eqpt_name = 'Mitsubishi_Hyper_Heating_VRF_Outdoor_Unit RTU'
      coil_cooling_dx_variable_speed_apply_curves(clg_dx_coil, eqpt_name)
      coil_heating_dx_variable_speed_apply_curves(htg_dx_coil, eqpt_name)
    elsif air_sys_eqpt_type == 'ashp'
      eqpt_name = 'NECB2015_ASHP'
      coil_cooling_dx_single_speed_apply_curves(clg_dx_coil, eqpt_name)
      coil_heating_dx_single_speed_apply_curves(htg_dx_coil, eqpt_name)
    else
      raise("add_ecm_hs08_ccashp_vrf: The air system equipment type is neither an ashp nor a ccashp")
    end
    # add zone equipment and diffuser
    # add terminal VRF units
    add_zone_eqpt(model: model,
                  airloop: airloop,
                  zones: zones,
                  outdoor_unit: outdoor_vrf_unit,
                  zone_diffuser_type: sys_info['zone_diffuser_type'],
                  zone_htg_eqpt_type: 'vrf',
                  zone_supp_htg_eqpt_type: 'none',
                  zone_clg_eqpt_type: 'vrf',
                  zone_fan_type: 'On_Off',
                  hw_loop: hw_loop)
    # add electric or hot-water baseboards for backup; Type of baseboard follows the primary heating fuel used in the building model.
    zone_htg_eqpt_type = 'baseboard_hotwater' if standard.fuel_type_set.baseboard_type == 'Hot Water'
    zone_htg_eqpt_type = 'baseboard_electric' if standard.fuel_type_set.baseboard_type == 'Electric'

    add_zone_eqpt(model: model,
                  airloop: airloop,
                  zones: zones,
                  outdoor_unit: nil,
                  zone_diffuser_type: nil,
                  zone_htg_eqpt_type: zone_htg_eqpt_type,
                  zone_supp_htg_eqpt_type: 'none',
                  zone_clg_eqpt_type: 'none',
                  zone_fan_type: 'none',
                  hw_loop: hw_loop)
    # Now we can find and apply maximum horizontal and vertical distances between outdoor vrf unit and zones with vrf terminal units
    max_hor_pipe_length, max_vert_pipe_length = get_max_vrf_pipe_lengths(model)
    outdoor_vrf_unit.setEquivalentPipingLengthusedforPipingCorrectionFactorinCoolingMode(max_hor_pipe_length)
    outdoor_vrf_unit.setEquivalentPipingLengthusedforPipingCorrectionFactorinHeatingMode(max_hor_pipe_length)
    outdoor_vrf_unit.setVerticalHeightusedforPipingCorrectionFactor(max_vert_pipe_length)
  end
end

#add_ecm_hs09_ccashp_baseboard(model:, system_zones_map:, system_doas_flags:, ecm_system_zones_map_option:, standard:) ⇒ Object

Add equipment for ecm “hs09_ccashp_baseboard”:

-Constant-volume reheat system for single zone systems
-VAV system with reheat for non DOAS multi-zone systems
-Cold-climate air-source heat pump for heating and cooling with electric backup
-Electric or hot-water baseboards


1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1218

def add_ecm_hs09_ccashp_baseboard(model:,
                                  system_zones_map:,    # hash of ailoop names as keys and array of zones as values
                                  system_doas_flags:,   # hash of system names as keys and flag for DOAS as values
                                  ecm_system_zones_map_option:,
                                  standard:)

  # Get the heating fuel type from the system fuels object defined by the standards object
  heating_fuel = standard.fuel_type_set.ecm_fueltype

  # Create one hot-water loop for hot-water baseboards if required
  hw_loop = nil
  hw_loop = add_hotwater_loop(model: model, fuel_type_set: standard.fuel_type_set) if standard.fuel_type_set.baseboard_type == 'Hot Water'

  # Set supplemental heating for air loop
  sys_supp_htg_eqpt_type = 'coil_electric'
  sys_supp_htg_eqpt_type = 'coil_gas' if heating_fuel == 'NaturalGas'
  systems = []
  system_zones_map.sort.each do |sys_name, zones|
    sys_info = air_sys_comps_assumptions(sys_name: sys_name,
                                         zones: zones,
                                         system_doas_flags: system_doas_flags)
    # add airloop and its equipment
    airloop,clg_dx_coil,htg_dx_coil,return_fan = add_air_system(
      model: model,
      zones: zones,
      sys_abbr: sys_info['sys_abbr'],
      sys_vent_type: sys_info['sys_vent_type'],
      sys_heat_rec_type: sys_info['sys_heat_rec_type'],
      sys_htg_eqpt_type: 'ccashp',
      sys_supp_htg_eqpt_type: sys_supp_htg_eqpt_type,
      sys_clg_eqpt_type: 'ccashp',
      sys_supp_fan_type: sys_info['sys_supp_fan_type'],
      sys_ret_fan_type: sys_info['sys_ret_fan_type'],
      sys_setpoint_mgr_type: sys_info['sys_setpoint_mgr_type']
    )
    # Apply performance curves
    eqpt_name = 'Mitsubishi_Hyper_Heating_VRF_Outdoor_Unit RTU'
    coil_cooling_dx_variable_speed_apply_curves(clg_dx_coil, eqpt_name)
    coil_heating_dx_variable_speed_apply_curves(htg_dx_coil, eqpt_name)
    # add zone equipment and diffuser
    if sys_info['sys_vent_type'] == 'doas'
      zone_htg_eqpt_type = 'ptac_electric_off'
      zone_clg_eqpt_type = 'ptac_electric_off'
      zone_fan_type = 'on_off'
    else
      zone_htg_eqpt_type = 'baseboard_electric' if standard.fuel_type_set.baseboard_type == 'Electric'
      zone_htg_eqpt_type = 'baseboard_hotwater' if standard.fuel_type_set.baseboard_type == 'Hot Water'
      zone_clg_eqpt_type = 'none'
      zone_fan_type = 'none'
    end
    add_zone_eqpt(model: model,
                  airloop: airloop,
                  zones: zones,
                  outdoor_unit: nil,
                  zone_diffuser_type: sys_info['zone_diffuser_type'],
                  zone_htg_eqpt_type: zone_htg_eqpt_type,
                  zone_supp_htg_eqpt_type: 'none',
                  zone_clg_eqpt_type: zone_clg_eqpt_type,
                  zone_fan_type: zone_fan_type,
                  hw_loop: hw_loop)
    # for doas use baseboard electric or hotwater as backup for PTAC units
    if sys_info['sys_vent_type'] == 'doas'
      zone_htg_eqpt_type = 'baseboard_electric' if standard.fuel_type_set.baseboard_type == 'Electric'
      zone_htg_eqpt_type = 'baseboard_hotwater' if standard.fuel_type_set.baseboard_type == 'Hot Water'
      add_zone_eqpt(model: model,
                    airloop: airloop,
                    zones: zones,
                    outdoor_unit: nil,
                    zone_diffuser_type: nil,
                    zone_htg_eqpt_type: zone_htg_eqpt_type,
                    zone_supp_htg_eqpt_type: 'none',
                    zone_clg_eqpt_type: 'none',
                    zone_fan_type: 'none',
                    hw_loop: hw_loop)
    end
    return_fan.addToNode(airloop.returnAirNode.get) if return_fan
    systems << airloop
  end

  return systems
end

#add_ecm_hs11_ashp_pthp(model:, system_zones_map:, system_doas_flags:, ecm_system_zones_map_option:, standard:) ⇒ Object

Add equipment for ECM “hs11_ashp_pthp”

-Constant volume DOAS with air-source heat pump for heating and cooling and electric backup
-Packaged-Terminal air-source heat pumps with electric backup


1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1390

def add_ecm_hs11_ashp_pthp(model:,
                           system_zones_map:,
                           system_doas_flags:,
                           ecm_system_zones_map_option:,
                           standard:)
  hw_loop = nil

  # Get the heating fuel type from the system fuels object defined by the standards object
  heating_fuel = standard.fuel_type_set.ecm_fueltype
  # Set supplemental heaing for airloop
  sys_supp_htg_eqpt_type = 'coil_electric'
  sys_supp_htg_eqpt_type = 'coil_gas' if heating_fuel == 'NaturalGas'
  # Update system zones map if needed
  system_zones_map = update_system_zones_map_keys(system_zones_map,'sys_1')
  system_zones_map = update_system_zones_map(model,system_zones_map,ecm_system_zones_map_option,'sys_1') if ecm_system_zones_map_option != 'NECB_Default'
  # Update system doas flags
  system_doas_flags = {}
  system_zones_map.keys.each { |sname| system_doas_flags[sname] = true }
  # use system zones map and generate new air system and zonal equipment
  systems = []
  system_zones_map.sort.each do |sys_name, zones|
    sys_info = air_sys_comps_assumptions(sys_name: sys_name,
                                         zones: zones,
                                         system_doas_flags: system_doas_flags)
    airloop,clg_dx_coil,htg_dx_coil,return_fan = add_air_system(model: model,
                                         zones: zones,
                                         sys_abbr: sys_info['sys_abbr'],
                                         sys_vent_type: sys_info['sys_vent_type'],
                                         sys_heat_rec_type: sys_info['sys_heat_rec_type'],
                                         sys_htg_eqpt_type: 'ashp',
                                         sys_supp_htg_eqpt_type: sys_supp_htg_eqpt_type,
                                         sys_clg_eqpt_type: 'ashp',
                                         sys_supp_fan_type: sys_info['sys_supp_fan_type'],
                                         sys_ret_fan_type: sys_info['sys_ret_fan_type'],
                                         sys_setpoint_mgr_type: sys_info['sys_setpoint_mgr_type'])
    eqpt_name = 'HS11_PTHP'
    coil_cooling_dx_single_speed_apply_curves(clg_dx_coil,eqpt_name)
    coil_heating_dx_single_speed_apply_curves(htg_dx_coil,eqpt_name)
    # add zone equipment and diffuser
    zone_htg_eqpt_type = 'pthp'
    zone_clg_eqpt_type = 'pthp'
    zone_supp_htg_eqpt_type = 'coil_electric'
    zone_fan_type = 'on_off'
    add_zone_eqpt(model: model,
                  airloop: airloop,
                  zones: zones,
                  outdoor_unit: nil,
                  zone_diffuser_type: sys_info['zone_diffuser_type'],
                  zone_htg_eqpt_type: zone_htg_eqpt_type,
                  zone_supp_htg_eqpt_type: zone_supp_htg_eqpt_type,
                  zone_clg_eqpt_type: zone_clg_eqpt_type,
                  zone_fan_type: zone_fan_type,
                  hw_loop: hw_loop)
    zones.each do |zone|
      zone.equipment.each do |comp|
        if comp.to_ZoneHVACPackagedTerminalHeatPump.is_initialized
          if comp.to_ZoneHVACPackagedTerminalHeatPump.get.heatingCoil.to_CoilHeatingDXSingleSpeed.is_initialized
            htg_coil = comp.to_ZoneHVACPackagedTerminalHeatPump.get.heatingCoil.to_CoilHeatingDXSingleSpeed.get
            coil_heating_dx_single_speed_apply_curves(htg_coil,eqpt_name)
          end
          if comp.to_ZoneHVACPackagedTerminalHeatPump.get.coolingCoil.to_CoilCoolingDXSingleSpeed.is_initialized
            clg_coil = comp.to_ZoneHVACPackagedTerminalHeatPump.get.coolingCoil.to_CoilCoolingDXSingleSpeed.get
            coil_cooling_dx_single_speed_apply_curves(clg_coil,eqpt_name)
          end
        end
      end
    end
    return_fan.addToNode(airloop.returnAirNode.get) if return_fan
    systems << airloop
  end

  return systems
end

#add_ecm_hs12_ashp_baseboard(model:, system_zones_map:, system_doas_flags:, ecm_system_zones_map_option:, standard:) ⇒ Object

Add equipment for ecm “hs12_ashp_baseboard”:

-Constant-volume reheat system for single zone systems
-VAV system with reheat for non DOAS multi-zone systems
-Air-source heat pump for heating and cooling with electric backup
-Electric or hot-water baseboards


1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1536

def add_ecm_hs12_ashp_baseboard(model:,
                                system_zones_map:,
                                system_doas_flags:,
                                ecm_system_zones_map_option:,
                                standard:)

  # Get the heating fuel type from the system fuels object defined by the standards object
  heating_fuel = standard.fuel_type_set.ecm_fueltype

  # Create one hot-water loop for hot-water baseboards if required
  hw_loop = nil
  hw_loop = add_hotwater_loop(model: model, fuel_type_set: standard.fuel_type_set) if standard.fuel_type_set.baseboard_type == 'Hot Water'

  # Set supplemental heating fuel for airloop
  sys_supp_htg_eqpt_type = 'coil_electric'
  sys_supp_htg_eqpt_type = 'coil_gas' if heating_fuel == 'NaturalGas'
  systems = []
  system_zones_map.sort.each do |sys_name, zones|
    sys_info = air_sys_comps_assumptions(sys_name: sys_name,
                                         zones: zones,
                                         system_doas_flags: system_doas_flags)
    # add air loop and its equipment
    airloop,clg_dx_coil,htg_dx_coil,return_fan = add_air_system(model: model,
                                         zones: zones,
                                         sys_abbr: sys_info['sys_abbr'],
                                         sys_vent_type: sys_info['sys_vent_type'],
                                         sys_heat_rec_type: sys_info['sys_heat_rec_type'],
                                         sys_htg_eqpt_type: 'ashp',
                                         sys_supp_htg_eqpt_type: sys_supp_htg_eqpt_type,
                                         sys_clg_eqpt_type: 'ashp',
                                         sys_supp_fan_type: sys_info['sys_supp_fan_type'],
                                         sys_ret_fan_type: sys_info['sys_ret_fan_type'],
                                         sys_setpoint_mgr_type: sys_info['sys_setpoint_mgr_type'])
    eqpt_name = 'NECB2015_ASHP'
    coil_cooling_dx_single_speed_apply_curves(clg_dx_coil,eqpt_name)
    coil_heating_dx_single_speed_apply_curves(htg_dx_coil,eqpt_name)
    # add zone equipment and diffuser
    if sys_info['sys_vent_type'] == 'doas'
      zone_htg_eqpt_type = 'ptac_electric_off'
      zone_clg_eqpt_type = 'ptac_electric_off'
      zone_fan_type = 'on_off'
    else
      zone_htg_eqpt_type = 'baseboard_electric' if standard.fuel_type_set.baseboard_type == 'Electric'
      zone_htg_eqpt_type = 'baseboard_hotwater' if standard.fuel_type_set.baseboard_type == 'Hot Water'
      zone_clg_eqpt_type = 'none'
      zone_fan_type = 'none'
    end
    add_zone_eqpt(model: model,
                  airloop: airloop,
                  zones: zones,
                  outdoor_unit: nil,
                  zone_diffuser_type: sys_info['zone_diffuser_type'],
                  zone_htg_eqpt_type: zone_htg_eqpt_type,
                  zone_supp_htg_eqpt_type: 'none',
                  zone_clg_eqpt_type: zone_clg_eqpt_type,
                  zone_fan_type: zone_fan_type,
                  hw_loop: hw_loop)
    # for doas use baseboard electric or hotwater as backup for PTAC units
    if sys_info['sys_vent_type'] == 'doas'
      zone_htg_eqpt_type = 'baseboard_electric' if standard.fuel_type_set.baseboard_type == 'Electric'
      zone_htg_eqpt_type = 'baseboard_hotwater' if standard.fuel_type_set.baseboard_type == 'Hot Water'
      add_zone_eqpt(model: model,
                    airloop: airloop,
                    zones: zones,
                    outdoor_unit: nil,
                    zone_diffuser_type: nil,
                    zone_htg_eqpt_type: zone_htg_eqpt_type,
                    zone_supp_htg_eqpt_type: 'none',
                    zone_clg_eqpt_type: 'none',
                    zone_fan_type: 'none',
                    hw_loop: hw_loop)
    end
    return_fan.addToNode(airloop.returnAirNode.get) if return_fan
    systems << airloop
  end

  return systems
end

#add_ecm_hs13_ashp_vrf(model:, system_zones_map:, system_doas_flags:, ecm_system_zones_map_option:, standard:) ⇒ Object

Add equipment for ecm “hs13_ashp_vrf”:

-Constant-volume dedicated-outside air system
-Air-source heat pump for heating and cooling with electric backup
-Zonal VRF terminal units for heating and cooling with electric baseboards


1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1690

def add_ecm_hs13_ashp_vrf(model:,
                          system_zones_map:,
                          system_doas_flags:,
                          ecm_system_zones_map_option:,
                          standard:)
  # call method for ECM hs08 with ASHP in the air system
  add_ecm_hs08_ccashp_vrf(model: model,
                          system_zones_map: system_zones_map,
                          system_doas_flags: system_doas_flags,
                          ecm_system_zones_map_option: ecm_system_zones_map_option,
                          standard: standard,
                          air_sys_eqpt_type: 'ashp')
end

#add_ecm_hs14_cgshp_fancoils(model:, system_zones_map:, system_doas_flags:, ecm_system_zones_map_option:, standard:) ⇒ Object

Add equipment for ECM “hs14_cgshp_fancoils”

-Constant volume DOAS with hydronic htg and clg coils.
-Zonal terminal fan coil (4-pipe) connected to central ground-source heat pump.
-Plant has a heating loop with water-to-water heat pump with a backup boiler. It also has a water-cooled chiller with a
 backup air-cooled chiller. Water-source heat pump and water-cooled chiller are connected to a ground-loop.


1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1717

def add_ecm_hs14_cgshp_fancoils(model:,
                                system_zones_map:,
                                system_doas_flags:,
                                ecm_system_zones_map_option:,
                                standard:)

  # Get the heating fuel type from the system fuels object defined by the standards object
  heating_fuel = standard.fuel_type_set.ecm_fueltype

  # Set supplemental heaing for airloop
  sys_supp_htg_eqpt_type = 'coil_electric'
  sys_supp_htg_eqpt_type = 'coil_gas' if heating_fuel == 'NaturalGas'
  # Update system zones map if needed
  system_zones_map = update_system_zones_map_keys(system_zones_map,'sys_1')
  system_zones_map = update_system_zones_map(model,system_zones_map,ecm_system_zones_map_option,'sys_1') if ecm_system_zones_map_option != 'NECB_Default'
  # Update system doas flags
  system_doas_flags = {}
  system_zones_map.keys.each { |sname| system_doas_flags[sname] = true }
  # use system zones map and generate new air system and zonal equipment
  systems = []
  system_zones_map.sort.each do |sys_name, zones|
    sys_info = air_sys_comps_assumptions(sys_name: sys_name,
                                         zones: zones,
                                         system_doas_flags: system_doas_flags)
    airloop,clg_coil,htg_coil,return_fan = add_air_system(model: model,
                                         zones: zones,
                                         sys_abbr: sys_info['sys_abbr'],
                                         sys_vent_type: sys_info['sys_vent_type'],
                                         sys_heat_rec_type: sys_info['sys_heat_rec_type'],
                                         sys_htg_eqpt_type: 'coil_hw',
                                         sys_supp_htg_eqpt_type: 'none',
                                         sys_clg_eqpt_type: 'coil_chw',
                                         sys_supp_fan_type: sys_info['sys_supp_fan_type'],
                                         sys_ret_fan_type: sys_info['sys_ret_fan_type'],
                                         sys_setpoint_mgr_type: 'warmest')

    # add zone equipment and diffuser
    zone_htg_eqpt_type = 'fancoil_4pipe'
    zone_clg_eqpt_type = 'fancoil_4pipe'
    zone_supp_htg_eqpt_type = 'none'
    zone_fan_type = 'on_off'
    add_zone_eqpt(model: model,
                  airloop: airloop,
                  zones: zones,
                  outdoor_unit: nil,
                  zone_diffuser_type: sys_info['zone_diffuser_type'],
                  zone_htg_eqpt_type: zone_htg_eqpt_type,
                  zone_supp_htg_eqpt_type: zone_supp_htg_eqpt_type,
                  zone_clg_eqpt_type: zone_clg_eqpt_type,
                  zone_fan_type: zone_fan_type)

    return_fan.addToNode(airloop.returnAirNode.get) if return_fan
    systems << airloop
  end

  # add hot-water loop
  hw_loop,hw_loop_htg_eqpt = add_plantloop(model: model,
                                           loop_htg_eqpt_type: 'HeatPump_WaterToWater_EquationFit',
                                           loop_clg_eqpt_type: 'none',
                                           loop_heat_rej_eqpt_type: 'none',
                                           loop_pump_type: 'variable_speed',
                                           loop_spm_type: 'Scheduled',
                                           loop_setpoint: 50.0,
                                           loop_temp_diff: 5.0)
  model.getCoilHeatingWaters.sort.each {|coil| hw_loop.addDemandBranchForComponent(coil)}
  hcapf_curve_name = "HEATPUMP_WATERTOWATER_HCAPF"
  hcapf_curve = model_add_curve(model, hcapf_curve_name)
  if hcapf_curve
    hw_loop_htg_eqpt.setHeatingCapacityCurve(hcapf_curve)
  else
    raise("Can not find curve hcapf for  #{hw_loop_htg_eqpt.name}")
  end
  hpowerf_curve_name = "HEATPUMP_WATERTOWATER_HPOWERF"
  hpowerf_curve = model_add_curve(model, hpowerf_curve_name)
  if hpowerf_curve
    hw_loop_htg_eqpt.setHeatingCompressorPowerCurve(hpowerf_curve)
  else
    raise("Can not find curve hpowerf for #{hw_loop_htg_eqpt.name}")
  end
  boiler = OpenStudio::Model::BoilerHotWater.new(model)
  boiler.setFuelType(heating_fuel)
  hw_loop_htg_eqpt_outlet_node = hw_loop_htg_eqpt.supplyOutletModelObject.get.to_Node.get
  boiler.addToNode(hw_loop_htg_eqpt_outlet_node)

  # add chilled-water loop
  chw_loop,chw_loop_clg_eqpt = add_plantloop(model: model,
                                             loop_htg_eqpt_type: 'none',
                                             loop_clg_eqpt_type: 'chiller_electric_eir',
                                             loop_heat_rej_eqpt_type: 'none',
                                             loop_pump_type: 'variable_speed',
                                             loop_spm_type: 'Scheduled',
                                             loop_setpoint: 7.0,
                                             loop_temp_diff: 6.0)

  chw_loop_clg_eqpt.setName('ChillerWaterCooled')
  chw_loop_clg_eqpt.setCondenserType("WaterCooled")
  model.getCoilCoolingWaters.sort.each {|coil| chw_loop.addDemandBranchForComponent(coil)}
  sec_chiller = OpenStudio::Model::ChillerElectricEIR.new(model)
  chw_loop_clg_eqpt_outlet_node = chw_loop_clg_eqpt.supplyOutletModelObject.get.to_Node.get
  sec_chiller.addToNode(chw_loop_clg_eqpt_outlet_node)
  sec_chiller.setName('ChillerAirCooled')

  # add ground HX loop with district heating and cooling plant to represent the ground HX
  heat_rej_loop,heat_rej_loop_eqpt = add_plantloop(model: model,
                                                   loop_htg_eqpt_type: 'none',
                                                   loop_clg_eqpt_type: 'none',
                                                   loop_heat_rej_eqpt_type: 'District_Heating',
                                                   loop_pump_type: 'variable_speed',
                                                   loop_spm_type: 'none',
                                                   loop_setpoint: 'none',
                                                   loop_temp_diff: 10.0)
  heat_rej_loop_eqpt.setName('DistrictHeating GLHX')
  htg_eqpt_outlet_node = heat_rej_loop_eqpt.outletModelObject.get.to_Node.get
  clg_eqpt = create_plantloop_clg_eqpt(model, 'District_Cooling')
  clg_eqpt.setName('DistrictCooling GLHX')
  clg_eqpt.addToNode(htg_eqpt_outlet_node)
  htg_spm = create_plantloop_spm( model, 'Scheduled', 5.0)
  htg_spm.addToNode(htg_eqpt_outlet_node)
  clg_eqpt_outlet_node = clg_eqpt.outletModelObject.get.to_Node.get
  clg_spm = create_plantloop_spm( model, 'Scheduled', 25.0)
  clg_spm.addToNode(heat_rej_loop.supplyOutletNode)
  heat_rej_loop.setName("#{heat_rej_loop.name.to_s} GLHX")
  heat_rej_loop.addDemandBranchForComponent(hw_loop_htg_eqpt)
  heat_rej_loop.addDemandBranchForComponent(chw_loop_clg_eqpt)

  # add output variables  for district heating and cooling
  model.getOutputVariables.each {|ivar| ivar.remove}
  dist_htg_var = OpenStudio::Model::OutputVariable.new("District Heating Water Rate",model)
  dist_htg_var.setReportingFrequency("hourly")
  dist_htg_var.setKeyValue("*")
  dist_clg_var = OpenStudio::Model::OutputVariable.new("District Cooling Water Rate",model)
  dist_clg_var.setReportingFrequency("hourly")
  dist_clg_var.setKeyValue("*")

  return systems
end

#add_ecm_remove_airloops_add_zone_baseboards(model:, system_zones_map:, system_doas_flags: nil, ecm_system_zones_map_option:, standard:) ⇒ Object

Despite the name, this method does not actually remove any air loops. All air loops, hot water loops, cooling and any existing baseboard heaters should already be gone. The name is an artifact of the way ECM methods are named and used. With everything gone, this method adds a hot water loop (if required) and baseboard heating back in to all zones requiring heating. Originally, code was included in the ‘apply_systems’ method which would prevent the air loops and other stuff from being created if someone did not want them. But others felt that that was not a clear way of doing things and did not feel the performance penalty of creating objects, then removing them, then creating them again was significant.



3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3503

def add_ecm_remove_airloops_add_zone_baseboards(model:,
                                                system_zones_map:,
                                                system_doas_flags: nil,
                                                ecm_system_zones_map_option:,
                                                standard:)
  # Set the primary fuel set to default to to specific fuel type.
  standards_info = standard.standards_data

  # Assign fuel sources.
  boiler_fueltype = standard.fuel_type_set.boiler_fueltype
  backup_boiler_fueltype = standard.fuel_type_set.backup_boiler_fueltype
  baseboard_type = standard.fuel_type_set.baseboard_type
  mau_heating_coil_type = 'none'

  # Create the hot water loop if necessary.
  hw_loop = standard.create_hw_loop_if_required(
    baseboard_type,
    boiler_fueltype,
    backup_boiler_fueltype,
    mau_heating_coil_type,
    model
  )

  # Add baseboard heaters to each heated zone.
  system_zones_map.sort.each do |sname, zones|
    zones.each do |zone|
      standard.add_zone_baseboards(baseboard_type: baseboard_type,
                                   hw_loop: hw_loop,
                                   model: model,
                                   zone: zone)
    end
  end
end

#add_hotwater_loop(model:, fuel_type_set:) ⇒ Object

Add one hot-water loop for hot-water baseboards if required



3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3680

def add_hotwater_loop(model:, fuel_type_set:)
  primary_boiler_fueltype = fuel_type_set.boiler_fueltype
  backup_boiler_fueltype = fuel_type_set.backup_boiler_fueltype
  plant_loop_names = []
  model.getPlantLoops.sort.each do |plant_loop|
    plant_loop_names << plant_loop.name.to_s
  end
  unless plant_loop_names.include? 'Hot Water Loop'
    hw_loop = OpenStudio::Model::PlantLoop.new(model)
    setup_hw_loop_with_components(model, hw_loop, primary_boiler_fueltype, backup_boiler_fueltype, model.alwaysOnDiscreteSchedule)
  end
  return hw_loop
end

#add_outdoor_vrf_unit(model:, ecm_name: nil, condenser_type: 'AirCooled') ⇒ Object

Add an outdoor VRF unit



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 266

def add_outdoor_vrf_unit(model:,
                         ecm_name: nil,
                         condenser_type: 'AirCooled')
  outdoor_vrf_unit = OpenStudio::Model::AirConditionerVariableRefrigerantFlow.new(model)
  outdoor_vrf_unit.setName('VRF Outdoor Unit')
  outdoor_vrf_unit.setHeatPumpWasteHeatRecovery(true)
  outdoor_vrf_unit.setRatedHeatingCOP(4.0)
  outdoor_vrf_unit.setRatedCoolingCOP(4.0)
  outdoor_vrf_unit.setMinimumOutdoorTemperatureinHeatingMode(-25.0)
  outdoor_vrf_unit.setHeatingPerformanceCurveOutdoorTemperatureType('WetBulbTemperature')
  outdoor_vrf_unit.setMasterThermostatPriorityControlType('ThermostatOffsetPriority')
  outdoor_vrf_unit.setDefrostControl('OnDemand')
  outdoor_vrf_unit.setDefrostStrategy('ReverseCycle')
  outdoor_vrf_unit.autosizeResistiveDefrostHeaterCapacity
  outdoor_vrf_unit.setPipingCorrectionFactorforHeightinHeatingModeCoefficient(-0.00019231)
  outdoor_vrf_unit.setPipingCorrectionFactorforHeightinCoolingModeCoefficient(-0.00019231)
  outdoor_vrf_unit.setMinimumOutdoorTemperatureinHeatRecoveryMode(-5.0)
  outdoor_vrf_unit.setMaximumOutdoorTemperatureinHeatRecoveryMode(26.2)
  outdoor_vrf_unit.setInitialHeatRecoveryCoolingCapacityFraction(0.5)
  outdoor_vrf_unit.setHeatRecoveryCoolingCapacityTimeConstant(0.15)
  outdoor_vrf_unit.setInitialHeatRecoveryCoolingEnergyFraction(1.0)
  outdoor_vrf_unit.setHeatRecoveryCoolingEnergyTimeConstant(0.0)
  outdoor_vrf_unit.setInitialHeatRecoveryHeatingCapacityFraction(1.0)
  outdoor_vrf_unit.setHeatRecoveryHeatingCapacityTimeConstant(0.15)
  outdoor_vrf_unit.setInitialHeatRecoveryHeatingEnergyFraction(1.0)
  outdoor_vrf_unit.setHeatRecoveryCoolingEnergyTimeConstant(0.0)
  outdoor_vrf_unit.setMinimumHeatPumpPartLoadRatio(0.5)
  outdoor_vrf_unit.setCondenserType(condenser_type)
  outdoor_vrf_unit.setCrankcaseHeaterPowerperCompressor(1.0e-6)
  heat_defrost_eir_ft = nil
  if ecm_name
    search_criteria = {}
    search_criteria['name'] = 'Mitsubishi_Hyper_Heating_VRF_Outdoor_Unit'
    props = model_find_object(standards_data['tables']['heat_pump_heating_ecm']['table'], search_criteria, 1.0)
    heat_defrost_eir_ft = model_add_curve(model, props['heat_defrost_eir_ft'])
  end
  if heat_defrost_eir_ft
    outdoor_vrf_unit.setDefrostEnergyInputRatioModifierFunctionofTemperatureCurve(heat_defrost_eir_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{outdoor_vrf_unit.name}, cannot find heat_defrost_eir_ft curve, will not be set.")
  end

  return outdoor_vrf_unit
end

#add_plantloop(model:, loop_htg_eqpt_type:, loop_clg_eqpt_type:, loop_heat_rej_eqpt_type:, loop_pump_type:, loop_spm_type:, loop_setpoint:, loop_temp_diff:) ⇒ Object

add plant loop with all its components



1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1128

def add_plantloop(model:,
                  loop_htg_eqpt_type:,
                  loop_clg_eqpt_type:,
                  loop_heat_rej_eqpt_type:,
                  loop_pump_type:,
                  loop_spm_type:,
                  loop_setpoint:,
                  loop_temp_diff:)

  # create all the needed components and the plant loop
  plantloop = OpenStudio::Model::PlantLoop.new(model)
  spm = create_plantloop_spm(model, loop_spm_type, loop_setpoint)
  pump = create_plantloop_pump(model, loop_pump_type)
  htg_eqpt = create_plantloop_htg_eqpt(model, loop_htg_eqpt_type)
  clg_eqpt = create_plantloop_clg_eqpt(model, loop_clg_eqpt_type)
  heat_rej_eqpt = create_plantloop_heat_rej_eqpt(model, loop_heat_rej_eqpt_type)
  if heat_rej_eqpt.nil?
    if !htg_eqpt.nil?
      plantloop.sizingPlant.setLoopType('Heating')
      plantloop.setName("HW PlantLoop")
      eqpt = htg_eqpt
    elsif !clg_eqpt.nil?
      plantloop.sizingPlant.setLoopType('Cooling')
      plantloop.setName("CHW PlantLoop")
      eqpt = clg_eqpt
    end
  elsif !heat_rej_eqpt.nil?
    plantloop.sizingPlant.setLoopType('Condenser')
    plantloop.setName("Condenser PlantLoop")
    eqpt = heat_rej_eqpt
  end
  plantloop.sizingPlant.setDesignLoopExitTemperature(loop_setpoint) if loop_setpoint != 'none'
  plantloop.sizingPlant.setLoopDesignTemperatureDifference(loop_temp_diff) if loop_temp_diff != 'none'
  bypass_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_outlet_pipe = OpenStudio::Model::PipeAdiabatic.new(model)
  supply_inlet_node = plantloop.supplyInletNode
  supply_outlet_node = plantloop.supplyOutletNode
  pump.addToNode(supply_inlet_node)
  plantloop.addSupplyBranchForComponent(eqpt)
  plantloop.addSupplyBranchForComponent(bypass_pipe)
  supply_outlet_pipe.addToNode(supply_outlet_node)
  spm.addToNode(supply_outlet_node) if loop_spm_type != 'none'

  return plantloop,eqpt
end

#add_zone_eqpt(model:, airloop:, zones:, outdoor_unit:, zone_diffuser_type:, zone_htg_eqpt_type:, zone_supp_htg_eqpt_type:, zone_clg_eqpt_type:, zone_fan_type:, hw_loop: nil) ⇒ Object

add zonal heating and cooling equipment



963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 963

def add_zone_eqpt(model:,
                  airloop:,
                  zones:,
                  outdoor_unit:,
                  zone_diffuser_type:,
                  zone_htg_eqpt_type:,
                  zone_supp_htg_eqpt_type:,
                  zone_clg_eqpt_type:,
                  zone_fan_type:,
                  hw_loop: nil)

  always_on = model.alwaysOnDiscreteSchedule
  zones.sort.each do |zone|
    # during the first call to this method for a zone, the diffuser type has to be specified if there is an air loop serving the zone
    if zone_diffuser_type
      zone.sizingZone.setZoneCoolingDesignSupplyAirTemperature(13.0)
      zone.sizingZone.setZoneHeatingDesignSupplyAirTemperature(43.0)
      zone.sizingZone.setZoneCoolingSizingFactor(1.1)
      zone.sizingZone.setZoneHeatingSizingFactor(1.3)
      diffuser = create_zone_diffuser(model, zone_diffuser_type, zone)
      airloop.removeBranchForZone(zone)
      airloop.addBranchForZone(zone, diffuser.to_StraightComponent)
    end
    clg_eqpt = create_zone_clg_eqpt(model, zone_clg_eqpt_type)
    htg_eqpt = create_zone_htg_eqpt(model, zone_htg_eqpt_type, hw_loop)
    supp_htg_eqpt = create_zone_htg_eqpt(model, zone_supp_htg_eqpt_type, hw_loop)
    fan = create_air_sys_fan(model, zone_fan_type)
    # for container zonal equipment call method "create_zone_container_equipment"
    this_is_container_comp = false
    if (zone_htg_eqpt_type == 'pthp') || (zone_htg_eqpt_type == 'vrf') ||
       (zone_htg_eqpt_type.include? 'unitheater') || (zone_htg_eqpt_type.include? 'ptac') ||
       (zone_htg_eqpt_type.include? 'fancoil')
      this_is_container_comp = true
      zone_cont_eqpt = create_zone_container_eqpt(model: model,
                                                  zone_cont_eqpt_type: zone_htg_eqpt_type,
                                                  zone_htg_eqpt: htg_eqpt,
                                                  zone_supp_htg_eqpt: supp_htg_eqpt,
                                                  zone_clg_eqpt: clg_eqpt,
                                                  zone_fan: fan)
    end
    if zone_cont_eqpt
      zone_cont_eqpt.addToThermalZone(zone)
      outdoor_unit.addTerminal(zone_cont_eqpt) if outdoor_unit
    elsif htg_eqpt && !this_is_container_comp
      htg_eqpt.addToThermalZone(zone)
    end
  end
  sys_name_zone_htg_eqpt_type = zone_htg_eqpt_type
  sys_name_zone_htg_eqpt_type = 'b-e' if zone_htg_eqpt_type == 'baseboard_electric' || zone_htg_eqpt_type == 'ptac_electric_off'
  sys_name_zone_htg_eqpt_type = 'b-hw' if zone_htg_eqpt_type == 'baseboard_hotwater'
  sys_name_zone_clg_eqpt_type = zone_clg_eqpt_type
  sys_name_zone_clg_eqpt_type = 'ptac' if zone_clg_eqpt_type == 'ptac_electric_off'
  update_sys_name(airloop, zone_htg: sys_name_zone_htg_eqpt_type, zone_clg: sys_name_zone_clg_eqpt_type) if zone_diffuser_type
end

#air_sys_comps_assumptions(sys_name:, zones:, system_doas_flags:) ⇒ Object

Set assumptions for type of components for air system based on the number of zones served by the system and whether it’s a mixed or doas.



1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1177

def air_sys_comps_assumptions(sys_name:,
                              zones:,
                              system_doas_flags:)

  sys_info = {}
  sys_info['sys_abbr'] = sys_name.split('|')[0]
  sys_info['sys_vent_type'] = 'mixed'
  sys_info['sys_vent_type'] = 'doas' if system_doas_flags[sys_name.to_s]
  sys_info['sys_heat_rec_type'] = 'none'
  sys_info['sys_htg_eqpt_type'] = 'coil_electric'
  sys_info['sys_supp_htg_eqpt_type'] = 'none'
  sys_info['sys_clg_eqpt_type'] = 'coil_dx'
  if (zones.size == 1) || (sys_info['sys_abbr'] == 'sys_4')
    sys_info['sys_setpoint_mgr_type'] = 'single_zone_reheat'
    sys_info['sys_setpoint_mgr_type'] = 'scheduled' if system_doas_flags[sys_name.to_s]
    sys_info['sys_supp_fan_type'] = 'constant_volume'
    sys_info['sys_ret_fan_type'] = 'none'
    sys_info['zone_diffuser_type'] = 'single_duct_uncontrolled'
  elsif zones.size > 1
    if system_doas_flags[sys_name.to_s]
      sys_info['sys_setpoint_mgr_type'] = 'scheduled'
      sys_info['sys_supp_fan_type'] = 'constant_volume'
      sys_info['sys_ret_fan_type'] = 'none'
      sys_info['zone_diffuser_type'] = 'single_duct_uncontrolled'
    else
      sys_info['sys_setpoint_mgr_type'] = 'warmest'
      sys_info['sys_supp_fan_type'] = 'variable_volume'
      sys_info['sys_ret_fan_type'] = 'variable_volume'
      sys_info['zone_diffuser_type'] = 'single_duct_vav_reheat'
    end
  end

  return sys_info
end

#airconditioner_variablerefrigerantflow_cooling_apply_cop(airconditioner_variablerefrigerantflow, search_criteria, rename = false) ⇒ Object

Find cooling efficiency for “AirConditionerVariableRefrigerantFlow” object



2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2891

def airconditioner_variablerefrigerantflow_cooling_apply_cop(airconditioner_variablerefrigerantflow,
                                                             search_criteria,
                                                             rename = false)

  capacity_w = airconditioner_variablerefrigerantflow_cooling_find_capacity(airconditioner_variablerefrigerantflow)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Look up the efficiency characteristics
  props = model_find_object(standards_data['tables']['heat_pump_cooling_ecm'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find efficiency info using #{search_criteria}.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency
  cop = nil

  # If specified as EER
  unless props['minimum_energy_efficiency_ratio'].nil?
    min_eer = props['minimum_energy_efficiency_ratio']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{airconditioner_variablerefrigerantflow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{airconditioner_variablerefrigerantflow.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # if specified as HSPF (heat pump)
  unless props['minimum_heating_seasonal_performance_factor'].nil?
    min_hspf = props['minimum_heating_seasonal_performance_factor']
    cop = hspf_to_cop_no_fan(min_hspf)
    new_comp_name = "#{coil_heating_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}HSPF"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{airconditioner_variablerefrigerantflow.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER (heat pump)
  unless props['minimum_full_load_efficiency'].nil?
    min_eer = props['minimum_full_load_efficiency']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{airconditioner_variablerefrigerantflow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{airconditioner_variablerefrigerantflow.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as COP
  unless props['minimum_coefficient_of_performance_cooling'].nil?
    cop = props['minimum_coefficient_of_performance_cooling']
    new_comp_name = "#{airconditioner_variablerefrigerantflow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{cop}COP"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{airconditioner_variablerefrigerantflow.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # Rename
  if rename
    airconditioner_variablerefrigerantflow.setName(new_comp_name)
  end

  # Set COP
  airconditioner_variablerefrigerantflow.setRatedCoolingCOP(cop.to_f) unless cop.nil?

end

#airconditioner_variablerefrigerantflow_cooling_apply_curves(airconditioner_variablerefrigerantflow, eqpt_name) ⇒ Object

Applies the cooling performance curves to “AirConditionerVariableRefrigerantFlow” object.



2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2364

def airconditioner_variablerefrigerantflow_cooling_apply_curves(airconditioner_variablerefrigerantflow, eqpt_name)
  successfully_set_all_properties = true

  search_criteria = {}
  search_criteria['name'] = eqpt_name
  # Get the capacity
  capacity_w = airconditioner_variablerefrigerantflow_cooling_find_capacity(airconditioner_variablerefrigerantflow)
  capacity_w = [1.0,capacity_w].max
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get

  # Lookup performance curves
  props = model_find_object(standards_data['tables']['heat_pump_cooling_ecm']['table'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find efficiency info using #{search_criteria}, cannot apply efficiency.")
    successfully_set_all_properties = false
  end

  # Make the COOL-CAP-FT Low curve
  cool_cap_ft_low = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_cap_ft_low'])
  if cool_cap_ft_low
    airconditioner_variablerefrigerantflow.setCoolingCapacityRatioModifierFunctionofLowTemperatureCurve(cool_cap_ft_low)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_cap_ft_low curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-CAP-FT boundary curve
  cool_cap_ft_boundary = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_cap_ft_boundary'])
  if cool_cap_ft_boundary
    airconditioner_variablerefrigerantflow.setCoolingCapacityRatioBoundaryCurve(cool_cap_ft_boundary)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_cap_ft_boundary curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-CAP-FT high curve
  cool_cap_ft_high = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_cap_ft_high'])
  if cool_cap_ft_high
    airconditioner_variablerefrigerantflow.setCoolingCapacityRatioModifierFunctionofHighTemperatureCurve(cool_cap_ft_high)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_cap_ft_high curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-EIR-FT low curve
  cool_eir_ft_low = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_eir_ft_low'])
  if cool_eir_ft_low
    airconditioner_variablerefrigerantflow.setCoolingEnergyInputRatioModifierFunctionofLowTemperatureCurve(cool_eir_ft_low)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_eir_ft_low curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-EIR-FT boundary curve
  cool_eir_ft_boundary = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_eir_ft_boundary'])
  if cool_eir_ft_boundary
    airconditioner_variablerefrigerantflow.setCoolingEnergyInputRatioBoundaryCurve(cool_eir_ft_boundary)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_eir_ft_boundary curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-EIR-FT high curve
  cool_eir_ft_high = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_eir_ft_high'])
  if cool_eir_ft_high
    airconditioner_variablerefrigerantflow.setCoolingEnergyInputRatioModifierFunctionofHighTemperatureCurve(cool_eir_ft_high)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_eir_ft_high curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-EIR-FPLR low curve
  cool_eir_fplr_low = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_eir_fplr_low'])
  if cool_eir_fplr_low
    airconditioner_variablerefrigerantflow.setCoolingEnergyInputRatioModifierFunctionofLowPartLoadRatioCurve(cool_eir_fplr_low)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_eir_fplr_low curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-EIR-FPLR high curve
  cool_eir_fplr_high = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_eir_fplr_high'])
  if cool_eir_fplr_high
    airconditioner_variablerefrigerantflow.setCoolingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve(cool_eir_fplr_high)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_eir_fplr_high curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-CCR curve
  cool_ccr = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_ccr'])
  if cool_ccr
    airconditioner_variablerefrigerantflow.setCoolingCombinationRatioCorrectionFactorCurve(cool_ccr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_ccr curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-PLF-FPLR curve
  cool_plf_fplr = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_plf_fplr'])
  if cool_plf_fplr
    airconditioner_variablerefrigerantflow.setCoolingPartLoadFractionCorrelationCurve(cool_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_plf_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-PLF-FPLR curve
  cool_plf_fplr = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_plf_fplr'])
  if cool_plf_fplr
    airconditioner_variablerefrigerantflow.setCoolingPartLoadFractionCorrelationCurve(cool_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_plf_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-CAP-FPL curve
  cool_cap_fpl = model_add_curve(airconditioner_variablerefrigerantflow.model, props['cool_cap_fpl'])
  if cool_cap_fpl
    airconditioner_variablerefrigerantflow.setPipingCorrectionFactorforLengthinCoolingModeCurve(cool_cap_fpl)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_cap_fpl curve, will not be set.")
    successfully_set_all_properties = false
  end

end

#airconditioner_variablerefrigerantflow_cooling_find_capacity(airconditioner_variablerefrigerantflow) ⇒ Object

Find cooling capacity for “AirConditionerVariableRefrigerantFlow” object



3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3052

def airconditioner_variablerefrigerantflow_cooling_find_capacity(airconditioner_variablerefrigerantflow)
  capacity_w = nil
  if airconditioner_variablerefrigerantflow.ratedTotalCoolingCapacity.is_initialized
    capacity_w = airconditioner_variablerefrigerantflow.ratedTotalCoolingCapacity.get
  elsif airconditioner_variablerefrigerantflow.autosizedRatedTotalCoolingCapacity.is_initialized
    capacity_w = airconditioner_variablerefrigerantflow.autosizedRatedTotalCoolingCapacity.get
    airconditioner_variablerefrigerantflow.setRatedTotalCoolingCapacity(capacity_w)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name} cooling capacity is not available.")
    return 0.0
  end

  return capacity_w
end

#airconditioner_variablerefrigerantflow_heating_apply_cop(airconditioner_variablerefrigerantflow, search_criteria, rename = false) ⇒ Object

Find heating efficiency for “AirConditionerVariableRefrigerantFlow” object



2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2955

def airconditioner_variablerefrigerantflow_heating_apply_cop(airconditioner_variablerefrigerantflow,
                                                             search_criteria,
                                                             rename = false)

  capacity_w = airconditioner_variablerefrigerantflow_heating_find_capacity(airconditioner_variablerefrigerantflow)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Look up the efficiency characteristics
  props = model_find_object(standards_data['tables']['heat_pump_heating_ecm'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heating efficiency info using #{search_criteria}.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency
  cop = nil

  # If specified as EER
  unless props['minimum_energy_efficiency_ratio'].nil?
    min_eer = props['minimum_energy_efficiency_ratio']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{airconditioner_variablerefrigerantflow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{airconditioner_variablerefrigerantflow.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # if specified as HSPF (heat pump)
  unless props['minimum_heating_seasonal_performance_factor'].nil?
    min_hspf = props['minimum_heating_seasonal_performance_factor']
    cop = hspf_to_cop_no_fan(min_hspf)
    new_comp_name = "#{coil_heating_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}HSPF"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{airconditioner_variablerefrigerantflow.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER (heat pump)
  unless props['minimum_full_load_efficiency'].nil?
    min_eer = props['minimum_full_load_efficiency']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{airconditioner_variablerefrigerantflow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{airconditioner_variablerefrigerantflow.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as COP
  unless props['minimum_coefficient_of_performance_heating'].nil?
    min_cop = props['minimum_coefficient_of_performance_heating']
    cop = cop_heating_to_cop_heating_no_fan(min_cop, capacity_w)
    new_comp_name = "#{airconditioner_variablerefrigerantflow.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{cop}COP"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{template}: #{airconditioner_variablerefrigerantflow.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # Rename
  if rename
    airconditioner_variablerefrigerantflow.setName(new_comp_name)
  end

  # Set COP
  airconditioner_variablerefrigerantflow.setRatedHeatingCOP(cop.to_f) unless cop.nil?

end

#airconditioner_variablerefrigerantflow_heating_apply_curves(airconditioner_variablerefrigerantflow, eqpt_name) ⇒ Object

Applies the heating performance curves to “AirConditionerVariableRefrigerantFlow” object.



2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2495

def airconditioner_variablerefrigerantflow_heating_apply_curves(airconditioner_variablerefrigerantflow, eqpt_name)
  successfully_set_all_properties = true

  search_criteria = {}
  search_criteria['name'] = eqpt_name
  # Get the capacity
  capacity_w = airconditioner_variablerefrigerantflow_heating_find_capacity(airconditioner_variablerefrigerantflow)
  capacity_w = [1.0,capacity_w].max
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get

  # Lookup performance curves
  props = model_find_object(standards_data['tables']['heat_pump_heating_ecm']['table'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heating efficiency info using #{search_criteria}, cannot apply efficiency.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-CAP-FT Low curve
  heat_cap_ft_low = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_cap_ft_low'])
  if heat_cap_ft_low
    airconditioner_variablerefrigerantflow.setHeatingCapacityRatioModifierFunctionofLowTemperatureCurve(heat_cap_ft_low)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_cap_ft_low curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-CAP-FT boundary curve
  heat_cap_ft_boundary = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_cap_ft_boundary'])
  if heat_cap_ft_boundary
    airconditioner_variablerefrigerantflow.setHeatingCapacityRatioBoundaryCurve(heat_cap_ft_boundary)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_cap_ft_boundary curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-CAP-FT high curve
  heat_cap_ft_high = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_cap_ft_high'])
  if heat_cap_ft_high
    airconditioner_variablerefrigerantflow.setHeatingCapacityRatioModifierFunctionofHighTemperatureCurve(heat_cap_ft_high)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_cap_ft_high curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FT low curve
  heat_eir_ft_low = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_eir_ft_low'])
  if heat_eir_ft_low
    airconditioner_variablerefrigerantflow.setHeatingEnergyInputRatioModifierFunctionofLowTemperatureCurve(heat_eir_ft_low)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_eir_ft_low curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FT boundary curve
  heat_eir_ft_boundary = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_eir_ft_boundary'])
  if heat_eir_ft_boundary
    airconditioner_variablerefrigerantflow.setHeatingEnergyInputRatioBoundaryCurve(heat_eir_ft_boundary)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_eir_ft_boundary curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FT high curve
  heat_eir_ft_high = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_eir_ft_high'])
  if heat_eir_ft_high
    airconditioner_variablerefrigerantflow.setHeatingEnergyInputRatioModifierFunctionofHighTemperatureCurve(heat_eir_ft_high)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_eir_ft_high curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FPLR low curve
  heat_eir_fplr_low = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_eir_fplr_low'])
  if heat_eir_fplr_low
    airconditioner_variablerefrigerantflow.setHeatingEnergyInputRatioModifierFunctionofLowPartLoadRatioCurve(heat_eir_fplr_low)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_eir_fplr_low curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FPLR high curve
  heat_eir_fplr_high = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_eir_fplr_high'])
  if heat_eir_fplr_high
    airconditioner_variablerefrigerantflow.setHeatingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve(heat_eir_fplr_high)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_eir_fplr_high curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-HCR curve
  heat_hcr = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_hcr'])
  if heat_hcr
    airconditioner_variablerefrigerantflow.setHeatingCombinationRatioCorrectionFactorCurve(heat_hcr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_hcr curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-PLF-FPLR curve
  heat_plf_fplr = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_plf_fplr'])
  if heat_plf_fplr
    airconditioner_variablerefrigerantflow.setHeatingPartLoadFractionCorrelationCurve(heat_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find cool_plf_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-CAP-FPL curve
  heat_cap_fpl = model_add_curve(airconditioner_variablerefrigerantflow.model, props['heat_cap_fpl'])
  if heat_cap_fpl
    airconditioner_variablerefrigerantflow.setPipingCorrectionFactorforLengthinHeatingModeCurve(heat_cap_fpl)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name}, cannot find heat_cap_fpl curve, will not be set.")
    successfully_set_all_properties = false
  end

end

#airconditioner_variablerefrigerantflow_heating_find_capacity(airconditioner_variablerefrigerantflow) ⇒ Object

Find heating capacity for “AirConditionerVariableRefrigerantFlow” object



3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3069

def airconditioner_variablerefrigerantflow_heating_find_capacity(airconditioner_variablerefrigerantflow)
  capacity_w = nil
  if airconditioner_variablerefrigerantflow.ratedTotalHeatingCapacity.is_initialized
    capacity_w = airconditioner_variablerefrigerantflow.ratedTotalHeatingCapacity.get
  elsif airconditioner_variablerefrigerantflow.autosizedRatedTotalHeatingCapacity.is_initialized
    capacity_w = airconditioner_variablerefrigerantflow.autosizedRatedTotalHeatingCapacity.get
    airconditioner_variablerefrigerantflow.setRatedTotalHeatingCapacity(capacity_w)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirConditionerVariableRefrigerantFlow', "For #{airconditioner_variablerefrigerantflow.name} heating capacity is not available.")
    return 0.0
  end

  return capacity_w
end

#apply_efficiency_ecm_hs08_ccashp_vrf(model, standard, air_sys_eqpt_type: 'ccashp') ⇒ Object

Apply efficiencies for ECM ‘hs08_ccashp_vrf’



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 595

def apply_efficiency_ecm_hs08_ccashp_vrf(model, standard, air_sys_eqpt_type: 'ccashp')
  # Use same performance data as ECM 'hs09_ccashpsys' for air system
  if air_sys_eqpt_type == 'ccashp'
    apply_efficiency_ecm_hs09_ccashp_baseboard(model,standard)
  elsif air_sys_eqpt_type == 'ashp'
    apply_efficiency_ecm_hs12_ashp_baseboard(model,standard)
  end
  # Apply efficiency for VRF units
  eqpt_name = 'Mitsubishi_Hyper_Heating_VRF_Outdoor_Unit'
  search_criteria = {}
  search_criteria['name'] = eqpt_name
  model.getAirConditionerVariableRefrigerantFlows.sort.each do |vrf_unit|
    airconditioner_variablerefrigerantflow_cooling_apply_cop(vrf_unit, search_criteria)
    airconditioner_variablerefrigerantflow_heating_apply_cop(vrf_unit, search_criteria)
  end
  # Set fan size of VRF terminal units
  fan_power_per_flow_rate = 150.0 # based on Mitsubishi data: 100 low and 200 high (W-s/m3)
  model.getZoneHVACTerminalUnitVariableRefrigerantFlows.each do |iunit|
    fan = iunit.supplyAirFan.to_FanOnOff.get
    fan_pr_rise = fan_power_per_flow_rate * (fan.fanEfficiency * fan.motorEfficiency)
    fan.setPressureRise(fan_pr_rise)
  end
  # Set fan size of unit heaters
  model.getZoneHVACUnitHeaters.each do |iunit|
    fan = iunit.supplyAirFan.to_FanConstantVolume.get
    fan_pr_rise = fan_power_per_flow_rate * (fan.fanEfficiency * fan.motorEfficiency)
    fan.setPressureRise(fan_pr_rise)
  end

end

#apply_efficiency_ecm_hs09_ccashp_baseboard(model, standard) ⇒ Object

Apply effiencies for ECM “hs09_ccashp_baseboard”



1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1302

def apply_efficiency_ecm_hs09_ccashp_baseboard(model,standard)
  # fraction of electric backup heating coil capacity assigned to dx heating coil
  fr_backup_coil_cap_as_dx_coil_cap = 0.5
  model.getAirLoopHVACs.sort.each do |isys|
    clg_dx_coil = nil
    htg_dx_coil = nil
    backup_coil = nil
    fans = []
    # Find the components on the air loop
    isys.supplyComponents.sort.each do |icomp|
      if icomp.to_CoilCoolingDXVariableSpeed.is_initialized
        clg_dx_coil = icomp.to_CoilCoolingDXVariableSpeed.get
      elsif icomp.to_CoilHeatingDXVariableSpeed.is_initialized
        htg_dx_coil = icomp.to_CoilHeatingDXVariableSpeed.get
      elsif icomp.to_CoilHeatingElectric.is_initialized
        backup_coil = icomp.to_CoilHeatingElectric.get
      elsif icomp.to_CoilHeatingGas.is_initialized
        backup_coil = icomp.to_CoilHeatingGas.get
      elsif icomp.to_FanConstantVolume.is_initialized
        fans << icomp.to_FanConstantVolume.get
      elsif icomp.to_FanVariableVolume.is_initialized
        fans << icomp.to_FanVariableVolume.get
      end
    end
    if clg_dx_coil && htg_dx_coil && backup_coil
      clg_dx_coil_init_name = get_hvac_comp_init_name(clg_dx_coil, false)
      clg_dx_coil.setName(clg_dx_coil_init_name)
      if clg_dx_coil.autosizedGrossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.is_initialized
        max_pd = 0.0
        supply_fan = nil
        fans.each do |fan|
          if fan.pressureRise.to_f > max_pd
            max_pd = fan.pressureRise.to_f
            supply_fan = fan # assume supply fan has higher pressure drop
          end
        end
        # There is an error in EnergyPlus in the estimated capacity of the coil "CoilCoolingDXVariableSpeed".
        # Here the capacity reported by OS is adjusted to estimate an appropriate capacity for the cooling coil.
        # The autosized capacity is corrected for the actual fan flow rate and fan power.
        if supply_fan.maximumFlowRate.is_initialized
          fan_max_afr = supply_fan.maximumFlowRate.to_f
        elsif supply_fan.autosizedMaximumFlowRate.is_initialized
          fan_max_afr = supply_fan.autosizedMaximumFlowRate.to_f
        else
          raise "Fan flow rate is undefined for fan #{supply_fan.name.to_s}"
        end
        if clg_dx_coil.ratedAirFlowRateAtSelectedNominalSpeedLevel.is_initialized
          clg_dx_coil_afr = clg_dx_coil.ratedAirFlowRateAtSelectedNominalSpeedLevel.to_f
        elsif clg_dx_coil.autosizedRatedAirFlowRateAtSelectedNominalSpeedLevel.is_initialized
          clg_dx_coil_afr = clg_dx_coil.autosizedRatedAirFlowRateAtSelectedNominalSpeedLevel.to_f
        else
          raise "Rated air flow rate at selected nominal speed level is undefined for coil #{clg_dx_coil.name.to_s}"
        end
        fan_power = fan_max_afr * max_pd / supply_fan.fanTotalEfficiency.to_f
        clg_dx_coil_cap = clg_dx_coil.autosizedGrossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.to_f *
                          fan_max_afr / clg_dx_coil_afr + fan_power / clg_dx_coil.speeds.last.referenceUnitGrossRatedSensibleHeatRatio.to_f
      elsif clg_dx_coil.grossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.is_initialized
        clg_dx_coil_cap = clg_dx_coil.grossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.to_f
      else
        raise "Rated total cooling capacity at selected nominal speed is undefined for coil #{clg_dx_coil.name.to_s}"
      end
      htg_dx_coil_init_name = get_hvac_comp_init_name(htg_dx_coil, false)
      htg_dx_coil.setName(htg_dx_coil_init_name)
      if backup_coil.nominalCapacity.is_initialized
        backup_coil_cap = backup_coil.nominalCapacity.to_f
      elsif backup_coil.autosizedNominalCapacity.is_initialized
         backup_coil_cap = backup_coil.autosizedNominalCapacity.to_f
      else
        raise "Nominal capacity is undefiled for coil #{backup_coil.name.to_s}"
      end
      # Set the DX capacities to the maximum of the fraction of the backup coil capacity or the cooling capacity needed
      dx_cap = fr_backup_coil_cap_as_dx_coil_cap * backup_coil_cap
      if dx_cap < clg_dx_coil_cap then dx_cap = clg_dx_coil_cap end
      clg_dx_coil.setGrossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel(dx_cap)
      htg_dx_coil.setRatedHeatingCapacityAtSelectedNominalSpeedLevel(dx_cap)
      # Assign COPs
      search_criteria = {}
      search_criteria['name'] = 'Mitsubishi_Hyper_Heating_VRF_Outdoor_Unit RTU'
      coil_cooling_dx_variable_speed_apply_cop(clg_dx_coil, search_criteria, false)
      coil_heating_dx_variable_speed_apply_cop(htg_dx_coil, search_criteria, false)
    end
  end
end

#apply_efficiency_ecm_hs11_ashp_pthp(model, standard) ⇒ Object

Apply efficiencies and performance curves for ECM “hs11_ashp_pthp”



1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1466

def apply_efficiency_ecm_hs11_ashp_pthp(model,standard)
  fr_backup_coil_cap_as_dx_coil_cap = 0.5 # fraction of electric backup heating coil capacity assigned to dx heating coil
  apply_efficiency_ecm_hs12_ashp_baseboard(model,standard)
  pthp_eqpt_name = 'HS11_PTHP'
  model.getAirLoopHVACs.sort.each do |isys|
    isys.thermalZones.each do |zone|
      clg_dx_coil = nil
      htg_dx_coil = nil
      backup_coil = nil
      fan = nil
      zone.equipment.sort.each do |icomp|
        if icomp.to_ZoneHVACPackagedTerminalHeatPump.is_initialized
          if icomp.to_ZoneHVACPackagedTerminalHeatPump.get.coolingCoil.to_CoilCoolingDXSingleSpeed.is_initialized
            clg_dx_coil = icomp.to_ZoneHVACPackagedTerminalHeatPump.get.coolingCoil.to_CoilCoolingDXSingleSpeed.get
          end
          if icomp.to_ZoneHVACPackagedTerminalHeatPump.get.heatingCoil.to_CoilHeatingDXSingleSpeed.is_initialized
            htg_dx_coil = icomp.to_ZoneHVACPackagedTerminalHeatPump.get.heatingCoil.to_CoilHeatingDXSingleSpeed.get
          end
          if icomp.to_ZoneHVACPackagedTerminalHeatPump.get.supplementalHeatingCoil.to_CoilHeatingElectric.is_initialized
            backup_coil = icomp.to_ZoneHVACPackagedTerminalHeatPump.get.supplementalHeatingCoil.to_CoilHeatingElectric.get
          end
          if icomp.to_ZoneHVACPackagedTerminalHeatPump.get.supplyAirFan.to_FanOnOff.is_initialized
            fan = icomp.to_ZoneHVACPackagedTerminalHeatPump.get.supplyAirFan.to_FanOnOff.get
          end
        end
        if clg_dx_coil && htg_dx_coil && backup_coil && fan
          clg_dx_coil_init_name = get_hvac_comp_init_name(clg_dx_coil, false)
          clg_dx_coil.setName(clg_dx_coil_init_name)
          if clg_dx_coil.ratedTotalCoolingCapacity.is_initialized
            clg_dx_coil_cap = clg_dx_coil.ratedTotalCoolingCapacity.to_f
          elsif clg_dx_coil.autosizedRatedTotalCoolingCapacity.is_initialized
            clg_dx_coil_cap = clg_dx_coil.autosizedRatedTotalCoolingCapacity.to_f
          else
            raise "The total cooling capacity is undefined for coil #{clg_dx_coil_cap.name.to_s}"
          end
          htg_dx_coil_init_name = get_hvac_comp_init_name(htg_dx_coil, true)
          htg_dx_coil.setName(htg_dx_coil_init_name)
          if backup_coil.nominalCapacity.is_initialized
            backup_coil_cap = backup_coil.nominalCapacity.to_f
          elsif backup_coil.autosizedNominalCapacity.is_initialized
            backup_coil_cap = backup_coil.autosizedNominalCapacity.to_f
          else
            raise "The nominal capacity is undefined for coil #{backup_coil.name.to_s}"
          end
          # Set the DX capacities to the maximum of the fraction of the backup coil capacity or the cooling capacity needed
          dx_cap = fr_backup_coil_cap_as_dx_coil_cap * backup_coil_cap
          if dx_cap < clg_dx_coil_cap then dx_cap = clg_dx_coil_cap end
          clg_dx_coil.setRatedTotalCoolingCapacity(dx_cap)
          htg_dx_coil.setRatedTotalHeatingCapacity(dx_cap)
          # assign COPs
          search_criteria = {}
          search_criteria['name'] = pthp_eqpt_name
          coil_cooling_dx_single_speed_apply_cop(clg_dx_coil, search_criteria)
          coil_heating_dx_single_speed_apply_cop(htg_dx_coil, search_criteria)
          # Set fan power
          fan_power_per_flow_rate = 150.0 # based on Mitsubishi data: 100 low and 200 high (W-s/m3)
          fan_pr_rise = fan_power_per_flow_rate * (fan.fanEfficiency * fan.motorEfficiency)
          fan.setPressureRise(fan_pr_rise)
        end
      end
    end
  end
end

#apply_efficiency_ecm_hs12_ashp_baseboard(model, standard) ⇒ Object

Apply efficiencies and performance curves for ECM “hs12_ashp_baseboard”



1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1632

def apply_efficiency_ecm_hs12_ashp_baseboard(model,standard)
  fr_backup_coil_cap_as_dx_coil_cap = 0.5 # fraction of electric backup heating coil capacity assigned to dx heating coil
  ashp_eqpt_name = 'NECB2015_ASHP'
  model.getAirLoopHVACs.sort.each do |isys|
    clg_dx_coil = nil
    htg_dx_coil = nil
    backup_coil = nil
    # Find the coils on the air loop
    isys.supplyComponents.sort.each do |icomp|
      if icomp.to_CoilCoolingDXSingleSpeed.is_initialized
        clg_dx_coil = icomp.to_CoilCoolingDXSingleSpeed.get
      elsif icomp.to_CoilHeatingDXSingleSpeed.is_initialized
        htg_dx_coil = icomp.to_CoilHeatingDXSingleSpeed.get
      elsif icomp.to_CoilHeatingElectric.is_initialized
        backup_coil = icomp.to_CoilHeatingElectric.get
      elsif icomp.to_CoilHeatingGas.is_initialized
        backup_coil = icomp.to_CoilHeatingGas.get
      end
    end
    if clg_dx_coil && htg_dx_coil && backup_coil
      # update names of dx coils
      clg_dx_coil_init_name = get_hvac_comp_init_name(clg_dx_coil, false)
      clg_dx_coil.setName(clg_dx_coil_init_name)
      if clg_dx_coil.ratedTotalCoolingCapacity.is_initialized
        clg_dx_coil_cap = clg_dx_coil.ratedTotalCoolingCapacity.to_f
      elsif clg_dx_coil.autosizedRatedTotalCoolingCapacity.is_initialized
        clg_dx_coil_cap = clg_dx_coil.autosizedRatedTotalCoolingCapacity.to_f
      else
        raise "Rated total cooling capacity is undefined for coil #{clg_dx_coil.name.to_s}"
      end
      htg_dx_coil_init_name = get_hvac_comp_init_name(htg_dx_coil, true)
      htg_dx_coil.setName(htg_dx_coil_init_name)
      if backup_coil.nominalCapacity.is_initialized
        backup_coil_cap = backup_coil.nominalCapacity.to_f
      elsif backup_coil.autosizedNominalCapacity.is_initialized
        backup_coil_cap = backup_coil.autosizedNominalCapacity.to_f
      else
        raise "Nominal capacity is undefined for coil #{backup_coil.name.to_s}"
      end
      # set the DX capacities to the maximum of the fraction of the backup coil capacity or the cooling capacity needed
      dx_cap = fr_backup_coil_cap_as_dx_coil_cap * backup_coil_cap
      if dx_cap < clg_dx_coil_cap then dx_cap = clg_dx_coil_cap end
      clg_dx_coil.setRatedTotalCoolingCapacity(dx_cap)
      htg_dx_coil.setRatedTotalHeatingCapacity(dx_cap)
      # assign COPs
      search_criteria = {}
      search_criteria['name'] = ashp_eqpt_name
      coil_cooling_dx_single_speed_apply_cop(clg_dx_coil, search_criteria)
      coil_heating_dx_single_speed_apply_cop(htg_dx_coil, search_criteria)
    end
  end
end

#apply_efficiency_ecm_hs13_ashp_vrf(model, standard) ⇒ Object

Apply efficiencies and performance curves for ECM “hs12_ashp_vrf”



1706
1707
1708
1709
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1706

def apply_efficiency_ecm_hs13_ashp_vrf(model,standard)
  # call method for ECM hs08 with ASHP in air system
  apply_efficiency_ecm_hs08_ccashp_vrf(model, standard, air_sys_eqpt_type: 'ashp')
end

#apply_efficiency_ecm_hs14_cgshp_fancoils(model, standard) ⇒ Object

Appy efficiencies for ECM “hs14_cgshp_fancoils”



1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1856

def apply_efficiency_ecm_hs14_cgshp_fancoils(model,standard)
  heatpump_siz_f = 0.4  # sizing factor for water-source heat pump (heating mode)
  chiller_siz_f = 0.4  # sizing factor for water-cooled chiller
  # get water-source heat pump and boiler
  hw_loops = model.getPlantLoops.select {|loop| loop.sizingPlant.loopType.to_s.downcase == 'heating'}
  hw_heatpump_loop = nil
  hw_heatpump = nil
  hw_boiler = nil
  hw_loops.each do |hw_loop|
    hw_heatpumps = hw_loop.supplyComponents.select {|comp| comp.to_HeatPumpWaterToWaterEquationFitHeating.is_initialized}
    if !hw_heatpumps.empty?
      hw_heatpump_loop = hw_loop
      hw_heatpump = hw_heatpumps[0].to_HeatPumpWaterToWaterEquationFitHeating.get
    end
    hw_boilers = hw_loop.supplyComponents.select {|comp| comp.to_BoilerHotWater.is_initialized}
    hw_boiler = hw_boilers[0].to_BoilerHotWater.get if !hw_boilers.empty?
    break if !hw_heatpump_loop.nil? && !hw_heatpump.nil? && !hw_boiler.nil?
  end
  raise("apply_efficiency_ecm_hs14_cgshp_fancoils: no water-source heat pump found in heating loop #{hw_loops.name.to_s}") if hw_heatpump.nil?
  cw_loop = model.getPlantLoops.select {|loop| loop.sizingPlant.loopType.to_s.downcase == 'condenser'}[0]
  # condenser flow rate is set based on heating loop flow rate and cooling loop flow rate (adjusted for sizing factors)
  cw_loop_max_flow = 0.0
  if hw_heatpump_loop.maximumLoopFlowRate.is_initialized
    cw_loop_max_flow += heatpump_siz_f*hw_heatpump_loop.maximumLoopFlowRate.to_f
  elsif hw_heatpump_loop.autosizedMaximumLoopFlowRate.is_initialized
    cw_loop_max_flow += heatpump_siz_f*hw_heatpump_loop.autosizedMaximumLoopFlowRate.to_f
  else
    raise("apply_efficiency_ecm_hs14_cgshp_fancoils: heating loop #{hw_heatpump_loop.name.to_s} flow rate is not defined")
  end
  chw_loop = model.getPlantLoops.select {|loop| loop.sizingPlant.loopType.to_s.downcase == 'cooling'}[0]
  if chw_loop.maximumLoopFlowRate.is_initialized
    cw_loop_max_flow += chiller_siz_f*chw_loop.maximumLoopFlowRate.to_f
  elsif chw_loop.autosizedMaximumLoopFlowRate.is_initialized
    cw_loop_max_flow += chiller_siz_f*chw_loop.autosizedMaximumLoopFlowRate.to_f
  else
    raise("apply_efficiency_ecm_hs14_cgshp_fancoils: cooling loop #{chw_loop.name.to_s} is not defined")
  end
  cw_loop.setMaximumLoopFlowRate(cw_loop_max_flow)
  cw_loop_pump = cw_loop.supplyComponents.select {|comp| comp.to_PumpVariableSpeed.is_initialized}[0].to_PumpVariableSpeed.get
  cw_loop_pump.setRatedFlowRate(cw_loop_max_flow)
  # set heating capacity of water-source heat pump and boiler
  if hw_heatpump.autosizedRatedHeatingCapacity.is_initialized
    cap = hw_heatpump.autosizedRatedHeatingCapacity.to_f
  elsif hw_heatpump.ratedHeatingCapacity.is_initialized
    cap = hw_heatpump.ratedHeatingCapacity.to_f
  elsif hw_heatpump.autosizedRatedHeatingCapacity.is_initialized
    cap = hw_heatpump.autosizedRatedHeatingCapacity.to_f
  else
    raise("apply_efficiency_ecm_hs14_cgshp_fancoils: capacity of water-source heat pump #{hw_heatpump.name.to_s} is not defined")
  end
  hw_heatpump.setRatedHeatingCapacity(heatpump_siz_f*cap)
  hw_boiler.setNominalCapacity((1.0-heatpump_siz_f)*cap)
  # set cooling capacity of chillers
  chillers = chw_loop.supplyComponents.select {|comp| comp.to_ChillerElectricEIR.is_initialized}
  chiller_water_cooled = nil
  chiller_air_cooled = nil
  chillers.each do |comp|
    chlr = comp.to_ChillerElectricEIR.get
    chiller_water_cooled = chlr if chlr.name.to_s.include? 'ChillerWaterCooled'
    chiller_air_cooled = chlr if chlr.name.to_s.include? 'ChillerAirCooled'
    break if !chiller_water_cooled.nil? && !chiller_air_cooled.nil?
  end
  raise("apply_efficiency_ecm_hs14_cgshp_fancoils: no water-cooled chiller found in cooling loop #{chw_loop.name.to_s}") if chiller_water_cooled.nil?
  raise("apply_efficiency_ecm_hs14_cgshp_fancoils: no air-cooled chiller found in cooling loop #{chw_loop.name.to_s}") if chiller_air_cooled.nil?
  if chiller_water_cooled.autosizedReferenceCapacity.is_initialized
    cap = chiller_water_cooled.autosizedReferenceCapacity.to_f
  elsif chiller_water_cooled.referenceCapacity.is_initialized
    cap = chiller_water_cooled.referenceCapacity.to_f
  elsif chiller_water_cooled.autosizedReferenceCapacity.is_initialized
    cap = chiller_water_cooled.autosizedReferenceCapacity.to_f
  else
    raise("apply_efficiency_ecm_hs14_cgshp_fancoils: cooling capacity of chiller #{chiller_water_cooled.name.to_s} is not defined")
  end
  chiller_water_cooled.setReferenceCapacity(chiller_siz_f*cap)
  chiller_air_cooled.setReferenceCapacity((1.0-chiller_siz_f)*cap)
  # call standard efficiency method again for water-cooled chiller
  new_chlr_name = chiller_water_cooled.name.to_s.chomp!(chiller_water_cooled.name.to_s.split.last).strip
  new_chlr_name = new_chlr_name.chomp!(new_chlr_name.split.last).strip
  new_chlr_name = new_chlr_name.chomp!(new_chlr_name.split.last).strip
  chiller_water_cooled.setName(new_chlr_name)
  standard.chiller_electric_eir_apply_efficiency_and_curves(chiller_water_cooled,nil)
  # set curves and cop of air-cooled chiller
  chlr_cap_w = (1.0-chiller_siz_f)*cap
  chlr_cap_ton = OpenStudio.convert(chlr_cap_w, 'W', 'ton').get
  search_criteria = {}
  search_criteria['cooling_type'] = 'AirCooled'
  chlr_props = model_find_object(standards_data['tables']['chiller_types_ecm']['table'], search_criteria, chlr_cap_ton)
  chiller_air_cooled.setName("ChillerAirCooled #{chlr_props['compressor_type']}")
  search_criteria = {}
  search_criteria['name'] = 'NECB2020_AirCooledChiller'
  search_criteria['compressor_type'] = chlr_props['compressor_type']
  chiller_electric_eir_apply_curves_and_cop(chiller_air_cooled, search_criteria)
end

#apply_erv_ecm_efficiency(model:, erv_package: nil) ⇒ Object

This method will set the properties of the ERV. Must be run after the standard efficiency is complete as this will overwrite those values. See data/erv.json to view/add different erv packages available.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/openstudio-standards/standards/necb/ECMS/erv.rb', line 4

def apply_erv_ecm_efficiency(model:, erv_package: nil)
  # If erv is nil.. do nothing.
  return if erv_package.nil? || erv_package == 'none' || erv_package == 'NECB_Default'

  erv_info = @standards_data['tables']['erv']['table'].detect { |item| item['erv_name'] == erv_package }
  # Check if we were able to get data.
  if erv_info.nil?
    # Get name of ERVs in erv.json.
    valid = @standards_data['tables']['erv']['table'].map { |x| x['erv_name'] }
    # tell user.
    raise("ERV package name #{erv_package} does not exist. must be #{valid} /n Stopping.")
  end

  # add ervs if required
  model.getAirLoopHVACs.sort.each do |air_loop|
    if air_loop.airLoopHVACOutdoorAirSystem.is_initialized
      erv = air_loop.airLoopHVACOutdoorAirSystem.get.components.select{|comp| comp.to_HeatExchangerAirToAirSensibleAndLatent.is_initialized}
      if (erv.empty? && (erv_info['application'] == 'Add_ERVs_To_All_Airloops'))
        air_loop_hvac_apply_energy_recovery_ventilator(air_loop, nil)
      end
    end
  end

  # Apply ecm effectiveness values
  model.getHeatExchangerAirToAirSensibleAndLatents.each { |erv| heat_exchanger_air_to_air_sensible_and_latent_apply_effectiveness(erv, erv_package) }
end

#apply_nv(model:, nv_type:, nv_opening_fraction:, nv_temp_out_min:, nv_delta_temp_in_out:) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/openstudio-standards/standards/necb/ECMS/nv.rb', line 2

def apply_nv(model:, nv_type:, nv_opening_fraction:, nv_temp_out_min:, nv_delta_temp_in_out:)
  ##### If any of users' inputs are nil/false/none, do nothing.
  ##### If users' input for 'nv_type' is 'NECB_Default', do nothing.
  ##### If any of users' inputs for nv_opening_fraction/nv_temp_out_min/nv_delta_temp_in_out is 'NECB_Default', use default values as defined here.
  return if nv_type.nil? || nv_type == false || nv_type == 'none' || nv_type == 'NECB_Default'
  return if nv_opening_fraction.nil? || nv_opening_fraction == false || nv_opening_fraction == 'none'
  return if nv_temp_out_min.nil? || nv_temp_out_min == false || nv_temp_out_min == 'none'
  return if nv_delta_temp_in_out.nil? || nv_delta_temp_in_out == false || nv_delta_temp_in_out == 'none'

  ##### Convert a string to a float (except for nv_type)
  if nv_opening_fraction.instance_of?(String) && nv_opening_fraction != 'NECB_Default'
    nv_opening_fraction = nv_opening_fraction.to_f
  end
  if nv_temp_out_min.instance_of?(String) && nv_temp_out_min != 'NECB_Default'
    nv_temp_out_min = nv_temp_out_min.to_f
  end
  if nv_delta_temp_in_out.instance_of?(String) && nv_delta_temp_in_out != 'NECB_Default'
    nv_delta_temp_in_out = nv_delta_temp_in_out.to_f
  end

  ##### Set default nv_opening_fraction as 0.1
  if nv_opening_fraction == 'NECB_Default'
    nv_opening_fraction = 0.1
  end
  ##### Set default nv_temp_out_min as 13.0
  if nv_temp_out_min == 'NECB_Default'
    nv_temp_out_min = 13.0 # Note: 13.0 is based on inputs from Michel Tardif re a real school in QC
  end
  ##### Set default nv_delta_temp_in_out as 1.0
  if nv_delta_temp_in_out == 'NECB_Default'
    nv_delta_temp_in_out = 1.0 # Note: 1.0 is based on inputs from Michel Tardif re a real school in QC
  end

  setpoint_adjustment_for_nv = 2.0 # This is to adjust heating and cooling setpoint temperature as min and max indoor temperature to have NV

  model.getZoneHVACEquipmentLists.sort.each do |zone_hvac_equipment_list|
    thermal_zone = zone_hvac_equipment_list.thermalZone

    thermal_zone.spaces.sort.each do |space|
      number_of_windows = 0.0

      ##### Gather OA per person and floor area of the space from the osm file
      outdoor_air = space.designSpecificationOutdoorAir.get
      outdoor_air_flow_per_person = outdoor_air.outdoorAirFlowperPerson
      outdoor_air_flow_per_floor_area = outdoor_air.outdoorAirFlowperFloorArea

      ##### Get heating/cooling setpoint temperature schedules from the osm file
      # These schedules are used for min/max Tin schedules under the objects of "ZoneVentilation:DesignFlowRate" and "ZoneVentilation:WindandStackOpenArea".
      # Note: as per E+ I/O Ref.: "If the user enters a valid schedule name, the minimum/maximum temperature values specified in this schedule will override the constant value specified in the Minimum/Maximum Indoor Temperature field." under the objects of "ZoneVentilation:DesignFlowRate" and "ZoneVentilation:WindandStackOpenArea".
      if thermal_zone.thermostat.is_initialized
        if thermal_zone.thermostat.get.to_ThermostatSetpointDualSetpoint.is_initialized
          if thermal_zone.thermostat.get.to_ThermostatSetpointDualSetpoint.get.heatingSetpointTemperatureSchedule.is_initialized ||
             thermal_zone.thermostat.get.to_ThermostatSetpointDualSetpoint.get.coolingSetpointTemperatureSchedule.is_initialized
            zone_thermostat = thermal_zone.thermostatSetpointDualSetpoint.get
            zone_clg_thermostat_sch = zone_thermostat.coolingSetpointTemperatureSchedule.get
            zone_htg_thermostat_sch = zone_thermostat.heatingSetpointTemperatureSchedule.get

            ##### Create schedule for max Tin to have NV on the basis of cooling setpoint temperature for default day
            zone_clg_thermostat_sch_name = zone_clg_thermostat_sch.name
            zone_clg_sp_schedule = zone_clg_thermostat_sch.to_ScheduleRuleset.get

            max_Tin_schedule = zone_clg_sp_schedule.clone(model).to_ScheduleRuleset.get
            max_Tin_schedule.setName('natural_ventilation_max_Tin_schedule')
            ## default days/weekdays
            max_Tin_schedule_defaultDay = max_Tin_schedule.defaultDaySchedule
            max_Tin_schedule_defaultDay.setName('natural_ventilation_max_Tin_schedule_defaultDay')
            max_Tin_schedule_defaultDay_times = max_Tin_schedule_defaultDay.times
            max_Tin_schedule_defaultDay_values = max_Tin_schedule_defaultDay.values
            max_Tin_schedule_defaultDay_values_adjusted = max_Tin_schedule_defaultDay_values.map { |i| i + setpoint_adjustment_for_nv }
            i = 0.0
            max_Tin_schedule_defaultDay_times.each do |time|
              max_Tin_schedule_defaultDay.addValue(time, max_Tin_schedule_defaultDay_values_adjusted[i])
              i += 1.0
            end

            ##### Create schedule for min Tin to have NV on the basis of cooling setpoint temperature for default day
            zone_htg_thermostat_sch_name = zone_htg_thermostat_sch.name
            zone_htg_sp_schedule = zone_htg_thermostat_sch.to_ScheduleRuleset.get
            min_Tin_schedule = zone_htg_sp_schedule.clone(model).to_ScheduleRuleset.get
            min_Tin_schedule.setName('natural_ventilation_min_Tin_schedule')
            ## default days/weekdays
            min_Tin_schedule_defaultDay = min_Tin_schedule.defaultDaySchedule
            min_Tin_schedule_defaultDay.setName('natural_ventilation_min_Tin_schedule_defaultDay')
            min_Tin_schedule_defaultDay_times = min_Tin_schedule_defaultDay.times
            min_Tin_schedule_defaultDay_values = min_Tin_schedule_defaultDay.values
            min_Tin_schedule_defaultDay_values_adjusted = min_Tin_schedule_defaultDay_values.map { |index| index - setpoint_adjustment_for_nv }
            i = 0.0
            min_Tin_schedule_defaultDay_times.each do |time|
              min_Tin_schedule_defaultDay.addValue(time, min_Tin_schedule_defaultDay_values_adjusted[i])
              i += 1.0
            end


            ##### Calculate how many windows a space has.
            # The total number of windows is used to divide OA/person and OA/FloorArea of the space by it (i.e. number of windows).
            # In this way, NV-driven OA in each space would be avoided to be more than required.
            space.surfaces.sort.each do |surface|
              surface.subSurfaces.sort.each do |subsurface|
                if (subsurface.subSurfaceType == 'OperableWindow' || subsurface.subSurfaceType == 'FixedWindow') && subsurface.outsideBoundaryCondition == 'Outdoors'
                  number_of_windows += 1.0
                end
              end
            end
            oa_per_person_normalized_by_number_of_windows = outdoor_air_flow_per_person / number_of_windows
            oa_per_floor_area_normalized_by_number_of_windows = outdoor_air_flow_per_floor_area / number_of_windows

            ##### Add NV in each space that has window(s) using two objects: "ZoneVentilation:DesignFlowRate" and "ZoneVentilation:WindandStackOpenArea"
            space.surfaces.sort.each do |surface|
              surface.subSurfaces.sort.each do |subsurface|
                if (subsurface.subSurfaceType == 'OperableWindow' || subsurface.subSurfaceType == 'FixedWindow') && subsurface.outsideBoundaryCondition == 'Outdoors'
                  window_azimuth_deg = OpenStudio.convert(subsurface.azimuth, 'rad', 'deg').get
                  window_area = subsurface.netArea

                  ##### Define a constant schedule for operable windows
                  operable_window_schedule = OpenStudio::Model::ScheduleConstant.new(model)
                  operable_window_schedule.setName('operable_window_schedule_constant')
                  operable_window_schedule.setScheduleTypeLimits(BTAP::Resources::Schedules::StandardScheduleTypeLimits.get_on_off(model))

                  ##### Add a "ZoneVentilation:DesignFlowRate" object for NV to set OA per person.
                  zn_vent_design_flow_rate_1 = OpenStudio::Model::ZoneVentilationDesignFlowRate.new(model)
                  zn_vent_design_flow_rate_1.setFlowRateperPerson(oa_per_person_normalized_by_number_of_windows)
                  if model.version < OpenStudio::VersionString.new('3.5.0')
                    # Design Flow Rate Calculation Method is automatically set in 3.5.0+
                    zn_vent_design_flow_rate_1.setDesignFlowRateCalculationMethod('Flow/Person')
                  end
                  zn_vent_design_flow_rate_1.setVentilationType('Natural')
                  zn_vent_design_flow_rate_1.setMinimumIndoorTemperatureSchedule(min_Tin_schedule)
                  zn_vent_design_flow_rate_1.setMaximumIndoorTemperatureSchedule(max_Tin_schedule)
                  zn_vent_design_flow_rate_1.setMinimumOutdoorTemperature(nv_temp_out_min)
                  zn_vent_design_flow_rate_1.setMaximumOutdoorTemperatureSchedule(max_Tin_schedule)
                  zn_vent_design_flow_rate_1.setDeltaTemperature(nv_delta_temp_in_out) # E+ I/O Ref.: "This is the temperature difference between the indoor and outdoor air dry-bulb temperatures below which ventilation is shutoff."
                  zone_hvac_equipment_list.addEquipment(zn_vent_design_flow_rate_1)

                  ##### Add another "ZoneVentilation:DesignFlowRate" object for NV to set OA per floor area.
                  zn_vent_design_flow_rate_2 = OpenStudio::Model::ZoneVentilationDesignFlowRate.new(model)
                  zn_vent_design_flow_rate_2.setFlowRateperZoneFloorArea(oa_per_floor_area_normalized_by_number_of_windows)
                  if model.version < OpenStudio::VersionString.new('3.5.0')
                    # Design Flow Rate Calculation Method is automatically set in 3.5.0+
                    zn_vent_design_flow_rate_2.setDesignFlowRateCalculationMethod('Flow/Area')
                  end
                  zn_vent_design_flow_rate_2.setVentilationType('Natural')
                  zn_vent_design_flow_rate_2.setMinimumIndoorTemperatureSchedule(min_Tin_schedule)
                  zn_vent_design_flow_rate_2.setMaximumIndoorTemperatureSchedule(max_Tin_schedule)
                  zn_vent_design_flow_rate_2.setMinimumOutdoorTemperature(nv_temp_out_min)
                  zn_vent_design_flow_rate_2.setMaximumOutdoorTemperatureSchedule(max_Tin_schedule)
                  zn_vent_design_flow_rate_2.setDeltaTemperature(nv_delta_temp_in_out)
                  zone_hvac_equipment_list.addEquipment(zn_vent_design_flow_rate_2)

                  ##### Add the "ZoneVentilation:WindandStackOpenArea" for NV.
                  # Note: it has been assumed that 'Opening Effectiveness' and 'Discharge Coefficient for Opening' are autocalculated (which are the default assumptions).
                  zn_vent_wind_and_stack = OpenStudio::Model::ZoneVentilationWindandStackOpenArea.new(model)
                  zn_vent_wind_and_stack.setOpeningArea(window_area * nv_opening_fraction)
                  zn_vent_wind_and_stack.setOpeningAreaFractionSchedule(operable_window_schedule)
                  # (Ref: E+ I/O) The Effective Angle value "is used to calculate the angle between the wind direction and the opening outward normal to determine the opening effectiveness values when the input field Opening Effectiveness = Autocalculate."
                  # (Ref: E+ I/O) "Effective Angle is the angle in degrees counting from the North clockwise to the opening outward normal."
                  zn_vent_wind_and_stack.setEffectiveAngle(window_azimuth_deg)
                  zn_vent_wind_and_stack.setMinimumIndoorTemperatureSchedule(min_Tin_schedule)
                  zn_vent_wind_and_stack.setMaximumIndoorTemperatureSchedule(max_Tin_schedule)
                  zn_vent_wind_and_stack.setMinimumOutdoorTemperature(nv_temp_out_min)
                  zn_vent_wind_and_stack.setMaximumOutdoorTemperatureSchedule(max_Tin_schedule)
                  zn_vent_wind_and_stack.setDeltaTemperature(nv_delta_temp_in_out)
                  zone_hvac_equipment_list.addEquipment(zn_vent_wind_and_stack)
                  # if (subsurface.subSurfaceType == 'OperableWindow' || subsurface.subSurfaceType == 'FixedWindow') && subsurface.outsideBoundaryCondition == 'Outdoors'
                end
                # surface.subSurfaces.sort.each do |subsurface|
              end
              # space.surfaces.sort.each do |surface|

          end
        end
      end


      end
      # thermal_zone.spaces.sort.each do |space|
    end
    # model.getZoneHVACEquipmentLists.sort.each do |zone_hvac_equipment_list|
  end
  ##### Add AvailabilityManagerHybridVentilation to "prevents simultaneous natural ventilation and HVAC system operation" (Ref: E+ I/O)
  model.getAirLoopHVACs.sort.each do |air_loop|
    air_loop.availabilityManagers.sort.each do |avail_mgr|
      if avail_mgr.to_AvailabilityManagerHybridVentilation.empty?
        avail_mgr_hybr_vent = OpenStudio::Model::AvailabilityManagerHybridVentilation.new(model)
        avail_mgr_hybr_vent.setMinimumOutdoorTemperature(nv_temp_out_min) # Note: since "Ventilation Control Mode" is by default set to "Temperature (i.e. 1)", only min and max Tout are needed. (see E+ I/O Ref.)  #Note: Tout_min is to avoid overcooling (see E+ I/O Ref).
        avail_mgr_hybr_vent.setMaximumOutdoorTemperature(30.0) # Note: the AvailabilityManagerHybridVentilation obj does not have a schedule field for Tout, so it has been set to a fixed value of 30C.
        air_loop.addAvailabilityManager(avail_mgr_hybr_vent)
      end
    end
  end
end

#apply_pv_ground(model:, pv_ground_type:, pv_ground_total_area_pv_panels_m2:, pv_ground_tilt_angle:, pv_ground_azimuth_angle:, pv_ground_module_description:) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/openstudio-standards/standards/necb/ECMS/pv_ground.rb', line 2

def apply_pv_ground(model:, pv_ground_type:, pv_ground_total_area_pv_panels_m2:, pv_ground_tilt_angle:, pv_ground_azimuth_angle:, pv_ground_module_description:)
  ##### Remove leading or trailing whitespace in case users add them in inputs
  if pv_ground_total_area_pv_panels_m2.instance_of?(String)
    pv_ground_total_area_pv_panels_m2 = pv_ground_total_area_pv_panels_m2.strip
  end
  if pv_ground_tilt_angle.instance_of?(String)
    pv_ground_tilt_angle = pv_ground_tilt_angle.strip
  end
  if pv_ground_azimuth_angle.instance_of?(String)
    pv_ground_azimuth_angle = pv_ground_azimuth_angle.strip
  end

  ##### If any of users' inputs are nil/false do nothing.
  return if pv_ground_type.nil? || pv_ground_type == false || pv_ground_type == 'none' || pv_ground_type == 'NECB_Default'
  return if pv_ground_total_area_pv_panels_m2 == nil? || pv_ground_total_area_pv_panels_m2 == false || pv_ground_total_area_pv_panels_m2 == 'none'
  return if pv_ground_tilt_angle == nil? || pv_ground_tilt_angle == false || pv_ground_tilt_angle == 'none'
  return if pv_ground_azimuth_angle == nil? || pv_ground_azimuth_angle == false || pv_ground_azimuth_angle == 'none'
  return if pv_ground_module_description == nil? || pv_ground_module_description == false || pv_ground_module_description == 'none'

  ##### Convert a string to a float (except for pv_ground_type and pv_ground_module_description)
  if pv_ground_total_area_pv_panels_m2.instance_of?(String) && pv_ground_total_area_pv_panels_m2 != 'NECB_Default'
    pv_ground_total_area_pv_panels_m2 = pv_ground_total_area_pv_panels_m2.to_f
  end
  if pv_ground_tilt_angle.instance_of?(String) && pv_ground_tilt_angle != 'NECB_Default'
    pv_ground_tilt_angle = pv_ground_tilt_angle.to_f
  end
  if pv_ground_azimuth_angle.instance_of?(String) && pv_ground_azimuth_angle != 'NECB_Default'
    pv_ground_azimuth_angle = pv_ground_azimuth_angle.to_f
  end

  ##### Calculate footprint of the building model (this is used as default value for pv_ground_total_area_pv_panels_m2)
  building_footprint_m2 = calculate_building_footprint(model: model)
  # puts "building_footprint_m2 is #{building_footprint_m2}"
  ##### Set default PV panels' total area as the building footprint
  if pv_ground_total_area_pv_panels_m2 == 'NECB_Default'
    pv_ground_total_area_pv_panels_m2 = building_footprint_m2
  end

  ##### Set default PV panels' tilt angle as the latitude
  if pv_ground_tilt_angle == 'NECB_Default'
    epw = OpenStudio::EpwFile.new(model.weatherFile.get.path.get)
    pv_ground_tilt_angle = epw.latitude
  end

  ##### Set default PV panels' azimuth angle as south-facing arrays
  if pv_ground_azimuth_angle == 'NECB_Default'
    pv_ground_azimuth_angle = 180 # EnergyPlus I/O Reference: "An azimuth angle of 180deg is for a south-facing array, and an azimuth angle of 0deg is for a north-facing array."
  end

  ##### Set default PV module type as the the below one
  if pv_ground_module_description == 'NECB_Default'
    pv_ground_module_description = 'HES-160-36PV 26.6  x 58.3 x 1.38' # Note: As per Mike Lubun's comment, assuming a typical panel is 5 ft x 2 ft, the closest standard type PV panel in the spreadsheet would be the 160W HES.
  end

  ##### Calculate number of PV panels
  # Note: assuming 5 ft x 2 ft as PV panel's size since it seems to fit the racking system used for ground mounts as per Mike Lubun's comment.
  pv_area_each_ft2 = 5.0 * 2.0
  pv_area_each_m2 = OpenStudio.convert(pv_area_each_ft2, 'ft^2', 'm^2').get # convert pv_area_each_ft2 to m2
  pv_number_panels = pv_ground_total_area_pv_panels_m2 / pv_area_each_m2

  ##### Get data of the PV panel from the json file
  pv_info = @standards_data['tables']['pv']['table'].detect { |item| item['pv_module_description'] == pv_ground_module_description }
  pv_ground_module_type = pv_info['pv_module_type']
  pv_watt = pv_info['pv_module_wattage']

  ##### Create the generator
  # Assuming one PVWatts generator in E+ as per Mike Lubun's comment for simplification, however exact number of PVWatts generators (and inverters) are calculated for costing.
  dc_system_capacity = pv_number_panels * pv_watt
  generator = OpenStudio::Model::GeneratorPVWatts.new(model, dc_system_capacity)
  generator.setModuleType(pv_ground_module_type)
  # generator.setArrayType('OneAxis') # Note: "tilt and azimuth are fixed" for this array type (see E+ I/O Reference). This array type has been chosen as per Mike Lubun's costing spec.
  generator.setArrayType('FixedOpenRack') # Note: The 'FixedOpenRack' array type has been used instead of 'OneAxis' since the 'OneAxis' array type did not allow to have a non-zero tilt angle in OpenStudio 3.2.1.
  # (As per E+ I/O Reference: 'FixedOpenRack' is used for ground mounted arrays, assumes air flows freely around the array.)
  generator.setTiltAngle(pv_ground_tilt_angle)
  generator.setAzimuthAngle(pv_ground_azimuth_angle)

  ##### Create the inverter
  inverter = OpenStudio::Model::ElectricLoadCenterInverterPVWatts.new(model)
  inverter.setDCToACSizeRatio(1.1) # Note: This is EnergyPlus' default value; This default value has been chosen for ground-mounted PV, assuming no storage as per Mike Lubun's costing spec.
  inverter.setInverterEfficiency(0.96) # Note: This is EnergyPlus' default value; This default value has been chosen as per Mike Lubun's costing spec.

  ##### Add distribution systems, set relevant parameters, and add created generator to it
  elc_distribution = OpenStudio::Model::ElectricLoadCenterDistribution.new(model)
  elc_distribution.setInverter(inverter)
  elc_distribution.setGeneratorOperationSchemeType('Baseload') # E+ I/O Reference: "The Baseload scheme requests all generators scheduled ON (available) to operate, even if the amount of electric power generated exceeds the total facility electric power demand." This scheme type has been chosen as per Mike Lubun's costing spec.
  elc_distribution.addGenerator(generator)
end

#apply_system_ecm(model:, ecm_system_name: nil, template_standard:, runner: nil, ecm_system_zones_map_option: 'NECB_Default') ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/openstudio-standards/standards/necb/ECMS/ecms.rb', line 42

def apply_system_ecm(model:,
                     ecm_system_name: nil,
                     template_standard:,
                     runner: nil,
                     ecm_system_zones_map_option: 'NECB_Default')
  # Do nothing if nil or other usual suspects.. covering all bases for now.
  return if ecm_system_name.nil? || ecm_system_name == 'none' || ecm_system_name == 'NECB_Default'
  # Verify the heating fuel
  primary_heating_fuel = template_standard.fuel_type_set.ecm_fueltype
  raise("Heating fuel for ECM #{ecm_system_name} is neither Electricity nor NaturalGas") if ((primary_heating_fuel != 'Electricity') && (primary_heating_fuel != 'NaturalGas'))
  ecm_system_zones_map_option = 'NECB_Default' if ecm_system_zones_map_option.nil? || ecm_system_zones_map_option == 'none'

  ecm_std = Standard.build('ECMS')
  systems = model.getAirLoopHVACs
  map_system_to_zones, system_doas_flags = ecm_std.get_map_systems_to_zones(systems)
  ecm_add_method_name = "add_ecm_#{ecm_system_name.downcase}"

  raise("the method #{ecm_add_method_name} does not exist in the ECM class. Please verify that this should be called.") unless ecm_std.respond_to? ecm_add_method_name

  # when the ecm is associated with adding a new HVAC system, then remove existing system components and loops
  ecm_std.remove_all_zone_eqpt(systems)
  ecm_std.remove_air_loops(model)
  ecm_std.remove_hw_loops(model)
  ecm_std.remove_chw_loops(model)
  ecm_std.remove_cw_loops(model)

  ecm_std.send(ecm_add_method_name,
               model: model,
               system_zones_map: map_system_to_zones,
               system_doas_flags: system_doas_flags,
               ecm_system_zones_map_option: ecm_system_zones_map_option,
               standard: template_standard)
end

#apply_system_efficiencies_ecm(model:, ecm_system_name: nil, template_standard:) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/openstudio-standards/standards/necb/ECMS/ecms.rb', line 76

def apply_system_efficiencies_ecm(model:, ecm_system_name: nil, template_standard:)
  # Do nothing if nil.
  return if ecm_system_name.nil? || ecm_system_name == 'none' || ecm_system_name == 'NECB_Default' || ecm_system_name.to_s.downcase == 'remove_airloops_add_zone_baseboards'

  ecm_std = Standard.build('ECMS')
  # Get method name that should be present in the ECM class.
  ecm_apply_eff_method_name = "apply_efficiency_ecm_#{ecm_system_name.downcase}"
  # Raise exception if method does not exists.
  raise("the method #{ecm_apply_eff_method_name} does not exist in the ECM class. Please verify that this should be called.") unless ecm_std.respond_to?(ecm_apply_eff_method_name)

  # apply system eff method.
  ecm_std.send(ecm_apply_eff_method_name, model, template_standard)
end

#calculate_building_footprint(model:) ⇒ Object

Method for calculating footprint of the building model



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/openstudio-standards/standards/necb/ECMS/pv_ground.rb', line 91

def calculate_building_footprint(model:)
  building_footprint_m2_array = []
  lowest_floor = 10000000000.0 # dummy number as initialization to find the lowest floor among spaces # @todo Question:it it fine that it has been assumed that the floor of all lowest spaces are at the same level?
  model.getSpaces.sort.each do |space|
    space.surfaces.sort.select { |surface| (surface.surfaceType == 'Floor') && (surface.outsideBoundaryCondition != 'Surface') && (surface.outsideBoundaryCondition != 'Adiabatic') }.each do |surface|
      floor_vertices = surface.vertices
      floor_z = floor_vertices[0].z.round(1)
      if floor_z <= lowest_floor
        lowest_floor = floor_z
        building_footprint_m2_array << surface.netArea
      end
    end
  end
  building_footprint_m2 = building_footprint_m2_array.sum
  return building_footprint_m2
end

#chiller_electric_eir_apply_curves_and_cop(chiller_electric_eir, search_criteria) ⇒ Object

Applies the performance curves “ChillerElectricEIR” object.



2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2161

def chiller_electric_eir_apply_curves_and_cop(chiller_electric_eir, search_criteria)
  successfully_set_all_properties = true

  # Get the capacity
  capacity_w = chiller_electric_eir_find_capacity(chiller_electric_eir)
  capacity_tons = OpenStudio.convert(capacity_w, 'W', 'ton').get

  # Lookup performance curves
  chlr_props = model_find_object(standards_data['tables']['chillers_ecm']['table'], search_criteria, capacity_tons)

  # Check to make sure properties were found
  if chlr_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find efficiency info using #{search_criteria}")
    successfully_set_all_properties = false
  end

  # CAP-FT curve
  capft = model_add_curve(chiller_electric_eir.model, chlr_props['capft'])
  if capft
    chiller_electric_eir.setCoolingCapacityFunctionOfTemperature(capft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find cap_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # EIR-FT curve
  eirft = model_add_curve(chiller_electric_eir.model, chlr_props['eirft'])
  if eirft
    chiller_electric_eir.setElectricInputToCoolingOutputRatioFunctionOfTemperature(eirft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find eir_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # EIR-FPLR curve
  eirfplr = model_add_curve(chiller_electric_eir.model, chlr_props['eirfplr'])
  if eirfplr
    chiller_electric_eir.setElectricInputToCoolingOutputRatioFunctionOfPLR(eirfplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find eir_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

  # set COP
  cop = chlr_props['minimum_coefficient_of_performance_cooling'].to_f
  if cop
    chiller_electric_eir.setReferenceCOP(cop)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.ChillerElectricEIR', "For #{chiller_electric_eir.name}, cannot find cop, will not be set.")
    successfully_set_all_properties = false
  end

end

#chiller_electric_eir_find_capacity(chiller_electric_eir) ⇒ Object

Find cooling capacity for “ChillerElectricEIR” object



3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3086

def chiller_electric_eir_find_capacity(chiller_electric_eir)
  capacity_w = nil
  if chiller_electric_eir.referenceCapacity.is_initialized
    capacity_w = chiller_electric_eir.referenceCapacity.get
  elsif chiller_electric_eir.autosizedRererenceCapacity.is_initialized
    capacity_w = chiller_electric_eir.autosizedRerenceCapacity.get
    chiller_electric_eir.setReferenceCapacity(capacity_w)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ChillerElectricEIR', "For #{chiller_electric_eir.name} capacity not available")
    return 0.0
  end

  return capacity_w
end

#coil_cooling_dx_single_speed_apply_cop(coil_cooling_dx_single_speed, search_criteria, rename = false) ⇒ Object

Find efficiency for “CoilCoolingDXSingleSpeed” object



2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2617

def coil_cooling_dx_single_speed_apply_cop(coil_cooling_dx_single_speed,
                                           search_criteria,
                                           rename = false)

  capacity_w = coil_cooling_dx_single_speed_find_capacity(coil_cooling_dx_single_speed)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Look up the efficiency characteristics
  ac_props = model_find_object(standards_data['tables']['heat_pump_cooling_ecm']['table'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find efficiency info using #{search_criteria}.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency
  cop = nil

  # If specified as SEER
  unless ac_props['minimum_seasonal_energy_efficiency_ratio'].nil?
    min_seer = ac_props['minimum_seasonal_energy_efficiency_ratio']
    cop = seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER
  unless ac_props['minimum_energy_efficiency_ratio'].nil?
    min_eer = ac_props['minimum_energy_efficiency_ratio']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # if specified as SEER (heat pump)
  unless ac_props['minimum_seasonal_efficiency'].nil?
    min_seer = ac_props['minimum_seasonal_efficiency']
    cop = seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER (heat pump)
  unless ac_props['minimum_full_load_efficiency'].nil?
    min_eer = ac_props['minimum_full_load_efficiency']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as COP
  unless ac_props['minimum_coefficient_of_performance_cooling'].nil?
    cop = ac_props['minimum_coefficient_of_performance_cooling']
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{cop}COP"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{template}: #{coil_cooling_dx_single_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; COP = #{cop}")
  end

  # Rename
  if rename
    coil_cooling_dx_single_speed.setName(new_comp_name)
  end

  # Set COP
  coil_cooling_dx_single_speed.setRatedCOP(cop.to_f) unless cop.nil?

end

#coil_cooling_dx_single_speed_apply_curves(coil_cooling_dx_single_speed, eqpt_name) ⇒ Object

Applies the performance curves “CoilCoolingDXSingleSpeed” object.



2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2012

def coil_cooling_dx_single_speed_apply_curves(coil_cooling_dx_single_speed, eqpt_name)
  successfully_set_all_properties = true

  search_criteria = {}
  search_criteria['name'] = eqpt_name

  # Get the capacity
  capacity_w = coil_cooling_dx_single_speed_find_capacity(coil_cooling_dx_single_speed)
  capacity_w = [1.0,capacity_w].max
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get

  # Lookup efficiencies
  ac_props = model_find_object(standards_data['tables']['heat_pump_cooling_ecm']['table'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find efficiency info using #{search_criteria}, cannot apply efficiency.")
    successfully_set_all_properties = false
  end

  # Make the COOL-CAP-FT curve
  cool_cap_ft = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_cap_ft'])

  if cool_cap_ft
    coil_cooling_dx_single_speed.setTotalCoolingCapacityFunctionOfTemperatureCurve(cool_cap_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find cool_cap_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-CAP-FFLOW curve
  cool_cap_fflow = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_cap_fflow'])
  if cool_cap_fflow
    coil_cooling_dx_single_speed.setTotalCoolingCapacityFunctionOfFlowFractionCurve(cool_cap_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find cool_cap_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-EIR-FT curve
  cool_eir_ft = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_eir_ft'])
  if cool_eir_ft
    coil_cooling_dx_single_speed.setEnergyInputRatioFunctionOfTemperatureCurve(cool_eir_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find cool_eir_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-EIR-FFLOW curve
  cool_eir_fflow = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_eir_fflow'])
  if cool_eir_fflow
    coil_cooling_dx_single_speed.setEnergyInputRatioFunctionOfFlowFractionCurve(cool_eir_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_single_speed.name}, cannot find cool_eir_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-PLF-FPLR curve
  cool_plf_fplr = model_add_curve(coil_cooling_dx_single_speed.model, ac_props['cool_plf_fplr'])
  if cool_plf_fplr
    coil_cooling_dx_single_speed.setPartLoadFractionCorrelationCurve(cool_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXSingleSpeed', "For #{coil_cooling_dx_Single_speed.name}, cannot find cool_plf_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

end

#coil_cooling_dx_variable_speed_apply_cop(coil_cooling_dx_variable_speed, search_criteria, rename = false) ⇒ Object

Find efficiency for “CoilCoolingDXVariableSpeed” object



2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2754

def coil_cooling_dx_variable_speed_apply_cop(coil_cooling_dx_variable_speed,
                                             search_criteria,
                                             rename = false)

  capacity_w = coil_cooling_dx_variable_speed_find_capacity(coil_cooling_dx_variable_speed)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Look up the efficiency characteristics
  ac_props = model_find_object(standards_data['tables']['heat_pump_cooling_ecm']['table'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{coil_cooling_dx_variable_speed.name}, cannot find efficiency info using #{search_criteria}.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency
  cop = nil

  # If specified as SEER
  unless ac_props['minimum_seasonal_energy_efficiency_ratio'].nil?
    min_seer = ac_props['minimum_seasonal_energy_efficiency_ratio']
    cop = seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{template}: #{coil_cooling_dx_variable_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER
  unless ac_props['minimum_energy_efficiency_ratio'].nil?
    min_eer = ac_props['minimum_energy_efficiency_ratio']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{template}: #{coil_cooling_dx_variable_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # if specified as SEER (heat pump)
  unless ac_props['minimum_seasonal_efficiency'].nil?
    min_seer = ac_props['minimum_seasonal_efficiency']
    cop = seer_to_cop_no_fan(min_seer)
    new_comp_name = "#{coil_cooling_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}SEER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{template}: #{coil_cooling_dx_variable_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER (heat pump)
  unless ac_props['minimum_full_load_efficiency'].nil?
    min_eer = ac_props['minimum_full_load_efficiency']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_cooling_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{template}: #{coil_cooling_dx_variable_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as COP
  unless ac_props['minimum_coefficient_of_performance_cooling'].nil?
    cop = ac_props['minimum_coefficient_of_performance_cooling']
    new_comp_name = "#{coil_cooling_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{cop}COP"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{template}: #{coil_cooling_dx_variable_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; COP = #{cop}")
  end

  # Rename
  if rename
    coil_cooling_dx_variable_speed.setName(new_comp_name)
  end

  # Set COP values
  coil_cooling_dx_variable_speed.speeds.each { |speed| speed.setReferenceUnitGrossRatedCoolingCOP(cop.to_f) } unless cop.nil?

end

#coil_cooling_dx_variable_speed_apply_curves(coil_cooling_dx_variable_speed, eqpt_name) ⇒ Object

Applies the performance curves “CoilCoolingDXVariableSpeed” object.



2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2217

def coil_cooling_dx_variable_speed_apply_curves(coil_cooling_dx_variable_speed, eqpt_name)
  successfully_set_all_properties = true

  # Get the capacity
  capacity_w = coil_cooling_dx_variable_speed_find_capacity(coil_cooling_dx_variable_speed)
  capacity_w = [1.0,capacity_w].max
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get

  # Lookup performance curves
  search_criteria = {}
  search_criteria['name'] = eqpt_name
  ac_props = model_find_object(standards_data['tables']['heat_pump_cooling_ecm']['table'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if ac_props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.CoilCoolingDXVariableSpeed', "For #{coil_cooling_dx_variable_speed.name}, cannot find efficiency info using #{search_criteria}, cannot apply efficiency.")
    successfully_set_all_properties = false
  end

  # Make the COOL-CAP-FT curve
  cool_cap_ft = model_add_curve(coil_cooling_dx_variable_speed.model, ac_props['cool_cap_ft'])
  if cool_cap_ft
    coil_cooling_dx_variable_speed.speeds.each { |speed| speed.setTotalCoolingCapacityFunctionofTemperatureCurve(cool_cap_ft) }
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.CoilCoolingDXVariableSpeed', "For #{coil_cooling_dx_variable_speed.name}, cannot find cool_cap_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-CAP-FFLOW curve
  cool_cap_fflow = model_add_curve(coil_cooling_dx_variable_speed.model, ac_props['cool_cap_fflow'])
  if cool_cap_fflow
    coil_cooling_dx_variable_speed.speeds.each { |speed| speed.setTotalCoolingCapacityFunctionofAirFlowFractionCurve(cool_cap_fflow) }
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standard.CoilCoolingDXVariableSpeed', "For #{coil_cooling_dx_variable_speed.name}, cannot find cool_cap_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-EIR-FT curve
  cool_eir_ft = model_add_curve(coil_cooling_dx_variable_speed.model, ac_props['cool_eir_ft'])
  if cool_eir_ft
    coil_cooling_dx_variable_speed.speeds.each { |speed| speed.setEnergyInputRatioFunctionofTemperatureCurve(cool_eir_ft) }
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{coil_cooling_dx_variable_speed.name}, cannot find cool_eir_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-EIR-FFLOW curve
  cool_eir_fflow = model_add_curve(coil_cooling_dx_variable_speed.model, ac_props['cool_eir_fflow'])
  if cool_eir_fflow
    coil_cooling_dx_variable_speed.speeds.each { |speed| speed.setEnergyInputRatioFunctionofAirFlowFractionCurve(cool_eir_fflow) }
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{coil_cooling_dx_variable_speed.name}, cannot find cool_eir_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the COOL-PLF-FPLR curve
  cool_plf_fplr = model_add_curve(coil_cooling_dx_variable_speed.model, ac_props['cool_plf_fplr'])
  if cool_plf_fplr
    coil_cooling_dx_variable_speed.setEnergyPartLoadFractionCurve(cool_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{coil_cooling_dx_variable_speed.name}, cannot find cool_plf_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

end

#coil_cooling_dx_variable_speed_find_capacity(coil_cooling_dx_variable_speed) ⇒ Object

Find cooling capacity for “CoilCoolingDXVariableSpeed” object



3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3020

def coil_cooling_dx_variable_speed_find_capacity(coil_cooling_dx_variable_speed)
  capacity_w = nil
  if coil_cooling_dx_variable_speed.grossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.is_initialized
    capacity_w = coil_cooling_dx_variable_speed.grossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.get
  elsif coil_cooling_dx_variable_speed.autosizedGrossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.is_initialized
    capacity_w = coil_cooling_dx_variable_speed.autosizedGrossRatedTotalCoolingCapacityAtSelectedNominalSpeedLevel.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXVariableSpeed', "For #{coil_cooling_dx_variable_speed.name} capacity is not available.")
    return 0.0
  end

  return capacity_w
end

#coil_heating_dx_single_speed_apply_cop(coil_heating_dx_single_speed, search_criteria, rename = false) ⇒ Object

Find efficiency for “CoilHeatingDXSingleSpeed” object



2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2689

def coil_heating_dx_single_speed_apply_cop(coil_heating_dx_single_speed,
                                           search_criteria,
                                           rename = false)

  capacity_w = coil_heating_dx_single_speed_find_capacity(coil_heating_dx_single_speed)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Look up the efficiency characteristics
  props = model_find_object(standards_data['tables']['heat_pump_heating_ecm'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find efficiency info using #{search_criteria}")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency
  cop = nil

  # If specified as EER
  unless props['minimum_energy_efficiency_ratio'].nil?
    min_eer = props['minimum_energy_efficiency_ratio']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{template}: #{coil_heating_dx_single_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # if specified as HSPF (heat pump)
  unless props['minimum_heating_seasonal_performance_factor'].nil?
    min_hspf = props['minimum_heating_seasonal_performance_factor']
    cop = hspf_to_cop_no_fan(min_hspf)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}HSPF"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{template}: #{coil_heating_dx_single_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER (heat pump)
  unless props['minimum_full_load_efficiency'].nil?
    min_eer = props['minimum_full_load_efficiency']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{template}: #{coil_heating_dx_single_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as COP
  unless props['minimum_coefficient_of_performance_heating'].nil?
    cop_min = props['minimum_coefficient_of_performance_heating']
    cop = cop_heating_to_cop_heating_no_fan(cop_min, capacity_w)
    new_comp_name = "#{coil_heating_dx_single_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{cop}COP"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{template}: #{coil_heating_dx_single_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # Rename
  if rename
    coil_heating_dx_single_speed.setName(new_comp_name)
  end

  # Set COP
  coil_heating_dx_single_speed.setRatedCOP(cop.to_f) unless cop.nil?

end

#coil_heating_dx_single_speed_apply_curves(coil_heating_dx_single_speed, eqpt_name) ⇒ Object

Applies the performance curves to “CoilHeatingSingleSpeed” object.



2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2082

def coil_heating_dx_single_speed_apply_curves(coil_heating_dx_single_speed, eqpt_name)
  successfully_set_all_properties = true

  # Get the search criteria
  search_criteria = {}
  search_criteria['name'] = eqpt_name

  # Get the capacity
  capacity_w = coil_heating_dx_single_speed_find_capacity(coil_heating_dx_single_speed)
  capacity_w = [1.0,capacity_w].max
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get

  # Lookup efficiencies
  props = model_find_object(standards_data['tables']['heat_pump_heating_ecm']['table'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find efficiency info using #{search_criteria}.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-CAP-FT curve
  heat_cap_ft = model_add_curve(coil_heating_dx_single_speed.model, props['heat_cap_ft'])
  if heat_cap_ft
    coil_heating_dx_single_speed.setTotalHeatingCapacityFunctionofTemperatureCurve(heat_cap_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_cap_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-CAP-FFLOW curve
  heat_cap_fflow = model_add_curve(coil_heating_dx_single_speed.model, props['heat_cap_fflow'])
  if heat_cap_fflow
    coil_heating_dx_single_speed.setTotalHeatingCapacityFunctionofFlowFractionCurve(heat_cap_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_cap_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FT curve
  heat_eir_ft = model_add_curve(coil_heating_dx_single_speed.model, props['heat_eir_ft'])
  if heat_eir_ft
    coil_heating_dx_single_speed.setEnergyInputRatioFunctionofTemperatureCurve(heat_eir_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_eir_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FFLOW curve
  heat_eir_fflow = model_add_curve(coil_heating_dx_single_speed.model, props['heat_eir_fflow'])
  if heat_eir_fflow
    coil_heating_dx_single_speed.setEnergyInputRatioFunctionofFlowFractionCurve(heat_eir_fflow)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_eir_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-PLF-FPLR curve
  heat_plf_fplr = model_add_curve(coil_heating_dx_single_speed.model, props['heat_plf_fplr'])
  if heat_plf_fplr
    coil_heating_dx_single_speed.setPartLoadFractionCorrelationCurve(heat_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, cannot find heat_plf_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-DEFROST-EIR-FT curve
  heat_defrost_eir_ft = model_add_curve(coil_heating_dx_single_speed.model, props['heat_defrost_eir_ft'])
  if heat_defrost_eir_ft
    coil_heating_dx_single_speed.setDefrostEnergyInputRatioFunctionofTemperatureCurve(heat_defrost_eir_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXSingleSpeed', "For #{coil_heating_dx_single_speed.name}, can not find heat_defrost_eir_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

end

#coil_heating_dx_variable_speed_apply_cop(coil_heating_dx_variable_speed, search_criteria, rename = false) ⇒ Object

Find efficiency for “CoilHeatingDXVariableSpeed” object



2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2826

def coil_heating_dx_variable_speed_apply_cop(coil_heating_dx_variable_speed,
                                             search_criteria,
                                             rename = false)

  capacity_w = coil_heating_dx_variable_speed_find_capacity(coil_heating_dx_variable_speed)
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get
  capacity_kbtu_per_hr = OpenStudio.convert(capacity_w, 'W', 'kBtu/hr').get

  # Look up the efficiency characteristics
  props = model_find_object(standards_data['tables']['heat_pump_heating_ecm'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{coil_heating_dx_variable_speed.name}, cannot find efficiency info using #{search_criteria}.")
    successfully_set_all_properties = false
    return successfully_set_all_properties
  end

  # Get the minimum efficiency
  cop = nil

  # If specified as EER
  unless props['minimum_energy_efficiency_ratio'].nil?
    min_eer = props['minimum_energy_efficiency_ratio']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_heating_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{template}: #{coil_heating_dx_variable_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # if specified as HSPF (heat pump)
  unless props['minimum_heating_seasonal_performance_factor'].nil?
    min_hspf = props['minimum_heating_seasonal_performance_factor']
    cop = hspf_to_cop_no_fan(min_hspf)
    new_comp_name = "#{coil_heating_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_seer}HSPF"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{template}: #{coil_heating_dx_variable_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; SEER = #{min_seer}")
  end

  # If specified as EER (heat pump)
  unless props['minimum_full_load_efficiency'].nil?
    min_eer = props['minimum_full_load_efficiency']
    cop = eer_to_cop_no_fan(min_eer)
    new_comp_name = "#{coil_heating_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{min_eer}EER"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{template}: #{coil_heating_dx_variable_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # If specified as COP
  unless props['minimum_coefficient_of_performance_heating'].nil?
    min_cop = props['minimum_coefficient_of_performance_heating']
    cop = cop_heating_to_cop_heating_no_fan(min_cop, capacity_w)
    new_comp_name = "#{coil_heating_dx_variable_speed.name} #{capacity_kbtu_per_hr.round}kBtu/hr #{cop}COP"
    OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{template}: #{coil_heating_dx_variable_speed.name}: Capacity = #{capacity_kbtu_per_hr.round}kBtu/hr; EER = #{min_eer}")
  end

  # Rename
  if rename
    coil_heating_dx_variable_speed.setName(new_comp_name)
  end

  # Set COP values
  coil_heating_dx_variable_speed.speeds.each { |speed| speed.setReferenceUnitGrossRatedHeatingCOP(cop.to_f) } unless cop.nil?

end

#coil_heating_dx_variable_speed_apply_curves(coil_heating_dx_variable_speed, eqpt_name) ⇒ Object

Applies performance curves to “CoilHeatingVariableSpeed” object.



2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 2285

def coil_heating_dx_variable_speed_apply_curves(coil_heating_dx_variable_speed, eqpt_name)
  successfully_set_all_properties = true

  # Get the search criteria
  search_criteria = {}
  search_criteria['name'] = eqpt_name

  # Get the capacity
  capacity_w = coil_heating_dx_variable_speed_find_capacity(coil_heating_dx_variable_speed)
  capacity_w = [1.0,capacity_w].max
  capacity_btu_per_hr = OpenStudio.convert(capacity_w, 'W', 'Btu/hr').get

  # Lookup performance curves
  props = model_find_object(standards_data['tables']['heat_pump_heating_ecm']['table'], search_criteria, capacity_btu_per_hr)

  # Check to make sure properties were found
  if props.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{coil_heating_dx_variable_speed.name}, cannot find efficiency info using #{search_criteria}.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-CAP-FT curve
  heat_cap_ft = model_add_curve(coil_heating_dx_variable_speed.model, props['heat_cap_ft'])
  if heat_cap_ft
    coil_heating_dx_variable_speed.speeds.each { |speed| speed.setHeatingCapacityFunctionofTemperatureCurve(heat_cap_ft) }
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{coil_heating_dx_variable_speed.name}, cannot find heat_cap_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-CAP-FFLOW curve
  heat_cap_fflow = model_add_curve(coil_heating_dx_variable_speed.model, props['heat_cap_fflow'])
  if heat_cap_fflow
    coil_heating_dx_variable_speed.speeds.each { |speed| speed.setTotalHeatingCapacityFunctionofAirFlowFractionCurve(heat_cap_fflow) }
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{coil_heating_dx_variable_speed.name}, cannot find heat_cap_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FT curve
  heat_eir_ft = model_add_curve(coil_heating_dx_variable_speed.model, props['heat_eir_ft'])
  if heat_eir_ft
    coil_heating_dx_variable_speed.speeds.each { |speed| speed.setEnergyInputRatioFunctionofTemperatureCurve(heat_eir_ft) }
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXVariableSingleSpeed', "For #{coil_heating_dx_variable_speed.name}, cannot find heat_eir_ft curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-EIR-FFLOW curve
  heat_eir_fflow = model_add_curve(coil_heating_dx_variable_speed.model, props['heat_eir_fflow'])
  if heat_eir_fflow
    coil_heating_dx_variable_speed.speeds.each { |speed| speed.setEnergyInputRatioFunctionofAirFlowFractionCurve(heat_eir_fflow) }
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{coil_heating_dx_variable_speed.name}, cannot find heat_eir_fflow curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the HEAT-PLF-FPLR curve
  heat_plf_fplr = model_add_curve(coil_heating_dx_variable_speed.model, props['heat_plf_fplr'])
  if heat_plf_fplr
    coil_heating_dx_variable_speed.setEnergyPartLoadFractionCurve(heat_plf_fplr)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{coil_heating_dx_variable_speed.name}, cannot find heat_plf_fplr curve, will not be set.")
    successfully_set_all_properties = false
  end

  # Make the heat_defrost_eir_ft
  heat_defrost_eir_ft = model_add_curve(coil_heating_dx_variable_speed.model, props['heat_defrost_eir_ft'])
  if heat_defrost_eir_ft
    coil_heating_dx_variable_speed.setDefrostEnergyInputRatioFunctionofTemperatureCurve(heat_defrost_eir_ft)
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{coil_heating_dx_variable_speed.name}, cannot find heat_defrost_eir_ft curve, will not be set")
    successfully_set_all_properties = false
  end

end

#coil_heating_dx_variable_speed_find_capacity(coil_heating_dx_variable_speed) ⇒ Object

Find heating capacity for “CoilHeatingDXVariableSpeed” object



3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3036

def coil_heating_dx_variable_speed_find_capacity(coil_heating_dx_variable_speed)
  capacity_w = nil
  if coil_heating_dx_variable_speed.ratedHeatingCapacityAtSelectedNominalSpeedLevel.is_initialized
    capacity_w = coil_heating_dx_variable_speed.ratedHeatingCapacityAtSelectedNominalSpeedLevel.get
  elsif coil_heating_dx_variable_speed.autosizedRatedHeatingCapacityAtSelectedNominalSpeedLevel.is_initialized
    capacity_w = coil_heating_dx_variable_speed.autosizedRatedHeatingCapacityAtSelectedNominalSpeedLevel.get
  else
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingDXVariableSpeed', "For #{coil_heating_dx_variable_speed.name} capacity is not available.")
    return 0.0
  end

  return capacity_w
end

#create_air_sys_clg_eqpt(model, clg_eqpt_type) ⇒ Object

create air system cooling equipment



712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 712

def create_air_sys_clg_eqpt(model, clg_eqpt_type)
  clg_eqpt = nil
  case clg_eqpt_type.downcase
  when 'ashp'
    clg_eqpt = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(model)
    clg_eqpt.setName('CoilCoolingDxSingleSpeed_ASHP')
    clg_eqpt.setCrankcaseHeaterCapacity(1.0e-6)
  when 'ccashp'
    clg_eqpt = OpenStudio::Model::CoilCoolingDXVariableSpeed.new(model)
    clg_eqpt.setName('CoilCoolingDXVariableSpeed_CCASHP')
    clg_eqpt_speed1 = OpenStudio::Model::CoilCoolingDXVariableSpeedSpeedData.new(model)
    clg_eqpt.addSpeed(clg_eqpt_speed1)
    clg_eqpt.setNominalSpeedLevel(1)
    clg_eqpt.setCrankcaseHeaterCapacity(1.0e-6)
  when 'coil_chw'
    clg_eqpt = OpenStudio::Model::CoilCoolingWater.new(model)
    clg_eqpt.setName('CoilCoolingWater')
  when 'vrf'
    clg_eqpt = OpenStudio::Model::CoilCoolingDXVariableRefrigerantFlow.new(model)
    clg_eqpt.setName('CoilCoolingDXVariableRefrigerantFlow')
  end

  return clg_eqpt
end

#create_air_sys_fan(model, fan_type) ⇒ Object

create air system fan



693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 693

def create_air_sys_fan(model, fan_type)
  fan = nil
  case fan_type.downcase
  when 'constant_volume'
    fan = OpenStudio::Model::FanConstantVolume.new(model)
    fan.setName('FanConstantVolume')
  when 'variable_volume'
    fan = OpenStudio::Model::FanVariableVolume.new(model)
    fan.setName('FanVariableVolume')
  when 'on_off'
    fan = OpenStudio::Model::FanOnOff.new(model)
    fan.setName('FanOnOff')
  end

  return fan
end

#create_air_sys_htg_eqpt(model, htg_eqpt_type) ⇒ Object

create air system heating equipment



739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 739

def create_air_sys_htg_eqpt(model, htg_eqpt_type)
  always_on = model.alwaysOnDiscreteSchedule
  htg_eqpt = nil
  case htg_eqpt_type.downcase
  when 'coil_electric'
    htg_eqpt = OpenStudio::Model::CoilHeatingElectric.new(model, always_on)
    htg_eqpt.setName('CoilHeatingElectric')
  when 'coil_gas'
    htg_eqpt = OpenStudio::Model::CoilHeatingGas.new(model, always_on)
    htg_eqpt.setName('CoilHeatingGas')
  when 'ashp'
    htg_eqpt = OpenStudio::Model::CoilHeatingDXSingleSpeed.new(model)
    htg_eqpt.setName('CoilHeatingDXSingleSpeed_ASHP')
    htg_eqpt.setDefrostStrategy('ReverseCycle')
    htg_eqpt.setDefrostControl('OnDemand')
    htg_eqpt.setCrankcaseHeaterCapacity(1.0e-6)
  when 'ccashp'
    htg_eqpt = OpenStudio::Model::CoilHeatingDXVariableSpeed.new(model)
    htg_eqpt.setName('CoilHeatingDXVariableSpeed_CCASHP')
    htg_eqpt_speed1 = OpenStudio::Model::CoilHeatingDXVariableSpeedSpeedData.new(model)
    htg_eqpt.addSpeed(htg_eqpt_speed1)
    htg_eqpt.setNominalSpeedLevel(1)
    htg_eqpt.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(-25.0)
    htg_eqpt.setDefrostStrategy('ReverseCycle')
    htg_eqpt.setDefrostControl('OnDemand')
    htg_eqpt.setCrankcaseHeaterCapacity(1.0e-6)
  when 'coil_hw'
    htg_eqpt = OpenStudio::Model::CoilHeatingWater.new(model)
    htg_eqpt.setName('CoilHeatingWater')
  end

  return htg_eqpt
end

#create_air_sys_spm(model, setpoint_mgr_type, zones) ⇒ Object

create air system setpoint manager



667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 667

def create_air_sys_spm(model,
                       setpoint_mgr_type,
                       zones)
  spm = nil
  case setpoint_mgr_type.downcase
  when 'scheduled'
    sat = 20.0
    sat_sch = OpenStudio::Model::ScheduleRuleset.new(model)
    sat_sch.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), sat)
    spm = OpenStudio::Model::SetpointManagerScheduled.new(model, sat_sch)
  when 'single_zone_reheat'
    spm = OpenStudio::Model::SetpointManagerSingleZoneReheat.new(model)
    spm.setControlZone(zones[0])
    spm.setMinimumSupplyAirTemperature(13.0)
    spm.setMaximumSupplyAirTemperature(43.0)
  when 'warmest'
    spm = OpenStudio::Model::SetpointManagerWarmest.new(model)
    spm.setMinimumSetpointTemperature(13.0)
    spm.setMaximumSetpointTemperature(22.0)
  end

  return spm
end

#create_airloop(model, sys_vent_type) ⇒ Object

create air loop



628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 628

def create_airloop(model, sys_vent_type)
  airloop = OpenStudio::Model::AirLoopHVAC.new(model)
  airloop.sizingSystem.setPreheatDesignTemperature(7.0)
  airloop.sizingSystem.setPreheatDesignHumidityRatio(0.008)
  airloop.sizingSystem.setPrecoolDesignTemperature(13.0)
  airloop.sizingSystem.setPrecoolDesignHumidityRatio(0.008)
  airloop.sizingSystem.setSizingOption('NonCoincident')
  airloop.sizingSystem.setCoolingDesignAirFlowMethod('DesignDay')
  airloop.sizingSystem.setCoolingDesignAirFlowRate(0.0)
  airloop.sizingSystem.setHeatingDesignAirFlowMethod('DesignDay')
  airloop.sizingSystem.setHeatingDesignAirFlowRate(0.0)
  airloop.sizingSystem.setSystemOutdoorAirMethod('ZoneSum')
  airloop.sizingSystem.setCentralCoolingDesignSupplyAirHumidityRatio(0.0085)
  airloop.sizingSystem.setCentralHeatingDesignSupplyAirHumidityRatio(0.0080)
  if model.version < OpenStudio::VersionString.new('2.7.0')
    airloop.sizingSystem.setMinimumSystemAirFlowRatio(1.0)
  else
    airloop.sizingSystem.setCentralHeatingMaximumSystemAirFlowRatio(1.0)
  end
  case sys_vent_type.downcase
  when 'doas'
    airloop.sizingSystem.setAllOutdoorAirinCooling(true)
    airloop.sizingSystem.setAllOutdoorAirinHeating(true)
    airloop.sizingSystem.setTypeofLoadtoSizeOn('VentilationRequirement')
    airloop.sizingSystem.setCentralCoolingDesignSupplyAirTemperature(13.0)
    airloop.sizingSystem.setCentralHeatingDesignSupplyAirTemperature(22.0)
  when 'mixed'
    airloop.sizingSystem.setAllOutdoorAirinCooling(false)
    airloop.sizingSystem.setAllOutdoorAirinHeating(false)
    airloop.sizingSystem.setTypeofLoadtoSizeOn('Sensible')
    airloop.sizingSystem.setCentralCoolingDesignSupplyAirTemperature(13.0)
    airloop.sizingSystem.setCentralHeatingDesignSupplyAirTemperature(43.0)
  end

  return airloop
end

#create_plantloop_clg_eqpt(model, loop_clg_eqpt_type) ⇒ Object

add plant loop cooling eqpt



1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1060

def create_plantloop_clg_eqpt(model, loop_clg_eqpt_type)

  clg_eqpt = nil
  case loop_clg_eqpt_type.downcase
  when "chiller_electric_eir"
    clg_eqpt = OpenStudio::Model::ChillerElectricEIR.new(model)
    clg_eqpt.setName("ChillerElectricEIR")
  when "district_cooling"
    clg_eqpt = OpenStudio::Model::DistrictCooling.new(model)
    clg_eqpt.setName("DistrictCooling")
  when "heatpump_watertowater_equationfit"
    clg_eqpt = OpenStudio::Model::HeatPumpWaterToWaterEquationFitCooling.new(model)
    clg_eqpt.setName("HeatPumpWaterToWaterEquationFitCooling")
  end

  return clg_eqpt

end

#create_plantloop_heat_rej_eqpt(model, loop_heat_rej_eqpt_type) ⇒ Object

add plant loop heat rejection equipment



1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1101

def create_plantloop_heat_rej_eqpt(model, loop_heat_rej_eqpt_type)

  heat_rej_eqpt = nil
  case loop_heat_rej_eqpt_type.downcase
  when "tower_single_speed"
    heat_rej_eqpt = OpenStudio::Model::CoolingTowerSingleSpeed.new(model)
    heat_rej_eqpt.setName("CoolingTowerSingleSpeed")
  when "vertical_ground_hx"
    heat_rej_eqpt = OpenStudio::Model::GroundHeatExchangerVertical.new(model)
    heat_rej_eqpt.setName("GroundHeatExchangerVertical")
  when "district_heating"
    if model.version < OpenStudio::VersionString.new('3.7.0')
      heat_rej_eqpt = OpenStudio::Model::DistrictHeating.new(model)
    else
      heat_rej_eqpt = OpenStudio::Model::DistrictHeatingWater.new(model)
    end
    heat_rej_eqpt.setName("DistrictHeating")
  when "district_cooling"
    heat_rej_eqpt = OpenStudio::Model::DistrictCooling.new(model)
    heat_rej_eqpt.setName("DistrictCooling")
  end

  return heat_rej_eqpt
end

#create_plantloop_htg_eqpt(model, loop_htg_eqpt_type) ⇒ Object

add plant loop heating eqpt created by: [email protected] (August 2021)



1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1038

def create_plantloop_htg_eqpt(model, loop_htg_eqpt_type)

  htg_eqpt = nil
  case loop_htg_eqpt_type.downcase
  when "district_heating"
    if model.version < OpenStudio::VersionString.new('3.7.0')
      htg_eqpt = OpenStudio::Model::DistrictHeating.new(model)
    else
      htg_eqpt = OpenStudio::Model::DistrictHeatingWater.new(model)
    end
    htg_eqpt.setName("DistrictHeating")

  when "heatpump_watertowater_equationfit"
    htg_eqpt = OpenStudio::Model::HeatPumpWaterToWaterEquationFitHeating.new(model)
    htg_eqpt.setName("HeatPumpWaterToWaterEquationFitHeating")
  end

  return htg_eqpt
end

#create_plantloop_pump(model, loop_pump_type) ⇒ Object

add plant loop pump



1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1020

def create_plantloop_pump(model, loop_pump_type)

  pump = nil
  case loop_pump_type.downcase
  when "constant_speed"
    pump = OpenStudio::Model::PumpConstantSpeed.new(model)
    pump.setName("PumpConstantSpeed")
  when "variable_speed"
    pump = OpenStudio::Model::PumpVariableSpeed.new(model)
    pump.setName("PumpVariableSpeed")
  end

  return pump
end

#create_plantloop_spm(model, loop_spm_type, loop_setpoint) ⇒ Object

add plant loop setpoint manager



1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1081

def create_plantloop_spm( model, loop_spm_type, loop_setpoint)

  spm = nil
  case loop_spm_type.downcase
  when "scheduled"
    sch = OpenStudio::Model::ScheduleConstant.new(model)
    sch.setValue(loop_setpoint)
    spm = OpenStudio::Model::SetpointManagerScheduled.new(model,sch)
    spm.setName("SetpointManagerScheduled")
  when "followgroundtemperature"
    spm = OpenStudio::Model::SetpointManagerFollowGroundTemperature.new(model)
    spm.setReferenceGroundTemperatureObjectType("Site:GroundTemperature:Deep")
    spm.setMinimumSetpointTemperature(0.0)
  end

  return spm
end

#create_zone_clg_eqpt(model, zone_clg_eqpt_type) ⇒ Object

create zonal cooling equipment



884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 884

def create_zone_clg_eqpt(model, zone_clg_eqpt_type)
  always_on = model.alwaysOnDiscreteSchedule
  clg_eqpt = nil
  case zone_clg_eqpt_type.downcase
  when 'fancoil_4pipe'
    clg_eqpt = OpenStudio::Model::CoilCoolingWater.new(model)
    clg_eqpt.setName('CoilCoolingWater_FanCoil')
  when 'ptac_electric_off', 'pthp'
    clg_eqpt = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(model)
    clg_eqpt.setName('CoilCoolingDXSingleSpeed_PTHP') if zone_clg_eqpt_type.downcase == 'pthp'
    clg_eqpt.setName('CoilCoolingDXSingleSpeed_PTAC') if zone_clg_eqpt_type.downcase == 'ptac_electric_off'
    clg_eqpt.setCrankcaseHeaterCapacity(1.0e-6)
  when 'vrf'
    clg_eqpt = OpenStudio::Model::CoilCoolingDXVariableRefrigerantFlow.new(model)
    clg_eqpt.setName('CoilCoolingDXVariableRefrigerantFlow')
  end

  return clg_eqpt
end

#create_zone_container_eqpt(model:, zone_cont_eqpt_type:, zone_htg_eqpt:, zone_supp_htg_eqpt:, zone_clg_eqpt:, zone_fan:, zone_vent_off: true) ⇒ Object

create zpne container eqpt



906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 906

def create_zone_container_eqpt(model:,
                               zone_cont_eqpt_type:,
                               zone_htg_eqpt:,
                               zone_supp_htg_eqpt:,
                               zone_clg_eqpt:,
                               zone_fan:,
                               zone_vent_off: true)

  always_on = model.alwaysOnDiscreteSchedule
  always_off = model.alwaysOffDiscreteSchedule
  zone_eqpt = nil
  case zone_cont_eqpt_type.downcase
  when 'fancoil_4pipe'
    zone_eqpt = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new(model, always_on, zone_fan, zone_clg_eqpt, zone_htg_eqpt)
    zone_eqpt.setName('ZoneHVACFourPipeFanCoil')
    zone_eqpt.setSupplyAirFanOperatingModeSchedule(always_off)
    zone_eqpt.setMaximumOutdoorAirFlowRate(1.0e-6)
  when 'ptac_electric_off'
    zone_eqpt = OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner.new(model, always_on, zone_fan, zone_htg_eqpt, zone_clg_eqpt)
    zone_eqpt.setName('ZoneHVACPackagedTerminalAirConditioner')
    zone_eqpt.setSupplyAirFanOperatingModeSchedule(always_off)
    if zone_vent_off
      zone_eqpt.setOutdoorAirFlowRateDuringCoolingOperation(1.0e-6)
      zone_eqpt.setOutdoorAirFlowRateDuringHeatingOperation(1.0e-6)
      zone_eqpt.setOutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded(1.0e-6)
    end
  when 'pthp'
    zone_eqpt = OpenStudio::Model::ZoneHVACPackagedTerminalHeatPump.new(model, always_on, zone_fan, zone_htg_eqpt, zone_clg_eqpt, zone_supp_htg_eqpt)
    zone_eqpt.setName('ZoneHVACPackagedTerminalHeatPump')
    if zone_vent_off
      zone_eqpt.setOutdoorAirFlowRateDuringCoolingOperation(1.0e-6)
      zone_eqpt.setOutdoorAirFlowRateDuringHeatingOperation(1.0e-6)
      zone_eqpt.setOutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded(1.0e-6)
      zone_eqpt.setSupplyAirFanOperatingModeSchedule(always_off)
    end
  when 'unitheater_electric'
    zone_eqpt = OpenStudio::Model::ZoneHVACUnitHeater.new(model, always_on, zone_fan, zone_htg_eqpt)
    zone_eqpt.setName('ZoneHVACUnitHeater')
    zone_eqpt.setFanControlType('OnOff')
  when 'vrf'
    zone_eqpt = OpenStudio::Model::ZoneHVACTerminalUnitVariableRefrigerantFlow.new(model, zone_clg_eqpt, zone_htg_eqpt, zone_fan)
    zone_eqpt.setName('ZoneHVACTerminalUnitVariableRefrigerantFlow')
    zone_eqpt.setSupplyAirFanOperatingModeSchedule(always_off)
    if zone_vent_off
      zone_eqpt.setOutdoorAirFlowRateDuringCoolingOperation(1.0e-6)
      zone_eqpt.setOutdoorAirFlowRateDuringHeatingOperation(1.0e-6)
      zone_eqpt.setOutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded(1.0e-6)
      zone_eqpt.setZoneTerminalUnitOffParasiticElectricEnergyUse(1.0e-6)
      zone_eqpt.setZoneTerminalUnitOnParasiticElectricEnergyUse(1.0e-6)
    end
  end

  return zone_eqpt
end

#create_zone_diffuser(model, zone_diffuser_type, zone) ⇒ Object

create zone diffuser



828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 828

def create_zone_diffuser(model, zone_diffuser_type, zone)
  always_on = model.alwaysOnDiscreteSchedule
  diffuser = nil
  case zone_diffuser_type.downcase
  when 'single_duct_uncontrolled'
    diffuser = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, always_on)
  when 'single_duct_vav_reheat'
    reheat_coil = OpenStudio::Model::CoilHeatingElectric.new(model, always_on)
    diffuser = OpenStudio::Model::AirTerminalSingleDuctVAVReheat.new(model, always_on, reheat_coil)
    # diffuser.setFixedMinimumAirFlowRate(0.002 * zone.floorArea )
    diffuser.setMaximumReheatAirTemperature(43.0)
    diffuser.setDamperHeatingAction('Normal')
  end

  return diffuser
end

#create_zone_htg_eqpt(model, zone_htg_eqpt_type, hw_loop) ⇒ Object

create zonal heating equipment



847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 847

def create_zone_htg_eqpt(model, zone_htg_eqpt_type, hw_loop)
  always_on = model.alwaysOnDiscreteSchedule
  always_off = model.alwaysOffDiscreteSchedule
  htg_eqpt = nil
  case zone_htg_eqpt_type.downcase
  when 'baseboard_electric'
    htg_eqpt = OpenStudio::Model::ZoneHVACBaseboardConvectiveElectric.new(model)
    htg_eqpt.setName('ZoneHVACBaseboardConvectiveElectric')
  when 'baseboard_hotwater'
    htg_coil = OpenStudio::Model::CoilHeatingWaterBaseboard.new(model)
    htg_coil.setName("CoilHeatingWaterBaseboard")
    hw_loop.addDemandBranchForComponent(htg_coil)
    htg_eqpt = OpenStudio::Model::ZoneHVACBaseboardConvectiveWater.new(model, model.alwaysOnDiscreteSchedule, htg_coil)
    htg_eqpt.setName('ZoneHVACBaseboardConvectiveWater')
  when 'coil_electric', 'ptac_electric_off', 'unitheater_electric'
    htg_eqpt = OpenStudio::Model::CoilHeatingElectric.new(model, always_on)
    htg_eqpt.setName('CoilHeatingElectric')
    htg_eqpt.setAvailabilitySchedule(always_off) if zone_htg_eqpt_type == 'ptac_electric_off'
  when 'fancoil_4pipe'
    htg_eqpt = OpenStudio::Model::CoilHeatingWater.new(model)
    htg_eqpt.setName('CoilHeatingWater_FanCoil')
  when 'pthp'
    htg_eqpt = OpenStudio::Model::CoilHeatingDXSingleSpeed.new(model)
    htg_eqpt.setName('CoilHeatingDXSingleSpeed_PTHP')
    htg_eqpt.setDefrostStrategy('ReverseCycle')
    htg_eqpt.setDefrostControl('OnDemand')
    htg_eqpt.setCrankcaseHeaterCapacity(1.0e-6)
  when 'vrf'
    htg_eqpt = OpenStudio::Model::CoilHeatingDXVariableRefrigerantFlow.new(model)
    htg_eqpt.setName('CoilHeatingDXVariableRefrigerantFlow')
  end

  return htg_eqpt
end

#find_chiller_set(chiller_type:, ref_capacity_w:) ⇒ Object



3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3560

def find_chiller_set(chiller_type:, ref_capacity_w:)
  if chiller_type.is_a?(String)
    ##### Find the chiller that has the required capacity
    search_criteria = {}
    search_criteria['name'] = chiller_type
    capacity_w = ref_capacity_w
    chiller_packages = model_find_object(@standards_data['tables']['chiller_eff_ecm'], search_criteria, capacity_w)
    chiller_name = chiller_packages['notes']
    ecm_name = chiller_name
    chiller_set = {
      'notes' => ecm_name,
      'capacity_w' => chiller_packages['capacity_w'],
      'cop_w_by_w' => chiller_packages['cop_w_by_w'],
      'ref_leaving_chilled_water_temp_c' => chiller_packages['ref_leaving_chilled_water_temp_c'],
      'ref_entering_condenser_fluid_temp_c' => chiller_packages['ref_entering_condenser_fluid_temp_c'],
      'ref_chilled_water_flow_rate_m3_s' => chiller_packages['ref_chilled_water_flow_rate_m3_s'],
      'ref_condenser_fluid_flow_rate_m3_s' => chiller_packages['ref_condenser_fluid_flow_rate_m3_s'],
      'capft_curve' => chiller_packages['capft_curve'],
      'eirft_curve' => chiller_packages['eirft_curve'],
      'eirfplr_curve' => chiller_packages['eirfplr_curve'],
      'min_part_load_ratio' => chiller_packages['min_part_load_ratio'],
      'max_part_load_ratio' => chiller_packages['max_part_load_ratio'],
      'opt_part_load_ratio' => chiller_packages['opt_part_load_ratio'],
      'min_unloading_ratio' => chiller_packages['min_unloading_ratio'],
      'condenser_type' => chiller_packages['condenser_type'],
      'fraction_of_compressor_electric_consumption_rejected_by_condenser' => chiller_packages['fraction_of_compressor_electric_consumption_rejected_by_condenser'],
      'leaving_chilled_water_lower_temperature_limit_c' => chiller_packages['leaving_chilled_water_lower_temperature_limit_c'],
      'chiller_flow_mode' => chiller_packages['chiller_flow_mode'],
      'design_heat_recovery_water_flow_rate_m3_s' => chiller_packages['design_heat_recovery_water_flow_rate_m3_s']
    }
    chiller_min_cap = chiller_packages['minimum_capacity']
    chiller_max_cap = chiller_packages['maximum_capacity']
  end
  return chiller_set, chiller_min_cap, chiller_max_cap
end

#get_hvac_comp_init_name(obj, htg_flag) ⇒ Object

Name of HVAC component might have been updated by standards methods for setting efficiency. Here original name of the component is restored.



1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1618

def get_hvac_comp_init_name(obj, htg_flag)
  return obj.name.to_s if obj.name.to_s.split.size <= 2

  init_name = obj.name.to_s.split[0]
  range = obj.name.to_s.split.size - 3
  range = obj.name.to_s.split.size - 5 if htg_flag
  for i in 1..range
    init_name += " #{obj.name.to_s.split[i]}"
  end
  return init_name
end

#get_lowest_floor_ext_wall_centroid_coords(storeys_clg_zcoords) ⇒ Object

Return x,y,z coordinates of exterior wall with largest area on the lowest floor



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 138

def get_lowest_floor_ext_wall_centroid_coords(storeys_clg_zcoords)
  ext_wall = nil
  ext_wall_x = nil
  ext_wall_y = nil
  ext_wall_z = nil
  storeys_clg_zcoords.keys.each do |storey|
    max_area = 0.0
    sorted_spaces = storey.spaces.sort_by { |space| space.name.to_s }
    sorted_spaces.each do |space|
      ext_walls = space.surfaces.select { |surf| (surf.surfaceType.to_s.upcase == 'WALL') && (surf.outsideBoundaryCondition.to_s.upcase == 'OUTDOORS') }
      ext_walls = ext_walls.sort_by { |wall| wall.grossArea.to_f }
      if !ext_walls.empty?
        if ext_walls.last.grossArea.to_f > max_area
          max_area = ext_walls.last.grossArea.to_f
          ext_wall_x = ext_walls.last.centroid.x.to_f + space.xOrigin.to_f
          ext_wall_y = ext_walls.last.centroid.y.to_f + space.yOrigin.to_f
          ext_wall_z = ext_walls.last.centroid.z.to_f + space.zOrigin.to_f
          ext_wall = ext_walls.last
        end
      end
    end
    break unless !ext_wall
  end
  if !ext_wall
    OpenStudio.logFree(OpenStudio::Info, 'openstudiostandards.get_lowest_floor_ext_wall_centroid_coords', 'Did not find an exteior wall in the building!')
  end

  return ext_wall_x, ext_wall_y, ext_wall_z
end

#get_map_systems_to_zones(systems) ⇒ Object

Return map of systems to zones and set flag for dedicated outdoor air unit for each system



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 67

def get_map_systems_to_zones(systems)
  map_systems_to_zones = {}
  system_doas_flags = {}
  systems.each do |system|
    zones = system.thermalZones
    map_systems_to_zones[system.name.to_s] = zones
    if system.sizingSystem.typeofLoadtoSizeOn.to_s == 'VentilationRequirement'
      system_doas_flags[system.name.to_s] = true
    else
      system_doas_flags[system.name.to_s] = false
    end
  end
  return map_systems_to_zones, system_doas_flags
end

#get_max_vrf_pipe_lengths(model) ⇒ Object

Determine maximum equivalent and net vertical pipe runs for VRF model



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 220

def get_max_vrf_pipe_lengths(model)
  # Get and sort floors average ceilings z-coordinates hash
  storeys_clg_zcoords = get_storey_avg_clg_zcoords(model)
  storeys_clg_zcoords = storeys_clg_zcoords.sort_by { |key, value| value[1] }.to_h # sort storeys hash based on ceiling/roof z-coordinate
  if storeys_clg_zcoords.values.last[0]
    # If the top floor is conditioned, then assume the top floor is not an attic floor and place the VRF outdoor unit at the roof centroid
    location_cent_x, location_cent_y, location_cent_z = get_roof_centroid_coords(storeys_clg_zcoords.keys.last)
  else
    # If the top floor is not conditioned, then assume it's an attic floor. In this case place the VRF outdoor unit next to the centroid
    # of the exterior wall with the largest area on the lowest floor.
    location_cent_x, location_cent_y, location_cent_z = get_lowest_floor_ext_wall_centroid_coords(storeys_clg_zcoords)
  end
  # Initialize distances
  max_equiv_distance = 0.0
  max_vert_distance = 0.0
  min_vert_distance = 0.0
  storeys_clg_zcoords.keys.each do |storey|
    next unless storeys_clg_zcoords[storey][0]

    storey.spaces.each do |space|
      # Is there a VRF terminal unit in the space/zone?
      vrf_term_units = []
      if space.thermalZone.is_initialized
        vrf_term_units = space.thermalZone.get.equipment.select { |eqpt| eqpt.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.is_initialized }
      end
      next if vrf_term_units.empty?

      space_centroid_x, space_centroid_y, space_centroid_z = get_space_centroid_coords(space)
      # Update max horizontal and vertical distances if needed
      equiv_distance = (location_cent_x.to_f - space_centroid_x.to_f).abs +
                       (location_cent_y.to_f - space_centroid_y.to_f).abs +
                       (location_cent_z.to_f - space_centroid_z.to_f).abs
      if equiv_distance > max_equiv_distance then max_equiv_distance = equiv_distance end
      pos_vert_distance = [space_centroid_z.to_f - location_cent_z.to_f, 0.0].max
      if pos_vert_distance > max_vert_distance then max_vert_distance = pos_vert_distance end
      neg_vert_distance = [space_centroid_z.to_f - location_cent_z.to_f, 0.0].min
      if neg_vert_distance < min_vert_distance then min_vert_distance = neg_vert_distance end
    end
  end
  max_net_vert_distance = max_vert_distance + min_vert_distance

  return max_equiv_distance, max_net_vert_distance
end

#get_roof_centroid_coords(storey) ⇒ Object

Return x,y,z coordinates of the centroid of the roof of the storey



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 190

def get_roof_centroid_coords(storey)
  sum_x = 0.0
  sum_y = 0.0
  sum_z = 0.0
  total_area = 0.0
  cent_x = nil
  cent_y = nil
  cent_z = nil
  storey.spaces.each do |space|
    roof_surfaces = space.surfaces.select { |surf| (surf.surfaceType.to_s.upcase == 'ROOFCEILING') && (surf.outsideBoundaryCondition.to_s.upcase == 'OUTDOORS') }
    roof_surfaces.each do |surf|
      sum_x += (surf.centroid.x.to_f + space.xOrigin.to_f) * surf.grossArea.to_f
      sum_y += (surf.centroid.y.to_f + space.yOrigin.to_f) * surf.grossArea.to_f
      sum_z += (surf.centroid.z.to_f + space.zOrigin.to_f) * surf.grossArea.to_f
      total_area += surf.grossArea.to_f
    end
  end
  if total_area > 0.0
    cent_x = sum_x / total_area
    cent_y = sum_y / total_area
    cent_z = sum_z / total_area
  else
    OpenStudio.logFree(OpenStudio::Info, 'openstudiostandards.get_roof_centroid_coords', 'Did not find a roof on the top floor!')
  end

  return cent_x, cent_y, cent_z
end

#get_space_centroid_coords(space) ⇒ Object

Return x,y,z coordinates of space centroid



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 170

def get_space_centroid_coords(space)
  total_area = 0.0
  sum_x = 0.0
  sum_y = 0.0
  sum_z = 0.0
  space.surfaces.each do |surf|
    total_area += surf.grossArea.to_f
    sum_x += (surf.centroid.x.to_f + space.xOrigin.to_f) * surf.grossArea.to_f
    sum_y += (surf.centroid.y.to_f + space.yOrigin.to_f) * surf.grossArea.to_f
    sum_z += (surf.centroid.z.to_f + space.zOrigin.to_f) * surf.grossArea.to_f
  end
  space_centroid_x = sum_x / total_area
  space_centroid_y = sum_y / total_area
  space_centroid_z = sum_z / total_area

  return space_centroid_x, space_centroid_y, space_centroid_z
end

#get_storey_avg_clg_zcoords(model) ⇒ Object

Return hash of flags for whether storey is conditioned and average ceiling z-coordinates of building storeys.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 99

def get_storey_avg_clg_zcoords(model)
  storey_avg_clg_zcoords = {}
  model.getBuildingStorys.each do |storey|
    storey_avg_clg_zcoords[storey] = []
    storey_cond = false
    total_area = 0.0
    sum = 0.0
    raise("get_storey_avg_clg_zcoords: storey #{storey.name} has no spaces associated with it. Either delete the storey or " \
          "assign spaces to it") if storey.spaces.empty?
    storey.spaces.each do |space|
      # Determine if any of the spaces/zones of the storey are conditioned? If yes then the floor is considered to be conditioned
      if space.thermalZone.is_initialized
        zone = space.thermalZone.get
        if zone.thermostat.is_initialized
          if zone.thermostat.get.to_ThermostatSetpointDualSetpoint.is_initialized
            if zone.thermostat.get.to_ThermostatSetpointDualSetpoint.get.heatingSetpointTemperatureSchedule.is_initialized ||
               zone.thermostat.get.to_ThermostatSetpointDualSetpoint.get.coolingSetpointTemperatureSchedule.is_initialized
              storey_cond = true
            end
          end
        end
      end
      # Find average height of z-coordinates of ceiling/roof of floor
      space.surfaces.each do |surf|
        if surf.surfaceType.to_s.upcase == 'ROOFCEILING'
          sum += (surf.centroid.z.to_f + space.zOrigin.to_f) * surf.grossArea.to_f
          total_area += surf.grossArea.to_f
        end
      end
    end
    storey_avg_clg_zcoords[storey] << storey_cond
    storey_avg_clg_zcoords[storey] << (sum / total_area)
  end

  return storey_avg_clg_zcoords
end

#get_storey_zones_map(system_zones_map) ⇒ Object

Get a map of bldg storeys and zones



435
436
437
438
439
440
441
442
443
444
445
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 435

def get_storey_zones_map(system_zones_map)
  storey_zones_map = {}
  system_zones_map.each do |sys,zones|
    zones.each do |zone|
      storey = get_zone_storey(zone)
      storey_zones_map[storey.name.to_s] = [] if !storey_zones_map.has_key? storey.name.to_s
      storey_zones_map[storey.name.to_s] << zone
    end
  end
  return storey_zones_map
end

#get_zone_clg_eqpt_type(model) ⇒ Object

Return hash of zone and cooling equipment type in the zone



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 84

def get_zone_clg_eqpt_type(model)
  zone_clg_eqpt_type = {}
  model.getThermalZones.each do |zone|
    zone.equipment.each do |eqpt|
      if eqpt.to_ZoneHVACPackagedTerminalAirConditioner.is_initialized
        zone_clg_eqpt_type[zone.name.to_s] = 'ZoneHVACPackagedTerminalAirConditioner'
        break
      end
    end
  end
  return zone_clg_eqpt_type
end

#get_zone_storey(zone) ⇒ Object

Get building storey for a zone



419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 419

def get_zone_storey(zone)
  zone_storey = nil
  zone.model.getBuildingStorys.each do |storey|
    storey.spaces.each do |space|
      if space.thermalZone.get.name.to_s == zone.name.to_s
        zone_storey = storey
        break
      end
    end
    break if !zone_storey.nil?
  end
  return zone_storey
end

#load_standards_database_newObject

Combine the data from the JSON files into a single hash Load JSON files differently depending on whether loading from the OpenStudio CLI embedded filesystem or from typical gem installation



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/openstudio-standards/standards/necb/ECMS/ecms.rb', line 8

def load_standards_database_new
  @standards_data = {}
  @standards_data['tables'] = {}

  if __dir__[0] == ':' # Running from OpenStudio CLI
    embedded_files_relative('data/', /.*\.json/).each do |file|
      data = JSON.parse(EmbeddedScripting.getFileAsString(file))
      if !data['tables'].nil? && data['tables'].first['data_type'] == 'table'
        @standards_data['tables'] << data['tables'].first
      else
        @standards_data[data.keys.first] = data[data.keys.first]
      end
    end
  else
    files = Dir.glob("#{File.dirname(__FILE__)}/data/*.json").select { |e| File.file? e }
    files.each do |file|
      data = JSON.parse(File.read(file))
      if !data['tables'].nil?
        @standards_data['tables'] = [*@standards_data['tables'], *data['tables']].to_h
      else
        @standards_data[data.keys.first] = data[data.keys.first]
      end
    end
  end

  return @standards_data
end

#modify_boiler_efficiency(model:, boiler_eff: nil) ⇒ Object

Apply boiler efficiency This model takes an OS model and a boiler efficiency string or hash sent to it with the following form:

"boiler_eff": {
    "name" => "NECB 88% Efficient Condensing Boiler",
    "efficiency" => 0.88,
    "part_load_curve" => "BOILER-EFFPLR-COND-NECB2011",
    "notes" => "From NECB 2011."
}

If boiler_eff is nill then it does nothing. If both “efficiency” and “part_load_curve” are nil then it does nothing. If a boiler_eff is passed as a string and not a hash then it looks for a “name” field in the boiler_set.json file that matches boiler_eff and gets the associated boiler performance details from the file. If an efficiency is set but is not between 0.01 and 1.0 it returns an error. Otherwise, it looks for plant loop supply components that match the “OS_BoilerHotWater” type. If it finds one it then calls the “reset_boiler_efficiency method which resets the the boiler efficiency and looks for the part load efficiency curve in the curves.json file. If it finds a curve it sets the part load curve to that, otherwise it returns an error. It also renames the boiler to include the ”boiler_eff“.



3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3118

def modify_boiler_efficiency(model:, boiler_eff: nil)
  return if boiler_eff.nil?

  # If boiler_eff is a string rather than a hash then assume it is the name of a boiler efficiency package and look
  # for a package with that name in boiler_set.json.
  if boiler_eff.is_a?(String)
    eff_packages = @standards_data['tables']['boiler_eff_ecm']['table']
    eff_package = eff_packages.select { |eff_pack_info| eff_pack_info['name'] == boiler_eff }

    raise "Cannot not find #{boiler_eff} in the ECMS boiler_set.json file.  Please check that the name is correctly spelled in the ECMS class boiler_set.json and in the code calling (directly or through another method) the ECMS class modify_boiler_efficiency method." if eff_package.empty?
    raise "More than one boiler efficiency package with the name #{boiler_eff} was found.  Please check the ECMS class boiler_set.json file and make sure that each boiler efficiency package has a unique name." if eff_package.size > 1

    ecm_name = boiler_eff
    boiler_eff = {
      'name' => ecm_name,
      'efficiency' => eff_package[0]['efficiency'],
      'part_load_curve' => eff_package[0]['part_load_curve']
    }
  end
  # If nothing is passed in the boiler_eff hash then assume this was not supposed to be used and return without doing
  # anything.
  return if boiler_eff['name'].nil? && boiler_eff['efficiency'].nil? && boiler_eff['part_load_curve'].nil?
  # If no efficiency or partload curve are found (either passed directly or via the boiler_set.json file) then assume
  # that the current SHW setting should not be changed.  Return without changing anything.
  return if boiler_eff['efficiency'].nil? && boiler_eff['part_load_curve'].nil?
  raise 'You attempted to set the efficiency of boilers in this model to nil. Please check the ECMS class boiler_set.json and make sure the efficiency is properly set' if boiler_eff['efficiency'].nil?
  raise "You attempted to set the efficiency of boilers in this model to: #{boiler_eff['efficiency']}. Please check the ECMS class boiler_set.json and make sure the efficiency you set is between 0.01 and 1.0." if boiler_eff['efficiency'] < 0.01 || boiler_eff['efficiency'] > 1.0
  raise 'You attempted to set the part load curve of boilers in this model to nil.  Please check the ECMS class boiler_set.json file and ensure that both the efficiency and part load curve are set.' if boiler_eff['part_load_curve'].nil?

  model.getBoilerHotWaters.sort.each do |mod_boiler|
    if mod_boiler.fuelType.to_s.downcase == 'electricity'
      OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "The boiler #{mod_boiler.name.to_s} is electrically powered.  Only the efficiencies of fuel fired boilers are modified.  The efficiency of this boiler will not be changed.")
      next
    end
    reset_boiler_efficiency(model: model, component: mod_boiler.to_BoilerHotWater.get, eff: boiler_eff)
  end
end

#modify_chiller_efficiency(model:, chiller_type:) ⇒ Object

Apply advanced chiller measure



3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3539

def modify_chiller_efficiency(model:, chiller_type:)
  return if chiller_type.nil? || chiller_type == false || chiller_type == 'none' || chiller_type == 'NECB_Default'

  model.getChillerElectricEIRs.sort.each do |mod_chiller|
    ref_capacity_w = mod_chiller.referenceCapacity
    ref_capacity_w = ref_capacity_w.to_f

    ##### Look for a chiller set in chiller_set.json (with a capacity close to that of the existing chiller)
    chiller_set, chiller_min_cap, chiller_max_cap = find_chiller_set(chiller_type: chiller_type, ref_capacity_w: ref_capacity_w)

    ##### No need to replace any chillers with capacity = 0.001 W as per Kamel Haddad's comment
    if ref_capacity_w > 0.0011
      reset_chiller_efficiency(model: model, component: mod_chiller.to_ChillerElectricEIR.get, cop: chiller_set)
    end
  end

  ##### Change fan power of single-speed Cooling towers from 'Hard Sized' to Autosized (Otherwise, E+ gives the fatal error 'Autosizing of cooling tower UA failed for tower')
  model.getCoolingTowerSingleSpeeds.sort.each(&:autosizeFanPoweratDesignAirFlowRate)
end

#modify_furnace_efficiency(model:, furnace_eff: nil) ⇒ Object

Apply Furnace efficiency This model takes an OS model and a furnace efficiency string or hash sent to it with the following form:

"furnace_eff": {
    "name" => "NECB 85% Efficient Condensing Furnace",
    "efficiency" => 0.85,
    "part_load_curve" => "FURNACE-EFFPLR-COND-NECB2011",
    "notes" => "From NECB 2011."
}

If furnace_eff is nil then it does nothing. If both “efficiency” and “part_load_curve” are nil then it does nothing. If a furnace_eff is a string it looks for furnace_eff as a “name” in the furnace_set.json file to find the performance details. If an efficiency is set but is not between 0.01 and 1.0 it returns an error. Otherwise, it looks for air loop supply components that match the “OS_CoilHeatingGas” type. If it finds one it then calls the reset_furnace_efficiency method which resets the the furnace efficiency and looks for the part load efficiency curve in the curves.json file. If it finds a curve it sets the part load curve to that, otherwise it returns an error. It also renames the furnace to include the “furnace_eff”.



3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3223

def modify_furnace_efficiency(model:, furnace_eff: nil)
  return if furnace_eff.nil?

  # If furnace_eff is a string rather than a hash then assume it is the name of a furnace efficiency package and look
  # for a package with that name in furnace_set.json.
  if furnace_eff.is_a?(String)
    eff_packages = @standards_data['tables']['furnace_eff_ecm']['table']
    eff_package = eff_packages.select { |eff_pack_info| eff_pack_info['name'] == furnace_eff }

    raise "Cannot not find #{furnace_eff} in the ECMS furnace_set.json file.  Please check that the name is correctly spelled in the ECMS class furnace_set.json and in the code calling (directly or through another method) the ECMS class modify_furnace_efficiency method." if eff_package.empty?
    raise "More than one furnace efficiency package with the name #{furnace_eff} was found.  Please check the ECMS class furnace_set.json file and make sure that each furnace efficiency package has a unique name." if eff_package.size > 1

    ecm_name = furnace_eff
    furnace_eff = {
      'name' => ecm_name,
      'efficiency' => eff_package[0]['efficiency'],
      'part_load_curve' => eff_package[0]['part_load_curve']
    }
  end
  # If nothing is passed in the furnace_eff hash then assume this was not supposed to be used and return without doing
  # anything.
  return if furnace_eff['name'].nil? && furnace_eff['efficiency'].nil? && furnace_eff['part_load_curve'].nil?
  # If no efficiency or partload curve are found (either passed directly or via the furnace_set.json file) then assume
  # that the current furance performance settings should not be changed.  Return without changing anything.
  return if furnace_eff['efficiency'].nil? && furnace_eff['part_load_curve'].nil?
  raise 'You attempted to set the efficiency of furnaces in this model to nil.  Please check the ECMS class furnace_set.json file and make sure the efficiency is set' if furnace_eff['efficiency'].nil?
  raise "You attempted to set the efficiency of furnaces in this model to: #{furnace_eff['efficiency']}. Please check the ECMS class furnace_set.json file and make sure the efficiency you set is between 0.01 and 1.0." if furnace_eff['efficiency'] < 0.01 || furnace_eff['efficiency'] > 1.0
  raise 'You attempted to set the part load curve of furnaces in this model to nil.  Please check the ECMS class furnace_set.json file and ensure that both the efficiency and part load curve are set.' if furnace_eff['part_load_curve'].nil?

  model.getCoilHeatingGass.sort.each do |mod_furnace|
    reset_furnace_efficiency(model: model, component: mod_furnace.to_CoilHeatingGas.get, eff: furnace_eff)
  end
end

#modify_shw_efficiency(model:, shw_eff: nil) ⇒ Object

Apply shw efficiency This model takes an OS model and a shw efficiency string or hash sent to it with the following form:

"shw_eff": {
    "name" => "Natural Gas Power Vent with Electric Ignition",
    "efficiency" => 0.94,
    "part_load_curve" => "SWH-EFFFPLR-NECB2011"
    "notes" => "From NECB 2011."
}

If shw_eff is nil then it does nothing. If both “efficiency” and “part_load_curve” are nil then it does nothing. If shw_eff is a string then it looks for shw_eff as a “name” in the shw_set.json file for the details on the tank. If an efficiency is set but is not between 0.01 and 1.0 it returns an error. Otherwise, it looks for mixed water heaters. If it finds any it then calls the reset_shw_efficiency method which resets the the shw efficiency and the part load curve. It also renames the shw tank with the following pattern:

{volume}Gal {eff_name} Water Heater - {Capacity}kBtu/hr {efficiency} Therm Eff


3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3303

def modify_shw_efficiency(model:, shw_eff: nil)
  return if shw_eff.nil?

  # If shw_eff is a string rather than a hash then assume it is the name of a shw efficiency package and look
  # for a package with that name in shw_set.json.
  if shw_eff.is_a?(String)
    eff_packages = @standards_data['tables']['shw_eff_ecm']['table']
    eff_package = eff_packages.select { |eff_pack_info| eff_pack_info['name'] == shw_eff }

    raise "Cannot not find #{shw_eff} in the ECMS shw_set.json file.  Please check that the name is correctly spelled in the ECMS class shw_set.json and in the code calling (directly or through another method) the ECMS class modify_shw_efficiency method." if eff_package.empty?
    raise "More than one shw tank efficiency package with the name #{shw_eff} was found.  Please check the ECMS class shw_set.json file and make sure that each shw tank efficiency package has a unique name." if eff_package.size > 1

    ecm_name = shw_eff
    shw_eff = {
      'name' => ecm_name,
      'efficiency' => eff_package[0]['efficiency'],
      'part_load_curve' => eff_package[0]['part_load_curve']
    }
  end
  # If nothing is passed in the shw_eff hash then assume this was not supposed to be used and return without doing
  # anything.
  return if shw_eff['name'].nil? && shw_eff['efficiency'].nil? && shw_eff['part_load_curve'].nil?
  # If no efficiency or partload curve are found (either passed directly or via the shw_set.json file) then assume
  # that the current shw performance settings should not be changed.  Return without changing anything.
  return if shw_eff['efficiency'].nil? && shw_eff['part_load_curve'].nil?
  raise 'You attempted to set the efficiency of shw tanks in this model to nil.  Please check the ECMS class shw_set.json file and make sure the efficiency is set' if shw_eff['efficiency'].nil?
  raise "You attempted to set the efficiency of shw tanks in this model to: #{shw_eff['efficiency']}. Please check the ECMS class shw_set.json and make sure the efficiency you set is between 0.01 and 1.0." if shw_eff['efficiency'] < 0.01 || shw_eff['efficiency'] > 1.0
  raise 'You attempted to set the part load curve of shw tanks in this model to nil.  Please check the ECMS class shw_set.json file and ensure that both the efficiency and part load curve are set.' if shw_eff['part_load_curve'].nil?

  model.getWaterHeaterMixeds.sort.each do |shw_mod|
    reset_shw_efficiency(model: model, component: shw_mod, eff: shw_eff)
  end
end

#modify_unitary_cop(model:, unitary_cop:, sizing_done:, sql_db_vars_map:) ⇒ Object

Method to update the cop and/or the performance curves of unitary dx coils. The method input ‘unitary_cop’ can either be a string or a hash. When it’s a string it’s used to find a hash in the json table ‘unitary_cop_ecm’. When it’s a hash it holds the parameters needed to update the cop and/or the performance curves of the unitary coil.



3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3389

def modify_unitary_cop(model:, unitary_cop:, sizing_done:, sql_db_vars_map:)
  return if unitary_cop.nil? || (unitary_cop.to_s == 'NECB_Default')

  coils = model.getCoilCoolingDXSingleSpeeds.select {|coil| coil.name.to_s.include? '_dx'}
  coils += model.getCoilCoolingDXMultiSpeeds.select {|coil| coil.name.to_s.include? '_dx'}
  unitary_cop_copy = unitary_cop.dup
  coils.sort.each do |coil|
    coil_type = 'SingleSpeed'
    coil_type = 'MultiSpeed' if coil.class.name.to_s.include? 'CoilCoolingDXMultiSpeed'
    # if the parameter 'unitary_cop' is a string then get the information on the new parameters for the coils from
    # the json table 'unitary_cop_ecm'
    if unitary_cop_copy.is_a?(String)
      search_criteria = {}
      search_criteria['name'] = unitary_cop_copy
      coil_name = coil.name.to_s
      if (sql_db_vars_map.has_key? coil_name) && !sizing_done then coil.setName(sql_db_vars_map[coil_name]) end
      if coil_type == 'SingleSpeed'
        capacity_w = coil_cooling_dx_single_speed_find_capacity(coil)
      elsif coil_type == 'MultiSpeed'
        capacity_w = coil_cooling_dx_multi_speed_find_capacity(coil)
      end
      coil.setName(coil_name)
      cop_package = model_find_object(@standards_data['tables']['unitary_cop_ecm'], search_criteria, capacity_w)
      raise "Cannot find #{unitary_cop_ecm} in the ECMS unitary_acs.json file.  Please check that the name is correctly spelled in the ECMS class unitary_acs.json file and in the code calling (directly or through another method) the ECMS class modify_unitary_eff method." if cop_package.empty?

      ecm_name = unitary_cop_copy
      unitary_cop = {
        'name' => ecm_name,
        'maximum_capacity' => cop_package['maximum_capacity'],
        'minimum_energy_efficiency_ratio' => cop_package['minimum_energy_efficiency_ratio'],
        'minimum_seasonal_energy_efficiency_ratio' => cop_package['minimum_seasonal_energy_efficiency_ratio'],
        'minimum_coefficient_of_performance_cooling' => cop_package['minimum_coefficient_of_performance_cooling'],
        'ref_flow_rate_m3_per_sec' => cop_package['ref_flow_rate_m3_per_sec'],
        'cool_cap_ft' => cop_package['cool_cap_ft'],
        'cool_cap_fflow' => cop_package['cool_cap_fflow'],
        'cool_eir_ft' => cop_package['cool_eir_ft'],
        'cool_eir_fflow' => cop_package['cool_eir_fflow'],
        'cool_plf_fplr' => cop_package['cool_plf_fplr']
      }
    end
    next if unitary_cop['minimum_energy_efficiency_ratio'].nil? && unitary_cop['minimum_seasonal_energy_efficiency_ratio'].nil? &&
            unitary_cop['minimum_coefficient_of_performance_cooling'].nil? && unitary_cop['cool_cap_ft'].nil? && unitary_cop['cool_cap_fflow'].nil? &&
            unitary_cop['cool_eir_ft'].nil? && unitary_cop['cool_eir_fflow'].nil? && unitary_cop['cool_plf_fplr'].nil? && unitary_cop['ref_flow_rate_m3_per_sec'].nil?

    # If the dx coil is on an air loop then update its cop and the performance curves when these are specified in the ecm data
    if (coil_type == 'SingleSpeed' && coil.airLoopHVAC.is_initialized && (!coil.name.to_s.include? "_ASHP")) ||
       (coil_type == 'MultiSpeed' && coil.containingHVACComponent.get.airLoopHVAC.is_initialized)
      # Set COP if sizing run is done
      if sizing_done
        cop = nil
        if unitary_cop['minimum_energy_efficiency_ratio']
          cop = eer_to_cop_no_fan(unitary_cop['minimum_energy_efficiency_ratio'].to_f)
        elsif unitary_cop['minimum_seasonal_energy_efficiency_ratio']
          cop = seer_to_cop_no_fan(unitary_cop['minimum_seasonal_energy_efficiency_ratio'].to_f)
        elsif unitary_cop['minimum_coefficient_of_performance_cooling']
          cop = unitary_cop['minimum_coefficient_of_performance_cooling'].to_f
        end
        if coil_type == 'SingleSpeed'
          coil.setRatedCOP(cop) if cop
        elsif coil_type == 'MultiSpeed'
          coil.stages.sort.each do |stage|
            stage.setGrossRatedCoolingCOP(cop) if cop
          end
        end
        coil.setName('CoilCoolingDXSingleSpeed_dx-adv') if coil_type == 'SingleSpeed'
        coil.setName('CoilCoolingDXMultiSpeed_dx-adv') if coil_type == 'MultiSpeed'
      else
      # Set performance curves before sizing run
        cool_cap_ft = nil
        cool_cap_ft = @standards_data['curves'].select { |curve| curve['name'] == unitary_cop['cool_cap_ft'] }[0] if unitary_cop['cool_cap_ft']
        cool_cap_ft = model_add_curve(model, unitary_cop['cool_cap_ft']) if cool_cap_ft
        cool_cap_fflow = nil
        cool_cap_fflow = @standards_data['curves'].select { |curve| curve['name'] == unitary_cop['cool_cap_fflow'] }[0] if unitary_cop['cool_cap_fflow']
        cool_cap_fflow = model_add_curve(model, unitary_cop['cool_cap_fflow']) if cool_cap_fflow
        cool_eir_ft = nil
        cool_eir_ft = @standards_data['curves'].select { |curve| curve['name'] == unitary_cop['cool_eir_ft'] }[0] if unitary_cop['cool_eir_ft']
        cool_eir_ft = model_add_curve(model, unitary_cop['cool_eir_ft']) if cool_eir_ft
        cool_eir_fflow = nil
        cool_eir_fflow = @standards_data['curves'].select { |curve| curve['name'] == unitary_cop['cool_eir_fflow'] }[0] if unitary_cop['cool_eir_fflow']
        cool_eir_fflow = model_add_curve(model, unitary_cop['cool_eir_fflow']) if cool_eir_fflow
        cool_plf_fplr = nil
        cool_plf_fplr = @standards_data['curves'].select { |curve| curve['name'] == unitary_cop['cool_plf_fplr'] }[0] if unitary_cop['cool_plf_fplr']
        cool_plf_fplr = model_add_curve(model, unitary_cop['cool_plf_fplr']) if cool_plf_fplr
        rated_flow_rate = nil
        rated_flow_rate = unitary_cop['ref_flow_rate_m3_per_sec'] * (capacity_w / unitary_cop['maximum_capacity']) if unitary_cop['ref_flow_rate_m3_per_sec']
        if coil_type == 'SingleSpeed'
          coil.setTotalCoolingCapacityFunctionOfTemperatureCurve(cool_cap_ft) if cool_cap_ft
          coil.setTotalCoolingCapacityFunctionOfFlowFractionCurve(cool_cap_fflow) if cool_cap_fflow
          coil.setEnergyInputRatioFunctionOfTemperatureCurve(cool_eir_ft) if cool_eir_ft
          coil.setEnergyInputRatioFunctionOfFlowFractionCurve(cool_eir_fflow) if cool_eir_fflow
          coil.setPartLoadFractionCorrelationCurve(cool_plf_fplr) if cool_plf_fplr
          coil.setRatedAirFlowRate(rated_flow_rate) if rated_flow_rate
        elsif coil_type == 'MultiSpeed'
          coil.stages.sort.each do |stage|
            stage.setTotalCoolingCapacityFunctionofTemperatureCurve(cool_cap_ft) if cool_cap_ft
            stage.setTotalCoolingCapacityFunctionofFlowFractionCurve(cool_cap_fflow) if cool_cap_fflow
            stage.setEnergyInputRatioFunctionofTemperatureCurve(cool_eir_ft) if cool_eir_ft
            stage.setEnergyInputRatioFunctionofFlowFractionCurve(cool_eir_fflow) if cool_eir_fflow
            stage.setPartLoadFractionCorrelationCurve(cool_plf_fplr) if cool_plf_fplr
          end
        end
      end
    end
  end
end

#remove_air_loops(model) ⇒ Object

Remove air loops



60
61
62
63
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 60

def remove_air_loops(model)
  # remove air loops
  model.getAirLoopHVACs.each(&:remove)
end

#remove_all_zone_eqpt(sys_objs) ⇒ Object

Remove existing zone equipment



4
5
6
7
8
9
10
11
12
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 4

def remove_all_zone_eqpt(sys_objs)
  sys_objs.each do |isys|
    isys.thermalZones.each do |izone|
      if izone.equipment.empty? then next end

      izone.equipment.each(&:remove)
    end
  end
end

#remove_chw_loops(model) ⇒ Object

Remove chilled-water plant loops



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 31

def remove_chw_loops(model)
  model.getPlantLoops.each do |iloop|
    chw_loop = false
    iloop.supplyComponents.each do |icomp|
      if icomp.to_ChillerElectricEIR.is_initialized
        chw_loop = true
        break
      end
    end
    if chw_loop then iloop.remove end
  end
end

#remove_cw_loops(model) ⇒ Object

Remove condenser-water plant loops



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 46

def remove_cw_loops(model)
  model.getPlantLoops.each do |iloop|
    cw_loop = false
    iloop.supplyComponents.each do |icomp|
      if icomp.to_CoolingTowerSingleSpeed.is_initialized
        cw_loop = true
      end
    end
    if cw_loop then iloop.remove end
  end
end

#remove_hw_loops(model) ⇒ Object

Remove hot-water plant loops



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 16

def remove_hw_loops(model)
  model.getPlantLoops.each do |iloop|
    hw_loop = false
    iloop.supplyComponents.each do |icomp|
      if icomp.to_BoilerHotWater.is_initialized
        hw_loop = true
        break
      end
    end
    if hw_loop then iloop.remove end
  end
end

#reset_boiler_efficiency(model:, component:, eff:) ⇒ Object

This method takes an OS model, a “OS_BoilerHotWater” type compenent, condensing efficiency limit and an efficiency hash which looks like:

"eff": {
    "name": "NECB 88% Efficient Condensing Boiler",
    "efficiency" => 0.88,
    "part_load_curve" => "BOILER-EFFPLR-COND-NECB2011",
    "notes" => "From NECB 2011."
}

This method sets efficiency of the boiler to whatever is entered in eff. It then looks for the “part_load_curve” value in the curves.json file. If it does not find one it returns an error. If it finds one it reset the part load curve to whatever was found. It then determines the nominal capacity of the boiler. If the nominal capacity is greater than 1W the boiler is considered a primary boiler (for the name only) if the capacity is less than 1W the boiler is considered a secondary boiler (for the name only). It then renames the boiler according to the following pattern: “Primary/Secondary eff capacity kBtu/hr”.



3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3171

def reset_boiler_efficiency(model:, component:, eff:)
  component.setNominalThermalEfficiency(eff['efficiency'])
  part_load_curve_name = eff['part_load_curve'].to_s
  existing_curve = @standards_data['curves'].select { |curve| curve['name'] == part_load_curve_name }
  raise "No boiler with the name #{part_load_curve_name} could be found in the ECMS class curves.json file.  Please check both the ECMS class boiler_set.json and class curves.json files to ensure the curve is entered and referenced correctly." if existing_curve.empty?

  part_load_curve_data = (@standards_data['curves'].select { |curve| curve['name'] == part_load_curve_name })[0]
  if part_load_curve_data['independent_variable_1'].to_s.upcase == 'TEnteringBoiler'.upcase || part_load_curve_data['independent_variable_2'].to_s.upcase == 'TEnteringBoiler'.upcase
    component.setEfficiencyCurveTemperatureEvaluationVariable('EnteringBoiler')
  elsif part_load_curve_data['independent_variable_1'].to_s.upcase == 'TLeavingBoiler'.upcase || part_load_curve_data['independent_variable_2'].to_s.upcase == 'TLeavingBoiler'.upcase
    component.setEfficiencyCurveTemperatureEvaluationVariable('LeavingBoiler')
  end
  part_load_curve = model_add_curve(model, part_load_curve_name)
  raise "There was a problem setting the boiler part load curve named #{part_load_curve_name} for #{component.name}.  Please ensure that the curve is entered and referenced correctly in the ECMS class curves.json and boiler_set.json files." unless part_load_curve

  component.setNormalizedBoilerEfficiencyCurve(part_load_curve)
  if component.nominalCapacity.is_initialized
    boiler_size_w = component.nominalCapacity.to_f
  elsif component.isNominalCapacityAutosized
    boiler_size_w = component.autosizedNominalCapacity.get
  end
  boiler_size_kbtu_per_hour = OpenStudio.convert(boiler_size_w, 'W', 'kBtu/h').get
  boiler_primacy = 'Primary '
  if boiler_size_w < 1.0 || component.name.to_s.upcase.include?("SECONDARY")
    boiler_primacy = 'Secondary '
  end
  if eff['name'].nil?
    eff_measure_name = 'Revised Performance Boiler'
  else
    eff_measure_name = eff['name']
  end
  old_boiler_name = component.name.to_s
  new_boiler_name = (boiler_primacy + eff_measure_name + " #{boiler_size_kbtu_per_hour.round(0)}kBtu/hr #{component.nominalThermalEfficiency} Thermal Eff").strip
  component.setName(new_boiler_name)
end

#reset_chiller_efficiency(model:, component:, cop:) ⇒ Object



3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3597

def reset_chiller_efficiency(model:, component:, cop:)
  # Note that all parameters (except for the capacity) of an existing chiller are replaced with the ones of the VSD chiller, as per Kamel Haddad's comment.
  component.setName('ChillerElectricEIR_VSDCentrifugalWaterChiller')
  component.setReferenceCOP(cop['cop_w_by_w'])
  component.setReferenceLeavingChilledWaterTemperature(cop['ref_leaving_chilled_water_temp_c'])
  component.setReferenceEnteringCondenserFluidTemperature(cop['ref_entering_condenser_fluid_temp_c'])
  component.isReferenceChilledWaterFlowRateAutosized
  component.isReferenceCondenserFluidFlowRateAutosized
  component.setMinimumPartLoadRatio(cop['min_part_load_ratio'])
  component.setMaximumPartLoadRatio(cop['max_part_load_ratio'])
  component.setOptimumPartLoadRatio(cop['opt_part_load_ratio'])
  component.setMinimumUnloadingRatio(cop['min_unloading_ratio'])
  component.setCondenserType(cop['condenser_type'])
  component.setFractionofCompressorElectricConsumptionRejectedbyCondenser(cop['fraction_of_compressor_electric_consumption_rejected_by_condenser'])
  component.setLeavingChilledWaterLowerTemperatureLimit(cop['leaving_chilled_water_lower_temperature_limit_c'])
  component.setChillerFlowMode(cop['chiller_flow_mode'])
  component.setDesignHeatRecoveryWaterFlowRate(cop['design_heat_recovery_water_flow_rate_m3_s'])

  # set other fields of this object to nothing #Note that this could not be done for the 'Condenser Heat Recovery Relative Capacity Fraction' field as there is no 'reset' for this field.
  component.resetCondenserFanPowerRatio
  component.resetSizingFactor
  component.resetBasinHeaterCapacity
  component.resetBasinHeaterSetpointTemperature
  component.resetBasinHeaterSchedule
  component.resetHeatRecoveryInletHighTemperatureLimitSchedule
  component.resetHeatRecoveryLeavingTemperatureSetpointNode

  ##### Replace cooling_capacity_function_of_temperature (CAPFT) curve
  capft_curve_name = cop['capft_curve'].to_s
  existing_curve = @standards_data['curves'].select { |curve| curve['name'] == capft_curve_name }
  raise "No chiller with the name #{capft_curve_name} could be found in the ECMS class curves.json file.  Please check both the ECMS class chiller_set.json and curves.json files to ensure the curve is entered and referenced correctly." if existing_curve.empty?

  capft_curve_data = (@standards_data['curves'].select { |curve| curve['name'] == capft_curve_name })[0]
  capft_curve = model_add_curve(model, capft_curve_name)
  component.setCoolingCapacityFunctionOfTemperature(capft_curve) if capft_curve
  raise "There was a problem setting the CoolingCapacityFunctionOfTemperature curve named #{capft_curve_name} for #{component.name}.  Please ensure that the curve is entered and referenced correctly in the ECMS class curves.json and chiller_set.json files." if !capft_curve

  ##### Replace electric_input_to_cooling_output_ratio_function_of_temperature (EIRFT) curve
  eirft_curve_name = cop['eirft_curve'].to_s
  existing_curve = @standards_data['curves'].select { |curve| curve['name'] == eirft_curve_name }
  raise "No chiller with the name #{eirft_curve_name} could be found in the ECMS class curves.json file.  Please check both the ECMS class chiller_set.json and curves.json files to ensure the curve is entered and referenced correctly." if existing_curve.empty?

  eirft_curve_data = (@standards_data['curves'].select { |curve| curve['name'] == eirft_curve_name })[0]
  eirft_curve = model_add_curve(model, eirft_curve_name)
  component.setElectricInputToCoolingOutputRatioFunctionOfTemperature(eirft_curve) if eirft_curve
  raise "There was a problem setting the ElectricInputToCoolingOutputRatioFunctionOfTemperature curve named #{eirft_curve_name} for #{component.name}.  Please ensure that the curve is entered and referenced correctly in the ECMS class curves.json and chiller_set.json files." if !eirft_curve

  ##### Replace electric_input_to_cooling_output_ratio_function_of_part_load_ratio (EIRFPLR) curve
  eirfplr_curve_name = cop['eirfplr_curve'].to_s
  existing_curve = @standards_data['curves'].select { |curve| curve['name'] == eirfplr_curve_name }
  raise "No chiller with the name #{eirfplr_curve_name} could be found in the ECMS class curves.json file.  Please check both the ECMS class chiller_set.json and curves.json files to ensure the curve is entered and referenced correctly." if existing_curve.empty?

  eirfplr_curve_data = (@standards_data['curves'].select { |curve| curve['name'] == eirfplr_curve_name })[0]
  eirfplr_curve = model_add_curve(model, eirfplr_curve_name)
  component.setElectricInputToCoolingOutputRatioFunctionOfPLR(eirfplr_curve) if eirfplr_curve
  raise "There was a problem setting the ElectricInputToCoolingOutputRatioFunctionOfPLR curve named #{eirfplr_curve_name} for #{component.name}.  Please ensure that the curve is entered and referenced correctly in the ECMS class curves.json and chiller_set.json files." if !eirfplr_curve
end

#reset_furnace_efficiency(model:, component:, eff:) ⇒ Object

This method takes an OS model, a “OS_CoilHeatingGas” type compenent, and an efficiency hash which looks like:

"eff": {
    "name": "NECB 85% Efficient Condensing Furnace",
    "efficiency" => 0.85,
    "part_load_curve" => "FURNACE-EFFPLR-COND-NECB2011",
    "notes" => "From NECB 2011."
}

This method sets the efficiency of the furnace to whatever is entered in eff. It then looks for the “part_load_curve” value in the curves.json file. If it does not find one it returns an error. If it finds one it reset the part load curve to whatever was found. It then renames the furnace according to the following pattern: “eff + <furnace number (whatever was there before)>”.



3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3268

def reset_furnace_efficiency(model:, component:, eff:)
  component.setGasBurnerEfficiency(eff['efficiency'])
  part_load_curve_name = eff['part_load_curve'].to_s
  existing_curve = @standards_data['curves'].select { |curve| curve['name'] == part_load_curve_name }
  raise "No furnace part load curve with the name #{part_load_curve_name} could be found in the ECMS class curves.json file.  Please check both the ECMS class curves.json and the measure furnace_set.json files to ensure the curve is entered and referenced correctly." if existing_curve.empty?

  part_load_curve = model_add_curve(model, part_load_curve_name)
  raise "There was a problem setting the furnace part load curve named #{part_load_curve_name} for #{component.name}.  Please ensure that the curve is entered and referenced correctly in the ECMS class curves.json or measure furnace_set.json files." unless part_load_curve

  component.setPartLoadFractionCorrelationCurve(part_load_curve)
  if eff['name'].nil?
    ecm_package_name = 'Revised Performance Furnace'
  else
    ecm_package_name = eff['name']
  end
  furnace_num = component.name.to_s.gsub(/[^0-9]/, '')
  new_furnace_name = (ecm_package_name + " #{furnace_num}").strip
  component.setName(new_furnace_name)
end

#reset_shw_efficiency(model:, component:, eff:) ⇒ Object

This method takes an OS model, a “OS_WaterHeaterMixed” type compenent, and an efficiency hash which looks like:

"eff": {
    "name": "Natural Gas Power Vent with Electric Ignition",
    "efficiency" => 0.94,
    "part_load_curve" => "SWH-EFFFPLR-NECB2011",
    "notes" => "From NECB 2011."
}

This method sets the efficiency of the shw heater to whatever is entered in eff. It then looks for the “part_load_curve” value in the curves.json file. If it does not find one it returns an error. If it finds one it resets the part load curve to whatever was found. It then renames the shw tank according to the following pattern:

{volume}Gal {eff_name} Water Heater - {Capacity}kBtu/hr {efficiency} Therm Eff


3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 3348

def reset_shw_efficiency(model:, component:, eff:)
  return if component.heaterFuelType.to_s.upcase == 'ELECTRICITY'

  eff_result = component.setHeaterThermalEfficiency(eff['efficiency'].to_f)
  raise "There was a problem setting the efficiency of the SHW #{component.name}.  Please check the ECMS class shw_set.json file or the model." unless eff_result

  part_load_curve_name = eff['part_load_curve'].to_s
  existing_curve = @standards_data['curves'].select { |curve| curve['name'] == part_load_curve_name }
  raise "No shw tank part load curve with the name #{part_load_curve_name} could be found in the ECMS class curves.json file.  Please check both the ECMS class curves.json and the measure shw_set.json files to ensure the curve is entered and referenced correctly." if existing_curve.empty?

  part_load_curve = model_add_curve(model, part_load_curve_name)
  raise "There was a problem setting the shw tank part load curve named #{part_load_curve_name} for #{component.name}.  Please ensure that the curve is entered and referenced correctly in the ECMS class curves.json and shw_set.json files." unless part_load_curve

  component.setPartLoadFactorCurve(part_load_curve)
  # Get the volume and capacity of the SHW tank.
  if component.tankVolume.is_initialized
    shw_vol_m3 = component.tankVolume.to_f
    shw_vol_gal = OpenStudio.convert(shw_vol_m3, 'm^3', 'gal').get.to_f.round(0)
  elsif component.isTankVolumeAutosized
    shw_vol_gal = 'auto_size'
  end
  if component.heaterMaximumCapacity.is_initialized
    shw_capacity_W = component.heaterMaximumCapacity.to_f
    shw_capacity_kBtu_hr = OpenStudio.convert(shw_capacity_W, 'W', 'kBtu/h').get.to_f.round(0)
  elsif component.isHeaterMaximumCapacityAutosized
    shw_capacity_kBtu_hr = 'auto_cap'
  end
  # Set a default revised shw tank name if no name is present in the eff hash.
  if eff['name'].nil?
    shw_ecm_package_name = 'Revised'
  else
    shw_ecm_package_name = eff['name']
  end
  shw_name = ("#{shw_vol_gal} Gal #{shw_ecm_package_name} Water Heater - #{shw_capacity_kBtu_hr}kBtu/hr #{eff['efficiency']} Therm Eff").strip
  component.setName(shw_name)
end

#scale_electrical_loads(model:, scale: 'NECB_Default') ⇒ Object

Electrical



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/openstudio-standards/standards/necb/ECMS/loads.rb', line 25

def scale_electrical_loads(model:, scale: 'NECB_Default')
  ##### Remove leading or trailing whitespace in case users add them in inputs
  if scale.instance_of?(String)
    scale = scale.strip
  end
  return model if (scale == 'NECB_Default') || scale.nil?

  ##### Convert a string to a float
  if scale.instance_of?(String)
    scale = scale.to_f
  end
  if scale == 0.0
    model.getElectricEquipments.sort.each(&:remove)
    model.getElectricEquipmentDefinitions.sort.each(&:remove)
  else
    model.getElectricEquipments.sort.each do |item|
      item.setMultiplier(item.multiplier * scale)
    end
  end
end

#scale_infiltration_loads(model:, scale: 'NECB_Default') ⇒ Object

Infiltration



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/openstudio-standards/standards/necb/ECMS/loads.rb', line 71

def scale_infiltration_loads(model:, scale: 'NECB_Default')
  ##### Remove leading or trailing whitespace in case users add them in inputs
  if scale.instance_of?(String)
    scale = scale.strip
  end
  return model if (scale == 'NECB_Default') || scale.nil?

  ##### Convert a string to a float
  if scale.instance_of?(String)
    scale = scale.to_f
  end
  if scale == 0.0
    model.getSpaceInfiltrationDesignFlowRates.sort.each(&:remove)
  else
    model.getSpaceInfiltrationDesignFlowRates.sort.each do |infiltration_load|
      infiltration_load.setDesignFlowRate(infiltration_load.designFlowRate.get * scale) unless infiltration_load.designFlowRate.empty?
      infiltration_load.setFlowperSpaceFloorArea(infiltration_load.flowperSpaceFloorArea.get * scale) unless infiltration_load.flowperSpaceFloorArea.empty?
      infiltration_load.setFlowperExteriorSurfaceArea(infiltration_load.flowperExteriorSurfaceArea.get * scale) unless infiltration_load.flowperExteriorSurfaceArea.empty?
      infiltration_load.setAirChangesperHour(infiltration_load.airChangesperHour.get * scale) unless infiltration_load.airChangesperHour.empty?
    end
  end
end

#scale_oa_loads(model:, scale: 'NECB_Default') ⇒ Object

Outdoor Air



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/openstudio-standards/standards/necb/ECMS/loads.rb', line 47

def scale_oa_loads(model:, scale: 'NECB_Default')
  ##### Remove leading or trailing whitespace in case users add them in inputs
  if scale.instance_of?(String)
    scale = scale.strip
  end
  return model if (scale == 'NECB_Default') || scale.nil?

  ##### Convert a string to a float
  if scale.instance_of?(String)
    scale = scale.to_f
  end
  if scale == 0.0
    model.getDesignSpecificationOutdoorAirs.sort.each(&:remove)
  else
    model.getDesignSpecificationOutdoorAirs.sort.each do |oa_def|
      oa_def.setOutdoorAirFlowperPerson(oa_def.outdoorAirFlowperPerson * scale) unless oa_def.isOutdoorAirFlowperPersonDefaulted
      oa_def.setOutdoorAirFlowperFloorArea(oa_def.outdoorAirFlowperFloorArea * scale) unless oa_def.isOutdoorAirFlowperFloorAreaDefaulted
      oa_def.setOutdoorAirFlowRate(oa_def.outdoorAirFlowRate * scale) unless oa_def.isOutdoorAirFlowRateDefaulted
      oa_def.setOutdoorAirFlowAirChangesperHour(oa_def.outdoorAirFlowAirChangesperHour * scale) unless oa_def.isOutdoorAirFlowAirChangesperHourDefaulted
    end
  end
end

#scale_occupancy_loads(model:, scale: 'NECB_Default') ⇒ Object

Occupancy



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/openstudio-standards/standards/necb/ECMS/loads.rb', line 3

def scale_occupancy_loads(model:, scale: 'NECB_Default')
  ##### Remove leading or trailing whitespace in case users add them in inputs
  if scale.instance_of?(String)
    scale = scale.strip
  end
  return model if (scale == 'NECB_Default') || scale.nil?

  ##### Convert a string to a float
  if scale.instance_of?(String)
    scale = scale.to_f
  end
  if scale == 0.0
    model.getPeoples.sort.each(&:remove)
    model.getPeopleDefinitions.sort.each(&:remove)
  else
    model.getPeoples.sort.each do |item|
      item.setMultiplier(item.multiplier * scale)
    end
  end
end

#set_ghx_loop_district_cap(model) ⇒ Object



1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 1951

def set_ghx_loop_district_cap(model)
  # The autosized values for the district heating and cooling objects on a condenser loop are the sum of the peak heating and
  # cooling loads. Here the capacity of the district heating object of the condenser loop is set to the maximum district heating
  # rate on the winter design day. Similarily the capacity of the district cooling object of the condenser loop is set to the
  # maximum district cooling rate on the summer design day.

  cw_loops = model.getPlantLoops.select{|loop| loop.sizingPlant.loopType.to_s.downcase == 'condenser'}
  ghx_loops = cw_loops.select { |loop| loop.name.to_s.downcase.include? 'glhx' }
  return if ghx_loops.empty?
  ghx_loop = ghx_loops[0]
  dist_htg_eqpts = ghx_loop.supplyComponents.select { |comp| comp.iddObjectType.valueName.to_s.include?('DistrictHeating') }
  if !dist_htg_eqpts.empty?
    case dist_htg_eqpts[0].iddObjectType.valueName.to_s
    when 'OS_DistrictHeating'
      dist_htg_eqpt = dist_htg_eqpts[0].to_DistrictHeating.get
    when 'OS_DistrictHeating_Water'
      dist_htg_eqpt = dist_htg_eqpts[0].to_DistrictHeatingWater.get
    when 'OS_DistrictHeating_Steam'
      dist_htg_eqpt = dist_htg_eqpts[0].to_DistrictHeatingSteam.get
    end
  end
  dist_clg_eqpts = ghx_loop.supplyComponents.select {|comp| comp.to_DistrictCooling.is_initialized}
  dist_clg_eqpt = dist_clg_eqpts[0].to_DistrictCooling.get if !dist_clg_eqpts.empty?
  raise("set_cond_loop_district_cap: condenser loop doesn't have a district heating and district cooling objects") if dist_htg_eqpts.empty? || dist_clg_eqpts.empty?
  # District Heating
  sql_command = "SELECT ReportVariableDataDictionaryIndex FROM ReportVariableDataDictionary
             WHERE VariableName='District Heating Water Rate'"
  dhtg_index = model.sqlFile.get.execAndReturnFirstString(sql_command).get
  raise("set_ghx_loop_district_cap: EnergyPlus sql results file has no data for district heating hot water rate") if dhtg_index.nil?
  sql_command = "SELECT Value FROM ReportVariableWithTime
             WHERE ReportDataDictionaryIndex=#{dhtg_index} AND DayType='WinterDesignDay'"
  dist_htg_w = model.sqlFile.get.execAndReturnVectorOfString(sql_command).get
  sql_command = "SELECT Value FROM ReportVariableWithTime
             WHERE ReportDataDictionaryIndex=#{dhtg_index} AND DayType='SummerDesignDay'"
  dist_htg_s = model.sqlFile.get.execAndReturnVectorOfString(sql_command).get
  # District Cooling
  sql_command = "SELECT ReportVariableDataDictionaryIndex FROM ReportVariableDataDictionary
             WHERE VariableName='District Cooling Water Rate'"
  dclg_index = model.sqlFile.get.execAndReturnFirstString(sql_command).get
  raise("set_ghx_loop_district_cap: EnergyPlus sql results file has no data for district cooling chilled water rate") if dclg_index.nil?
  sql_command = "SELECT Value FROM ReportVariableWithTime
             WHERE ReportDataDictionaryIndex=#{dclg_index} AND DayType='SummerDesignDay'"
  dist_clg_s = model.sqlFile.get.execAndReturnVectorOfString(sql_command).get
  sql_command = "SELECT Value FROM ReportVariableWithTime
             WHERE ReportDataDictionaryIndex=#{dclg_index} AND DayType='WinterDesignDay'"
  dist_clg_w = model.sqlFile.get.execAndReturnVectorOfString(sql_command).get
  # Assign peak heating and cooling loads to capacities of district objects
  max_htg_load = 0.0
  max_clg_load = 0.0
  for hour in 1..24
    htg_load = [dist_htg_w[hour-1].to_f-dist_clg_w[hour-1].to_f,0.0].max
    clg_load = [dist_clg_s[hour-1].to_f-dist_htg_s[hour-1].to_f,0.0].max
    max_htg_load = [max_htg_load,htg_load].max
    max_clg_load = [max_clg_load,clg_load].max
  end
  dist_htg_eqpt.setNominalCapacity(max_htg_load)
  dist_clg_eqpt.setNominalCapacity(max_clg_load)
end

#update_system_zones_map(model, system_zones_map, system_zones_map_option, system_key) ⇒ Object

Update the map between systems and zones



449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 449

def update_system_zones_map(model,system_zones_map,system_zones_map_option,system_key)
  updated_system_zones_map = {}
  if system_zones_map_option == 'one_sys_per_bldg'
    system_zones_map.each do |sname,zones|
      updated_system_zones_map[system_key] = [] if !updated_system_zones_map.has_key? system_key
      updated_system_zones_map[system_key] += zones
    end
  elsif system_zones_map_option == 'one_sys_per_floor'
    storey_zones_map = get_storey_zones_map(system_zones_map)
    storey_zones_map.each do |storey_name,zones|
      sys_name = "#{system_key}_#{storey_name.gsub(' ','_')}"
      updated_system_zones_map[sys_name] = [] if !updated_system_zones_map.has_key? sys_name
      updated_system_zones_map[sys_name] += zones
    end
  end

  return updated_system_zones_map
end

#update_system_zones_map_keys(system_zones_map, sys_abbr) ⇒ Object

The first 5 letters of the air loop name designate the system type (sys_abbr). This method updates the system type designation in the air loop name. At the same time the chosen air loop names are checked to avoid duplicate names from being used in the hash for system to zones.



472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 472

def update_system_zones_map_keys(system_zones_map,sys_abbr)
  updated_system_zones_map = {}
  system_zones_map.each do |sname,zones|
    updated_sys_name = "#{sys_abbr}#{sname[5..-1]}"
    if !updated_system_zones_map.has_key? updated_sys_name
      updated_system_zones_map[updated_sys_name] = zones
    else
      updated_sys_name_set = false
      index = 1
      while !updated_sys_name_set
        updated_sys_name = "#{sys_abbr}#{sname[5..-1]}"
        updated_sys_name.chop! if updated_sys_name.split.size > 1
        updated_sys_name = updated_sys_name + index.to_s
        if !updated_system_zones_map.has_key? updated_sys_name
          updated_sys_name_set = true
          updated_system_zones_map[updated_sys_name] = zones
        end
        index += 1
      end
    end
  end

  return updated_system_zones_map
end

#zone_with_no_vrf_eqpt?(zone) ⇒ Boolean

Method to determine whether zone can have terminal vrf equipment. Zones with no vrf terminal equipment are characterized by transient occupancy such is the case for corridors, stairwells, storage, …

Returns:

  • (Boolean)


314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb', line 314

def zone_with_no_vrf_eqpt?(zone)
  space_types_to_skip = {}
  space_types_to_skip['NECB2011'] = ['Atrium - H < 13m',
                                     'Atrium - H > 13m',
                                     'Audience - auditorium',
                                     'Corr. < 2.4m wide',
                                     'Corr. >= 2.4m wide',
                                     'Electrical/Mechanical',
                                     'Hospital corr. < 2.4m',
                                     'Hospital corr. >= 2.4m',
                                     'Mfg - corr. < 2.4m',
                                     'Mfg - corr. >= 2.4m',
                                     'Lobby - elevator',
                                     'Lobby - hotel',
                                     'Lobby - motion picture',
                                     'Lobby - other',
                                     'Lobby - performance arts',
                                     'Locker room',
                                     'Parking garage space',
                                     'Stairway',
                                     'Storage area',
                                     'Storage area - occsens',
                                     'Storage area - refrigerated',
                                     'Storage area - refrigerated - occsens',
                                     'Washroom',
                                     'Warehouse - fine',
                                     'Warehouse - fine - refrigerated',
                                     'Warehouse - med/blk',
                                     'Warehouse - med/blk - refrigerated',
                                     'Warehouse - med/blk2',
                                     'Warehouse - med/blk2 - refrigerated',
                                     'Hotel/Motel - lobby']

  space_types_to_skip['NECB2015'] = ['Atrium (height < 6m)',
                                     'Atrium (6 =< height <= 12m)',
                                     'Atrium (height > 12m)',
                                     'Computer/Server room-sch-A',
                                     'Copy/Print room',
                                     'Corridor/Transition area - hospital',
                                     'Corridor/Transition area - manufacturing facility',
                                     'Corridor/Transition area - space designed to ANSI/IES RP-28',
                                     'Corridor/Transition area other',
                                     'Electrical/Mechanical room',
                                     'Emergency vehicle garage',
                                     'Lobby - elevator',
                                     'Lobby - hotel',
                                     'Lobby - motion picture theatre',
                                     'Lobby - performing arts theatre',
                                     'Lobby - space designed to ANSI/IES RP-28',
                                     'Lobby - other',
                                     'Locker room',
                                     'Storage garage interior',
                                     'Storage room < 5 m2',
                                     'Storage room <= 5 m2 <= 100 m2',
                                     'Storage room > 100 m2',
                                     'Washroom - space designed to ANSI/IES RP-28',
                                     'Washroom - other',
                                     'Warehouse storage area medium to bulky palletized items',
                                     'Warehouse storage area small hand-carried items(4)']

  space_types_to_skip['NECB2017'] = ['Atrium (height < 6m)',
                                     'Atrium (6 =< height <= 12m)',
                                     'Atrium (height > 12m)',
                                     'Computer/Server room',
                                     'Copy/Print room',
                                     'Corridor/Transition area - hospital',
                                     'Corridor/Transition area - manufacturing facility',
                                     'Corridor/Transition area - space designed to ANSI/IES RP-28',
                                     'Corridor/Transition area other',
                                     'Electrical/Mechanical room',
                                     'Emergency vehicle garage',
                                     'Lobby - elevator',
                                     'Lobby - hotel',
                                     'Lobby - motion picture theatre',
                                     'Lobby - performing arts theatre',
                                     'Lobby - space designed to ANSI/IES RP-28',
                                     'Lobby - other',
                                     'Locker room',
                                     'Stairway/Stairwell',
                                     'Storage garage interior',
                                     'Storage room < 5 m2',
                                     'Storage room <= 5 m2 <= 100 m2',
                                     'Storage room > 100 m2',
                                     'Washroom - space designed to ANSI/IES RP-28',
                                     'Washroom - other',
                                     'Warehouse storage area medium to bulky palletized items',
                                     'Warehouse storage area small hand-carried items(4)']

  zone_does_not_have_vrf_eqpt = false
  zone.spaces.each do |space|
    space_types_to_skip.each do |std, spfs|
      spfs.each do |spf|
        if space.spaceType.get.name.to_s.downcase.include? spf.downcase
          zone_does_not_have_vrf_eqpt = true
          break
        end
      end
      break if zone_does_not_have_vrf_eqpt
    end
    break if zone_does_not_have_vrf_eqpt
  end
end