openstudio-standards 0.8.5 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/standards/test_performance_expected_dd_results.csv +90 -90
- data/lib/openstudio-standards/btap/activity.rb +858 -61
- data/lib/openstudio-standards/btap/attributes.rb +297 -103
- data/lib/openstudio-standards/btap/bridging.rb +1335 -593
- data/lib/openstudio-standards/btap/btap.rb +60 -181
- data/lib/openstudio-standards/btap/carbon/btap_carbon.rb +199 -142
- data/lib/openstudio-standards/btap/common/constructions.json +1275 -0
- data/lib/openstudio-standards/btap/common/costs.csv +1969 -0
- data/lib/openstudio-standards/btap/common/costs_local_factors.csv +2315 -0
- data/lib/openstudio-standards/btap/common/materials_glazing.csv +61 -0
- data/lib/openstudio-standards/btap/{common_resources → common}/materials_hvac.csv +1685 -1685
- data/lib/openstudio-standards/btap/{common_resources → common}/materials_lighting.csv +266 -266
- data/lib/openstudio-standards/btap/common/materials_opaque.csv +214 -0
- data/lib/openstudio-standards/btap/common/necb_building_types.csv +35 -0
- data/lib/openstudio-standards/btap/common/necb_space_types.csv +110 -0
- data/lib/openstudio-standards/btap/common/thermal_bridging.csv +73 -0
- data/lib/openstudio-standards/btap/costing/btap_costing.rb +346 -429
- data/lib/openstudio-standards/btap/costing/database.rb +104 -0
- data/lib/openstudio-standards/btap/costing/daylighting_sensor_control_costing.rb +356 -344
- data/lib/openstudio-standards/btap/costing/dcv_costing.rb +282 -296
- data/lib/openstudio-standards/btap/costing/envelope_costing.rb +179 -192
- data/lib/openstudio-standards/btap/costing/heating_cooling_costing.rb +2477 -2316
- data/lib/openstudio-standards/btap/costing/led_lighting_costing.rb +127 -142
- data/lib/openstudio-standards/btap/costing/lighting_costing.rb +216 -198
- data/lib/openstudio-standards/btap/costing/nv_costing.rb +522 -523
- data/lib/openstudio-standards/btap/costing/pv_ground_costing.rb +649 -649
- data/lib/openstudio-standards/btap/costing/shw_costing.rb +626 -625
- data/lib/openstudio-standards/btap/costing/thermal_bridging_costing.rb +72 -0
- data/lib/openstudio-standards/btap/costing/ventilation_costing.rb +2363 -2361
- data/lib/openstudio-standards/btap/deprecated.rb +1033 -0
- data/lib/openstudio-standards/btap/envelope.rb +313 -572
- data/lib/openstudio-standards/btap/fileio.rb +152 -1070
- data/lib/openstudio-standards/btap/geometry.rb +486 -766
- data/lib/openstudio-standards/btap/linear_regression.rb +130 -0
- data/lib/openstudio-standards/btap/paths.rb +46 -0
- data/lib/openstudio-standards/btap/qaqc/analysis.rb +163 -0
- data/lib/openstudio-standards/btap/qaqc/data.rb +2293 -0
- data/lib/openstudio-standards/btap/qaqc/datapoint.rb +641 -0
- data/lib/openstudio-standards/btap/schedules.rb +11 -611
- data/lib/openstudio-standards/btap/structure.rb +574 -189
- data/lib/openstudio-standards/constructions/materials/information.rb +1 -1
- data/lib/openstudio-standards/create_typical/create_typical.rb +1 -1
- data/lib/openstudio-standards/exterior_lighting/create.rb +135 -85
- data/lib/openstudio-standards/exterior_lighting/data/typical_exterior_lighting.json +20 -0
- data/lib/openstudio-standards/exterior_lighting/information.rb +23 -2
- data/lib/openstudio-standards/geometry/create.rb +7 -3
- data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.Model.rb +3 -2
- data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.Model.rb +3 -2
- data/lib/openstudio-standards/prototypes/common/data/thermostat_schedule_lookup.json +84 -84
- data/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb +4 -4
- data/lib/openstudio-standards/refrigeration/create_walkin.rb +45 -5
- data/lib/openstudio-standards/refrigeration/data/refrigerated_walkins.csv +75 -75
- data/lib/openstudio-standards/schedules/parametric.rb +6 -0
- data/lib/openstudio-standards/service_water_heating/create_typical.rb +10 -3
- data/lib/openstudio-standards/service_water_heating/create_water_heating_loop.rb +30 -14
- data/lib/openstudio-standards/service_water_heating/information.rb +4 -1
- data/lib/openstudio-standards/sql_file/unmet_hours.rb +2 -1
- data/lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb +3 -1
- data/lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb +3 -1
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/data/ashrae_90_1_2004.boilers.json +12 -0
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/data/ashrae_90_1_2004.construction_properties.json +18432 -3072
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/data/ashrae_90_1_2007.boilers.json +26 -0
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/data/ashrae_90_1_2007.construction_properties.json +8532 -1422
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/data/ashrae_90_1_2010.boilers.json +26 -0
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/data/ashrae_90_1_2010.construction_properties.json +8532 -1422
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.boilers.json +16 -0
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.computer_room_acs.json +30 -30
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.construction_properties.json +7560 -1260
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.PumpVariableSpeed.rb +1 -2
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/data/ashrae_90_1_2016.boilers.json +16 -0
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/data/ashrae_90_1_2016.construction_properties.json +7560 -1260
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.AirLoopHVAC.rb +3 -3
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.PumpVariableSpeed.rb +1 -2
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/data/ashrae_90_1_2019.boilers.json +22 -0
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/data/ashrae_90_1_2019.construction_properties.json +7236 -1206
- data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/data/ashrae_90_1_2019.furnaces.json +223 -19
- data/lib/openstudio-standards/standards/ashrae_90_1/data/ashrae_90_1.schedules.json +37 -1
- data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.boilers.json +3 -0
- data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.construction_properties.json +6900 -1150
- data/lib/openstudio-standards/standards/cbes/data/cbes.schedules.json +1 -1
- data/lib/openstudio-standards/standards/deer/data/deer.schedules.json +1 -1
- data/lib/openstudio-standards/standards/necb/BTAP1980TO2010/data/surface_thermal_transmittance.json +76 -40
- data/lib/openstudio-standards/standards/necb/BTAPPRE1980/data/surface_thermal_transmittance.json +76 -40
- data/lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb +6 -4
- data/lib/openstudio-standards/standards/necb/NECB2011/NECB2011_QAQC.json +2988 -0
- data/lib/openstudio-standards/standards/necb/NECB2011/autozone.rb +25 -3
- data/lib/openstudio-standards/standards/necb/NECB2011/building_envelope.rb +672 -534
- data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/Hospital.osm +1791 -1792
- data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/LEEPMultiTower.osm +7 -1
- data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/LEEPTownHouse.osm +7 -1
- data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/LargeHotel.osm +5 -6
- data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/LargeOffice.osm +8 -9
- data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/NorthernEducation.osm +10 -4
- data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/NorthernHealthCare.osm +14 -15
- data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/Outpatient.osm +7 -1
- data/lib/openstudio-standards/standards/necb/NECB2011/data/surface_thermal_transmittance.json +76 -40
- data/lib/openstudio-standards/standards/necb/NECB2011/hvac_systems.rb +14 -6
- data/lib/openstudio-standards/standards/necb/NECB2011/necb_2011.rb +542 -130
- data/lib/openstudio-standards/standards/necb/NECB2011/qaqc/necb_qaqc.rb +30 -63
- data/lib/openstudio-standards/standards/necb/NECB2011/service_water_heating.rb +7 -2
- data/lib/openstudio-standards/standards/necb/NECB2015/data/surface_thermal_transmittance.json +90 -0
- data/lib/openstudio-standards/standards/necb/NECB2015/necb_2015.rb +8 -6
- data/lib/openstudio-standards/standards/necb/NECB2017/data/surface_thermal_transmittance.json +76 -40
- data/lib/openstudio-standards/standards/necb/NECB2017/necb_2017.rb +2 -1
- data/lib/openstudio-standards/standards/necb/NECB2020/building_envelope.rb +0 -117
- data/lib/openstudio-standards/standards/necb/NECB2020/data/surface_thermal_transmittance.json +76 -45
- data/lib/openstudio-standards/standards/necb/NECB2020/necb_2020.rb +218 -0
- data/lib/openstudio-standards/standards/necb/common/construction_defaults.osm +12 -7
- data/lib/openstudio-standards/standards/standard.rb +1 -1
- data/lib/openstudio-standards/version.rb +1 -1
- data/lib/openstudio-standards.rb +9 -4
- metadata +59 -66
- data/data/inventory/thermal_bridging.csv +0 -90
- data/data/standards/OpenStudio_Standards-ashrae_90_1-ALL-comstock(space_types).xlsx +0 -0
- data/data/standards/openstudio_standards_duplicates_log.csv +0 -7962
- data/lib/openstudio-standards/btap/NECB_building_types.csv +0 -35
- data/lib/openstudio-standards/btap/NECB_space_types.csv +0 -109
- data/lib/openstudio-standards/btap/WeatherData1.json +0 -2110
- data/lib/openstudio-standards/btap/WeatherData1.xlsx +0 -0
- data/lib/openstudio-standards/btap/btap_result.rb +0 -1144
- data/lib/openstudio-standards/btap/btap_test_helper.rb +0 -86
- data/lib/openstudio-standards/btap/common_paths.rb +0 -81
- data/lib/openstudio-standards/btap/common_resources/ConstructionProperties.csv +0 -52
- data/lib/openstudio-standards/btap/common_resources/Constructions.csv +0 -37
- data/lib/openstudio-standards/btap/common_resources/construction_sets.csv +0 -1270
- data/lib/openstudio-standards/btap/common_resources/constructions_glazing.csv +0 -121
- data/lib/openstudio-standards/btap/common_resources/constructions_opaque.csv +0 -2256
- data/lib/openstudio-standards/btap/common_resources/costs.csv +0 -1897
- data/lib/openstudio-standards/btap/common_resources/costs_local_factors.csv +0 -2315
- data/lib/openstudio-standards/btap/common_resources/materials_glazing.csv +0 -35
- data/lib/openstudio-standards/btap/common_resources/materials_opaque.csv +0 -164
- data/lib/openstudio-standards/btap/costing/btap_measure_helper.rb +0 -359
- data/lib/openstudio-standards/btap/costing/btap_workflow.rb +0 -117
- data/lib/openstudio-standards/btap/costing/copy_test_results_files_to_expected_results.rb +0 -11
- data/lib/openstudio-standards/btap/costing/cost_building_from_file.rb +0 -136
- data/lib/openstudio-standards/btap/costing/costing_database_wrapper.rb +0 -173
- data/lib/openstudio-standards/btap/costing/dummy.epw +0 -8768
- data/lib/openstudio-standards/btap/costing/dummy.osm +0 -5320
- data/lib/openstudio-standards/btap/costing/neb_end_use_prices.csv +0 -42
- data/lib/openstudio-standards/btap/costing/necb_2011_spacetype_info.csv +0 -225
- data/lib/openstudio-standards/btap/costing/necb_reference_runs.csv +0 -28705
- data/lib/openstudio-standards/btap/costing/parallel_tests.rb +0 -92
- data/lib/openstudio-standards/btap/costing/test_list.txt +0 -15
- data/lib/openstudio-standards/btap/costing/test_run_all_test_locally.rb +0 -27
- data/lib/openstudio-standards/btap/costing/test_run_costing_tests.rb +0 -80
- data/lib/openstudio-standards/btap/necb_2011_spacetype_info.csv +0 -225
- data/lib/openstudio-standards/btap/utilities/Add_template_field_to_json.rb +0 -22
- data/lib/openstudio-standards/btap/utilities/convert_surfaces_to_adiabatic_necb_8426.rb +0 -204
- data/lib/openstudio-standards/btap/utilities/generate_space_types.rb +0 -8
- data/lib/openstudio-standards/btap/utilities/necb_to_epw_map.rb +0 -50
- data/lib/openstudio-standards/btap/utilities/os_sim_extract.rb +0 -48
- data/lib/openstudio-standards/btap/utilities/rename_surfaces.rb +0 -24
- data/lib/openstudio-standards/btap/utilities/round_surf_coords.rb +0 -32
- data/lib/openstudio-standards/btap/utilities/sched_create.rb +0 -145
- data/lib/openstudio-standards/btap/utilities/set_mult_to_adiabatic.rb +0 -53
- data/lib/openstudio-standards/btap/utilities/space_type.rb +0 -78
- data/lib/openstudio-standards/btap/utilities/weatherData1_xlsx_to_json.rb +0 -56
- data/lib/openstudio-standards/btap/vintagizer.rb +0 -161
- data/lib/openstudio-standards/btap/visualization.rb +0 -72
- data/lib/openstudio-standards/standards/necb/NECB2011/data/necb_2011_spacetype_info.csv +0 -225
- data/lib/openstudio-standards/standards/necb/common/btap_analysis.rb +0 -79
- data/lib/openstudio-standards/standards/necb/common/btap_data.rb +0 -2656
- data/lib/openstudio-standards/standards/necb/common/btap_datapoint.rb +0 -653
- data/lib/openstudio-standards/standards/necb/common/necb_reference_runs.csv +0 -28705
- data/lib/openstudio-standards/standards/necb/common/utility_pricing_2025-02-20.csv +0 -92
- /data/lib/openstudio-standards/btap/{common_resources → common}/carbon_frame.csv +0 -0
- /data/lib/openstudio-standards/btap/{common_resources → common}/carbon_glazing.csv +0 -0
- /data/lib/openstudio-standards/btap/{common_resources → common}/carbon_opaque.csv +0 -0
- /data/lib/openstudio-standards/btap/{common_resources → common}/hvac_vent_ahu.csv +0 -0
- /data/lib/openstudio-standards/btap/{common_resources → common}/lighting.csv +0 -0
- /data/lib/openstudio-standards/btap/{common_resources → common}/lighting_sets.csv +0 -0
- /data/lib/openstudio-standards/btap/{common_resources → common}/locations.csv +0 -0
- /data/lib/openstudio-standards/btap/{costing → common}/mech_sizing.json +0 -0
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
require_relative 'minitest_helper'
|
|
2
|
-
require_relative 'create_doe_prototype_helper'
|
|
3
|
-
require 'json'
|
|
4
|
-
|
|
5
|
-
$LOAD_PATH.unshift File.expand_path('../../../openstudio-standards/lib', __dir__)
|
|
6
|
-
def run_dir(test_name)
|
|
7
|
-
# always generate test output in specially named 'output' directory so result files are not made part of the measure
|
|
8
|
-
"#{File.dirname(__FILE__)}/output/#{test_name}"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def model_out_path(test_name)
|
|
12
|
-
"#{run_dir(test_name)}/ExampleModel.osm"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def workspace_path(test_name)
|
|
16
|
-
"#{run_dir(test_name)}/ModelToIdf/in.idf"
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def sql_path(test_name)
|
|
20
|
-
"#{run_dir(test_name)}/ModelToIdf/EnergyPlusPreProcess-0/EnergyPlus-0/eplusout.sql"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def report_path(test_name)
|
|
24
|
-
"#{run_dir(test_name)}/report.html"
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def calculate_max_delta_t(adj_DaySchedule, cur_DaySchedule)
|
|
28
|
-
max = -999
|
|
29
|
-
# #if either one of schedule does not exist then it will return the max of the existing schedule
|
|
30
|
-
# if adj_DaySchedule.nil?
|
|
31
|
-
# 0.upto(23) do |hour|
|
|
32
|
-
# time = OpenStudio::Time.new(0,hour,0,0)
|
|
33
|
-
# max = cur_DaySchedule.getValue(time) if cur_DaySchedule.getValue(time) > max
|
|
34
|
-
# end
|
|
35
|
-
# elsif cur_DaySchedule.nil?
|
|
36
|
-
# 0.upto(23) do |hour|
|
|
37
|
-
# time = OpenStudio::Time.new(0,hour,0,0)
|
|
38
|
-
# max = adj_DaySchedule.getValue(time) if adj_DaySchedule.getValue(time) > max
|
|
39
|
-
# end
|
|
40
|
-
# elsif (cur_DaySchedule.nil? and cur_DaySchedule.nil?)
|
|
41
|
-
# return nil
|
|
42
|
-
# end
|
|
43
|
-
if cur_DaySchedule.nil? || adj_DaySchedule.nil?
|
|
44
|
-
raise 'cur_DaySchedule or adj_DaySchedule is nil'
|
|
45
|
-
return nil
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
0.upto(23) do |hour|
|
|
49
|
-
time = OpenStudio::Time.new(0, hour, 0, 0)
|
|
50
|
-
difference = (cur_DaySchedule.getValue(time) - adj_DaySchedule.getValue(time)).abs
|
|
51
|
-
max = difference if difference > max
|
|
52
|
-
end
|
|
53
|
-
return max
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# returns -999 if current surface does not have heating OR cooling schedule
|
|
57
|
-
# returns -997 if all adjacent surfaces does not have BOTH heating AND cooling
|
|
58
|
-
# returns nil if the surface does not have adjacent surface
|
|
59
|
-
def get_schedule_max_delta_t(model, surface)
|
|
60
|
-
# find spaces that share that surface.
|
|
61
|
-
# load the schedules for every day type of the year. for both spaces. If the space is does not have a heating schedule..assume the temperature is the -10C always for now.
|
|
62
|
-
# iterate through every hour. and determine delta T
|
|
63
|
-
# Store the max delta T.
|
|
64
|
-
# end iteration
|
|
65
|
-
# return max deltaT
|
|
66
|
-
cur_space = nil
|
|
67
|
-
delta_t = -998
|
|
68
|
-
adjacent_surface_found = false
|
|
69
|
-
atleast_one_adjacent_surface_has_schedule = false
|
|
70
|
-
model.getSpaces.each do |space|
|
|
71
|
-
if space == surface.space.get
|
|
72
|
-
cur_space = space
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
if cur_space.nil?
|
|
76
|
-
raise "Surface: [#{surface.name}] does not belong to any space"
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
model.getSpaces.each do |space|
|
|
80
|
-
if space == surface.space.get
|
|
81
|
-
next
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
space.surfaces.each do |surf|
|
|
85
|
-
unless surf.adjacentSurface.empty?
|
|
86
|
-
adj_surface = surf.adjacentSurface.get
|
|
87
|
-
if adj_surface == surface
|
|
88
|
-
adjacent_surface_found = true
|
|
89
|
-
unless space.thermalZone.empty?
|
|
90
|
-
adj_surface_thermal_zone = space.thermalZone.get
|
|
91
|
-
cur_surface_thermal_zone = cur_space.thermalZone.get
|
|
92
|
-
unless adj_surface_thermal_zone.thermostatSetpointDualSetpoint.empty?
|
|
93
|
-
adj_thermostat = adj_surface_thermal_zone.thermostatSetpointDualSetpoint.get
|
|
94
|
-
cur_thermostat = cur_surface_thermal_zone.thermostatSetpointDualSetpoint.get
|
|
95
|
-
# if current surface does not have a thermostat schedule, then it will return -999 instead of nil because nil is reserved for surfaces without adjacent surface
|
|
96
|
-
if cur_thermostat.getHeatingSchedule.empty? || cur_thermostat.getCoolingSchedule.empty?
|
|
97
|
-
return -999
|
|
98
|
-
end
|
|
99
|
-
# after this point current surface should have BOTH heating and cooling schedule
|
|
100
|
-
# if adjacent surface does not have a heating OR cooling schedule it will be skipped
|
|
101
|
-
if adj_thermostat.getHeatingSchedule.empty? || adj_thermostat.getCoolingSchedule.empty?
|
|
102
|
-
next
|
|
103
|
-
else
|
|
104
|
-
atleast_one_adjacent_surface_has_schedule = true
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
startDate = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(1), 1, 2009)
|
|
108
|
-
endDate = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(1), 7, 2009)
|
|
109
|
-
|
|
110
|
-
adj_surface_heating_day_schedule_array = adj_thermostat.getHeatingSchedule.get.to_ScheduleRuleset.get.getDaySchedules(startDate, endDate) unless adj_thermostat.getHeatingSchedule.empty?
|
|
111
|
-
adj_surface_cooling_day_schedule_array = adj_thermostat.getCoolingSchedule.get.to_ScheduleRuleset.get.getDaySchedules(startDate, endDate) unless adj_thermostat.getCoolingSchedule.empty?
|
|
112
|
-
cur_surface_heating_day_schedule_array = cur_thermostat.getHeatingSchedule.get.to_ScheduleRuleset.get.getDaySchedules(startDate, endDate) unless cur_thermostat.getHeatingSchedule.empty?
|
|
113
|
-
cur_surface_cooling_day_schedule_array = cur_thermostat.getCoolingSchedule.get.to_ScheduleRuleset.get.getDaySchedules(startDate, endDate) unless cur_thermostat.getCoolingSchedule.empty?
|
|
114
|
-
delta_t = -998
|
|
115
|
-
heating_delta_t = []
|
|
116
|
-
cooling_delta_t = []
|
|
117
|
-
1.upto(7) do |i|
|
|
118
|
-
puts 'mee mee mee'
|
|
119
|
-
puts calculate_max_delta_t(adj_surface_heating_day_schedule_array[i - 1], cur_surface_heating_day_schedule_array[i - 1])
|
|
120
|
-
heating_delta_t << calculate_max_delta_t(adj_surface_heating_day_schedule_array[i - 1], cur_surface_heating_day_schedule_array[i - 1])
|
|
121
|
-
cooling_delta_t << calculate_max_delta_t(adj_surface_cooling_day_schedule_array[i - 1], cur_surface_cooling_day_schedule_array[i - 1])
|
|
122
|
-
end
|
|
123
|
-
delta_t = [heating_delta_t.max, cooling_delta_t.max].max
|
|
124
|
-
puts "delta_t: #{delta_t}"
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
# adjacent_surface_found ? (atleast_one_adjacent_surface_has_schedule ? (return delta_t) : (return -997)) : (return nil)
|
|
132
|
-
if adjacent_surface_found
|
|
133
|
-
if atleast_one_adjacent_surface_has_schedule
|
|
134
|
-
return delta_t
|
|
135
|
-
else
|
|
136
|
-
return -997
|
|
137
|
-
end
|
|
138
|
-
else
|
|
139
|
-
return nil
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
# LargeOffice
|
|
143
|
-
class TestNECBSurfaces8426Custom < CreateDOEPrototypeBuildingTest
|
|
144
|
-
building_types = [
|
|
145
|
-
'LargeOffice',
|
|
146
|
-
'LargeHotel',
|
|
147
|
-
'FullServiceRestaurant',
|
|
148
|
-
'Outpatient',
|
|
149
|
-
'PrimarySchool'
|
|
150
|
-
]
|
|
151
|
-
|
|
152
|
-
templates = ['NECB 2011']
|
|
153
|
-
climate_zones = ['NECB HDD Method']
|
|
154
|
-
epw_files = [
|
|
155
|
-
# 'CAN_BC_Vancouver.718920_CWEC.epw',# CZ 5 - Gas HDD = 3019
|
|
156
|
-
# 'CAN_ON_Toronto.716240_CWEC.epw', #CZ 6 - Gas HDD = 4088
|
|
157
|
-
# 'CAN_PQ_Sherbrooke.716100_CWEC.epw', #CZ 7a - Electric HDD = 5068
|
|
158
|
-
# 'CAN_YT_Whitehorse.719640_CWEC.epw', #CZ 7b - FuelOil1 HDD = 6946
|
|
159
|
-
# 'CAN_NU_Resolute.719240_CWEC.epw', # CZ 8 -FuelOil2 HDD = 12570
|
|
160
|
-
# 'CAN_BC_Prince.George.718960_CWEC.epw',
|
|
161
|
-
'CAN_QC_Montreal.Intl.AP.716270_CWEC2020.epw'
|
|
162
|
-
]
|
|
163
|
-
building_types.each do |building|
|
|
164
|
-
epw_files.each do |weather|
|
|
165
|
-
hash = {}
|
|
166
|
-
test_name = "#{building}_#{weather}"
|
|
167
|
-
unless File.exist?(run_dir(test_name))
|
|
168
|
-
FileUtils.mkdir_p(run_dir(test_name))
|
|
169
|
-
end
|
|
170
|
-
# assert(File.exist?(run_dir(test_name)))
|
|
171
|
-
|
|
172
|
-
if File.exist?(report_path(test_name))
|
|
173
|
-
FileUtils.rm(report_path(test_name))
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
# assert(File.exist?(model_in_path))
|
|
177
|
-
|
|
178
|
-
if File.exist?(model_out_path(test_name))
|
|
179
|
-
FileUtils.rm(model_out_path(test_name))
|
|
180
|
-
end
|
|
181
|
-
output_folder = "#{File.dirname(__FILE__)}/output/#{test_name}"
|
|
182
|
-
model = OpenStudio::Model::Model.new
|
|
183
|
-
model.create_prototype_building(building, 'NECB 2011', 'NECB HDD Method', weather, output_folder)
|
|
184
|
-
weather_file_path = OpenstudioStandards::Weather.get_standards_weather_file_path(weather)
|
|
185
|
-
OpenstudioStandards::Weather.model_set_building_location(model, weather_file_path: weather_file_path)
|
|
186
|
-
model.getSpaces.each do |space|
|
|
187
|
-
# puts space.name
|
|
188
|
-
hash[:"Space: #{space.name}"] = {}
|
|
189
|
-
hash[:"Space: #{space.name}"][:"With Adjacent Surface"] = {}
|
|
190
|
-
hash[:"Space: #{space.name}"][:"No Adjacent surface"] = []
|
|
191
|
-
space.surfaces.each do |surface|
|
|
192
|
-
max_delta_t = get_schedule_max_delta_t(model, surface)
|
|
193
|
-
if max_delta_t.nil?
|
|
194
|
-
hash[:"Space: #{space.name}"][:"No Adjacent surface"] << surface.name
|
|
195
|
-
else
|
|
196
|
-
hash[:"Space: #{space.name}"][:"With Adjacent Surface"][:"#{surface.name}"] = max_delta_t
|
|
197
|
-
end
|
|
198
|
-
end
|
|
199
|
-
end
|
|
200
|
-
# model.save(model_out_path(test_name), true)
|
|
201
|
-
File.open("#{output_folder}/max_delta_t.json", 'w') { |f| f.write(JSON.pretty_generate(hash)) }
|
|
202
|
-
end
|
|
203
|
-
end
|
|
204
|
-
end
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
require_relative '../../../test/helpers/minitest_helper'
|
|
2
|
-
require_relative '../../../test/helpers/create_doe_prototype_helper'
|
|
3
|
-
|
|
4
|
-
['NECB2011', 'NECB2015'].each do |template|
|
|
5
|
-
model = OpenStudio::Model::Model.new
|
|
6
|
-
Standard.build(template).add_all_spacetypes_to_model(model)
|
|
7
|
-
BTAP::FileIO.save_osm(model, File.join(File.dirname(__FILE__), 'output', "#{template}_space_types.osm"))
|
|
8
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
def distance(loc1, loc2)
|
|
4
|
-
rad_per_deg = Math::PI / 180 # PI / 180
|
|
5
|
-
rkm = 6371 # Earth radius in kilometers
|
|
6
|
-
rm = rkm * 1000 # Radius in meters
|
|
7
|
-
|
|
8
|
-
dlat_rad = (loc2[0] - loc1[0]) * rad_per_deg # Delta, converted to rad
|
|
9
|
-
dlon_rad = (loc2[1] - loc1[1]) * rad_per_deg
|
|
10
|
-
|
|
11
|
-
lat1_rad, lon1_rad = loc1.map { |i| i * rad_per_deg }
|
|
12
|
-
lat2_rad, lon2_rad = loc2.map { |i| i * rad_per_deg }
|
|
13
|
-
|
|
14
|
-
a = Math.sin(dlat_rad / 2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad / 2)**2
|
|
15
|
-
c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
|
|
16
|
-
rm * c # Delta in meters
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
array_of_hashes = []
|
|
20
|
-
necb_data_file_path = "#{File.dirname(__FILE__)}/../standards/necb/NECB2011/data/necb_2015_table_c1.json"
|
|
21
|
-
epw_data_file_path = "#{File.dirname(__FILE__)}/../standards/necb/NECB2011/data/epw_data.json"
|
|
22
|
-
JSON.parse(File.read(epw_data_file_path)).each do |epw|
|
|
23
|
-
epw['necb_tbl_c_city'] = nil
|
|
24
|
-
epw['necb_tbl_c_prov'] = nil
|
|
25
|
-
min_distance = 100000000000000.0
|
|
26
|
-
necb_closest = nil
|
|
27
|
-
JSON.parse(File.read(necb_data_file_path))['necb_2015_table_c1']['table'].each do |necb|
|
|
28
|
-
next if necb['lat_long'].nil?
|
|
29
|
-
|
|
30
|
-
d = distance([epw['latitude'].to_f, epw['longitude']], necb['lat_long'])
|
|
31
|
-
if min_distance > d
|
|
32
|
-
min_distance = d
|
|
33
|
-
necb_closest = necb
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
array_of_hashes << { 'epw_file' => epw['file'],
|
|
37
|
-
'necb_location' => "#{necb_closest['city']},#{necb_closest['province']}",
|
|
38
|
-
'hdd_difference' => (epw['hdd18'].to_f - necb_closest['degree_days_below_18_c'].to_f),
|
|
39
|
-
'distance_km' => format('%.2f', (min_distance / 1000.0)),
|
|
40
|
-
'hdd18' => necb_closest['degree_days_below_18_c'] }
|
|
41
|
-
end
|
|
42
|
-
File.write("#{File.dirname(__FILE__)}/../standards/necb/NECB2011/data/epw_file_to_necb_hdd_map.json", JSON.pretty_generate(array_of_hashes))
|
|
43
|
-
|
|
44
|
-
# Load NECB Table c
|
|
45
|
-
# Create new EPW to NECB Map
|
|
46
|
-
# iterate thourgh EPW files.
|
|
47
|
-
# Iterate THrough NECB Locations
|
|
48
|
-
# Update distance if distance is less than stored distance.
|
|
49
|
-
# End NECB iteration
|
|
50
|
-
# End EPW Iteration
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
class OS_sim_extract
|
|
4
|
-
# Name of file you want to add template fields to:
|
|
5
|
-
in_json_file = './simulations.json'
|
|
6
|
-
# Name of file you want this script to produce:
|
|
7
|
-
out_json_file = './simulations_out.json'
|
|
8
|
-
output_array = []
|
|
9
|
-
file = File.read(in_json_file)
|
|
10
|
-
data_tables = JSON.parse(file)
|
|
11
|
-
data_tables.each do |data_table|
|
|
12
|
-
building_type = nil
|
|
13
|
-
template_version = nil
|
|
14
|
-
area_scale_factor = nil
|
|
15
|
-
epw_file = nil
|
|
16
|
-
outdoor_air = false
|
|
17
|
-
data_table['measures'].each do |measure|
|
|
18
|
-
if measure['name'] == 'btap_create_necb_prototype_building_scale'
|
|
19
|
-
building_type = measure['arguments']['building_type']
|
|
20
|
-
template_version = measure['arguments']['template']
|
|
21
|
-
area_scale_factor = measure['arguments']['area_scale_factor']
|
|
22
|
-
epw_file = measure['arguments']['epw_file']
|
|
23
|
-
elsif measure['display_name'] == 'BTAPIdealAirLoadsOptionsEplus'
|
|
24
|
-
outdoor_air = true
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
extract_hash = {
|
|
28
|
-
conditioned_floor_area: data_table['building']['conditioned_floor_area_m2'],
|
|
29
|
-
exterior_area: data_table['building']['exterior_area_m2'],
|
|
30
|
-
volume: data_table['building']['volume'],
|
|
31
|
-
hdd: data_table['geography']['hdd'],
|
|
32
|
-
cdd: data_table['geography']['cdd'],
|
|
33
|
-
heating_gj: data_table['end_uses']['heating_gj'],
|
|
34
|
-
cooling_gj: data_table['end_uses']['cooling_gj'],
|
|
35
|
-
ep_conditioned_floor_area_m2: data_table['code_metrics']['ep_conditioned_floor_area_m2'],
|
|
36
|
-
os_conditioned_floor_area_m2: data_table['code_metrics']['os_conditioned_floor_area_m2'],
|
|
37
|
-
building_tedi_gj_per_m2: data_table['code_metrics']['building_tedi_gj_per_m2'],
|
|
38
|
-
building_medi_gj_per_m2: data_table['code_metrics']['building_medi_gj_per_m2'],
|
|
39
|
-
building_type: building_type,
|
|
40
|
-
template_version: template_version,
|
|
41
|
-
epw_file: epw_file,
|
|
42
|
-
area_scale_factor: area_scale_factor,
|
|
43
|
-
outdoor_air: outdoor_air
|
|
44
|
-
}
|
|
45
|
-
output_array << extract_hash
|
|
46
|
-
end
|
|
47
|
-
File.open(out_json_file, 'w') { |each_file| each_file.write(JSON.pretty_generate(output_array)) }
|
|
48
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
require 'openstudio'
|
|
2
|
-
require_relative '../../openstudio-standards/btap/btap'
|
|
3
|
-
require_relative '../../openstudio-standards/btap/fileio'
|
|
4
|
-
|
|
5
|
-
puts "\nenter osm file name (without file extension):\n"
|
|
6
|
-
# osm_infile_name = gets.chomp
|
|
7
|
-
osm_infile_name = 'NECB2011Hospital'
|
|
8
|
-
osm_outfile_name = osm_infile_name.to_s + '_updated.osm'
|
|
9
|
-
|
|
10
|
-
model = BTAP::FileIO.safe_load_model("#{osm_infile_name}.osm")
|
|
11
|
-
|
|
12
|
-
spaces = model.getSpaces
|
|
13
|
-
|
|
14
|
-
spaces.each do |space|
|
|
15
|
-
surfaces = space.surfaces()
|
|
16
|
-
surfaces.each_with_index do |surface, index|
|
|
17
|
-
name = "#{space.nameString}-#{index}-#{surface.surfaceType}"
|
|
18
|
-
puts name
|
|
19
|
-
surface.setName(name)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
osm_path = OpenStudio::Path.new(osm_outfile_name.to_s)
|
|
24
|
-
model.save(osm_path, true)
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require 'openstudio'
|
|
2
|
-
require_relative '../../openstudio-standards/btap/btap'
|
|
3
|
-
require_relative '../../openstudio-standards/btap/fileio'
|
|
4
|
-
|
|
5
|
-
puts "\nenter osm file name (without file extension):\n"
|
|
6
|
-
osm_infile_name = gets.chomp
|
|
7
|
-
osm_outfile_name = osm_infile_name.to_s + '_updated.osm'
|
|
8
|
-
|
|
9
|
-
model = BTAP::FileIO.safe_load_model("#{osm_infile_name}.osm")
|
|
10
|
-
|
|
11
|
-
surfaces = model.getSurfaces
|
|
12
|
-
|
|
13
|
-
surfaces.each do |surface|
|
|
14
|
-
# rem_surf = ['Surface 14', 'Surface 16', 'Surface 75', 'Surface 46']
|
|
15
|
-
# if rem_surf.include?(surface.name.to_s)
|
|
16
|
-
# surface.remove()
|
|
17
|
-
# next
|
|
18
|
-
# end
|
|
19
|
-
vertex_hash = []
|
|
20
|
-
surface.vertices.each_with_index do |vertex, index|
|
|
21
|
-
old = vertex
|
|
22
|
-
vertex_hash << OpenStudio::Point3d.new(format('%.4f', old.x).to_f, format('%.4f', old.y).to_f, format('%.4f', old.z).to_f)
|
|
23
|
-
# sprintf('%.4f', old.x.round(4))
|
|
24
|
-
# puts new_vertex
|
|
25
|
-
end
|
|
26
|
-
# puts vertex_hash.join()
|
|
27
|
-
surface.setVertices(vertex_hash)
|
|
28
|
-
# puts "\n\n\n\n"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
osm_path = OpenStudio::Path.new(osm_outfile_name.to_s)
|
|
32
|
-
model.save(osm_path, true)
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# Utility which takes schedules from the NECB 2015 tables spreadsheet and puts them into a JSON file which somewhat
|
|
2
|
-
# matches the NECB 2011 schedules.json file.
|
|
3
|
-
|
|
4
|
-
require 'rubyXL'
|
|
5
|
-
require 'json'
|
|
6
|
-
|
|
7
|
-
class Sched_create
|
|
8
|
-
# Set a bunch of variables which generally remain static and are added to the new schedulesNECB2015.json file because
|
|
9
|
-
# that was how they were in the NECB2011 schedules.json file.
|
|
10
|
-
|
|
11
|
-
template = 'NECB2015'
|
|
12
|
-
name = 'NECB-'
|
|
13
|
-
name_pre_mod = ['', '', '-Electric', '', '', '', '']
|
|
14
|
-
name_post_mod = ['', '', '', '', '-Cooling', '-Heating', '']
|
|
15
|
-
category = ['Occupancy', 'Lighting', 'Equipment', 'Fan', 'Thermostat Setpoint', 'Thermostat Setpoint', 'Service Water Heating']
|
|
16
|
-
units = ['FRACTION', 'FRACTION', 'FRACTION', 'ON_OFF', 'TEMPERATURE', 'TEMPERATURE', 'FRACTION']
|
|
17
|
-
day_types = ['Default|Wkdy', 'Sat', 'Sun|Hol']
|
|
18
|
-
start_date = '2014-01-01T00:00:00+00:00'
|
|
19
|
-
end_date = '2014-12-31T00:00:00+00:00'
|
|
20
|
-
type = 'Hourly'
|
|
21
|
-
notes = nil
|
|
22
|
-
table_array = []
|
|
23
|
-
entry_array = []
|
|
24
|
-
json_array = []
|
|
25
|
-
refs = ['assumption']
|
|
26
|
-
|
|
27
|
-
# Open Excel file containing schdeules and look for the schedlues worksheet.
|
|
28
|
-
|
|
29
|
-
workbook = RubyXL::Parser.parse('./NECB2015_tables-171121.xlsx')
|
|
30
|
-
worksheet = workbook['A-8.4.3.2.(1)']
|
|
31
|
-
|
|
32
|
-
# Determine how many rows are used in the schedules worksheet. Had to do this because there were some nil lines
|
|
33
|
-
# between each schedule in the worksheet. This would cause the .each do command to break early.
|
|
34
|
-
|
|
35
|
-
sheetlength = worksheet.dimension.ref.row_range.end
|
|
36
|
-
table_index = 0
|
|
37
|
-
|
|
38
|
-
# Start looping through each schedule in the worksheet. RubyXL reads a few lines after the end of the schedules in
|
|
39
|
-
# the worksheet. The -32 is there to make sure that there is actually another schedule (or enough room for one) in
|
|
40
|
-
# the worksheet thus preventing errors due to manipulating nulls.
|
|
41
|
-
|
|
42
|
-
while table_index < (sheetlength - 32)
|
|
43
|
-
curr_loc = 5
|
|
44
|
-
cat_index = 0
|
|
45
|
-
|
|
46
|
-
# Loop through each category defined above (order of categories should match how they are presented in the worksheet).
|
|
47
|
-
|
|
48
|
-
category.each_with_index do |cat, cat_index|
|
|
49
|
-
# Build the schedule name using the category and some prefixes and suffixes because the nomenclature was not
|
|
50
|
-
# consistent. Mostly trying to match what is in the NECB2011 schedules.json file.
|
|
51
|
-
|
|
52
|
-
table_name = name + worksheet[table_index + 1][0].value.to_s[-1] + name_pre_mod[cat_index] + '-' + cat + name_post_mod[cat_index]
|
|
53
|
-
|
|
54
|
-
# Loop through each day type: Weekdays/default, Saturdays, and Sundays/holidays.
|
|
55
|
-
|
|
56
|
-
day_types.each do |day_type|
|
|
57
|
-
line_values = []
|
|
58
|
-
values = []
|
|
59
|
-
|
|
60
|
-
# Need special if statements to handle Fans which are "On" and "Off" in the workbook but BTAP represents as 1 and 0.
|
|
61
|
-
# Also need to handle when cooling is "off" in the workbook but which BTAP represents as setting the setpoint
|
|
62
|
-
# really high. The normal case (just a fraction) is at the end
|
|
63
|
-
|
|
64
|
-
if cat == 'Fan'
|
|
65
|
-
worksheet[table_index + curr_loc].cells.drop(1).each do |fan_val|
|
|
66
|
-
if fan_val.value == 'On'
|
|
67
|
-
line_values << 1.0
|
|
68
|
-
else
|
|
69
|
-
line_values << 0.0
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
elsif name_post_mod[cat_index] == '-Cooling'
|
|
73
|
-
worksheet[table_index + curr_loc].cells.drop(1).each do |cool_val|
|
|
74
|
-
if cool_val.value == 'Off'
|
|
75
|
-
line_values << 35
|
|
76
|
-
else
|
|
77
|
-
line_values << cool_val.value
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
else
|
|
81
|
-
worksheet[table_index + curr_loc].cells.drop(1).each { |col_ref| line_values << col_ref.value }
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
# The workbook lists the schedules started at 1:00 am and ending at 12:00 am (not sure why). OpenStudio
|
|
85
|
-
# schedules start at 12:00 am and end at 11:00 pm (which makes more sense to me). I'm not sure if the to_f
|
|
86
|
-
# statements need to be there but I added them anyway so all of the values in the .json file would be to at
|
|
87
|
-
# least 1 decimal place (like the originial NECB2011 schedules.json file).
|
|
88
|
-
|
|
89
|
-
values << line_values[23].to_f
|
|
90
|
-
line_values.each { |ln_value| values << ln_value.to_f }
|
|
91
|
-
values.pop
|
|
92
|
-
|
|
93
|
-
# Put everything for this day in a hash (the order according to the original NECB2011 schedules.json file).
|
|
94
|
-
|
|
95
|
-
entry_array = {
|
|
96
|
-
'template' => template,
|
|
97
|
-
'name' => table_name,
|
|
98
|
-
'category' => cat,
|
|
99
|
-
'units' => units[cat_index],
|
|
100
|
-
'day_types' => day_type,
|
|
101
|
-
'start_date' => start_date,
|
|
102
|
-
'end_date' => end_date,
|
|
103
|
-
'type' => type,
|
|
104
|
-
'notes' => notes,
|
|
105
|
-
'values' => values
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
# Add this day's hash to all of the others (I was calling them arrays but they were hashes).
|
|
109
|
-
|
|
110
|
-
json_array << entry_array
|
|
111
|
-
|
|
112
|
-
# Go to the next line for the next day.
|
|
113
|
-
|
|
114
|
-
curr_loc += 1
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
# Go to the next line for the next category.
|
|
118
|
-
|
|
119
|
-
curr_loc += 1
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
# End of the table set the location of the next table (which starts immediately after the preceding one)
|
|
123
|
-
|
|
124
|
-
table_index += curr_loc - 1
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
# Add a few hashes to the hash containing all of the schedules in the worksheet. This is to match the formatting
|
|
128
|
-
# found in the original NECB2011 schedules.json file.
|
|
129
|
-
|
|
130
|
-
table_array = {
|
|
131
|
-
'tables' => [
|
|
132
|
-
'name' => 'schedules',
|
|
133
|
-
'data_type' => 'table',
|
|
134
|
-
'refs' => refs,
|
|
135
|
-
'table' => json_array
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
# Turn the big hash in memory into a .json format and save it to file. The pretty part is so the json file is nicely
|
|
140
|
-
# ordered and relatively easy to follow.
|
|
141
|
-
|
|
142
|
-
File.open('./schedulesNECB2015.json', 'w') do |each_file|
|
|
143
|
-
each_file.write(JSON.pretty_generate(table_array))
|
|
144
|
-
end
|
|
145
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require 'openstudio'
|
|
2
|
-
|
|
3
|
-
translator = OpenStudio::OSVersion::VersionTranslator.new
|
|
4
|
-
ospath_in = OpenStudio::Path.new('./NECB2011Hospital_4.osm')
|
|
5
|
-
ospath_out = OpenStudio::Path.new('./NECB2011Hospital_4_updated.osm')
|
|
6
|
-
model = translator.loadModel(ospath_in)
|
|
7
|
-
model = model.get
|
|
8
|
-
|
|
9
|
-
spaces = model.getSpaces
|
|
10
|
-
converted = []
|
|
11
|
-
# loop through space
|
|
12
|
-
spaces.each do |space|
|
|
13
|
-
# check for multiplier
|
|
14
|
-
if space.multiplier > 1
|
|
15
|
-
puts space.name
|
|
16
|
-
surfaces = space.surfaces
|
|
17
|
-
# get surfaces of a space
|
|
18
|
-
surfaces.each do |surface|
|
|
19
|
-
puts "\t#{surface.name}\n\t\t#{surface.outsideBoundaryCondition}"
|
|
20
|
-
# convert all surfaces except outdoors BC, and make it adabatic. if that
|
|
21
|
-
# surface has an adjacent surface, then also convert it to adiabatic
|
|
22
|
-
if surface.outsideBoundaryCondition.to_s == 'Surface'
|
|
23
|
-
if !surface.adjacentSurface.nil?
|
|
24
|
-
adj_surface = surface.adjacentSurface.get
|
|
25
|
-
adj_surface.setOutsideBoundaryCondition('Adiabatic')
|
|
26
|
-
converted << adj_surface.name
|
|
27
|
-
end
|
|
28
|
-
surface.setOutsideBoundaryCondition('Adiabatic')
|
|
29
|
-
converted << surface.name
|
|
30
|
-
# if the surface is already not adiabatic or outdoors, set the BC to adiabatic
|
|
31
|
-
elsif (surface.outsideBoundaryCondition.to_s != 'Outdoors') && (surface.outsideBoundaryCondition.to_s != 'Adiabatic')
|
|
32
|
-
surface.setOutsideBoundaryCondition('Adiabatic')
|
|
33
|
-
converted << surface.name
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# ASSUMING THAT ALL ADIABATIC SURFACES ARE NOT SUPPOSED TO BE EXPOSED TO THE WIND AND SUN
|
|
40
|
-
# set adiabatic surface's sun and wind exposure to none
|
|
41
|
-
model.getSurfaces.each do |surface|
|
|
42
|
-
if surface.outsideBoundaryCondition.to_s == 'Adiabatic'
|
|
43
|
-
surface.setWindExposure('NoWind')
|
|
44
|
-
surface.setSunExposure('NoSun')
|
|
45
|
-
converted << "#{surface.name} -- NoSun NoWind"
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
puts "\n\n"
|
|
50
|
-
puts converted
|
|
51
|
-
puts converted.length
|
|
52
|
-
|
|
53
|
-
model.save(ospath_out, true)
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
require 'minitest/autorun'
|
|
3
|
-
require 'openstudio'
|
|
4
|
-
|
|
5
|
-
# if running from openstudio-standards.. load local standards
|
|
6
|
-
os_standards_local_lib_path = '../../../lib/openstudio-standards.rb'
|
|
7
|
-
if Dir.exist?(os_standards_local_lib_path)
|
|
8
|
-
require_relative os_standards_local_lib_path
|
|
9
|
-
else
|
|
10
|
-
require 'openstudio-standards'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def read_space_types()
|
|
14
|
-
path = "/home/osdev/openstudio-standards/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/DND*.osm"
|
|
15
|
-
spacetype_list = []
|
|
16
|
-
Dir.glob(path) do |osm_file|
|
|
17
|
-
model = BTAP::FileIO::load_osm(osm_file)
|
|
18
|
-
standard = NECB2011.new()
|
|
19
|
-
model.getSpaces.each do |space|
|
|
20
|
-
unless space.spaceType.empty?
|
|
21
|
-
name = space.spaceType.get.name.get
|
|
22
|
-
bt = space.spaceType.get.standardsBuildingType.get unless space.spaceType.get.standardsBuildingType.empty?
|
|
23
|
-
st = space.spaceType.get.standardsSpaceType.get unless space.spaceType.get.standardsSpaceType.empty?
|
|
24
|
-
spacetype_list << {'name': name, 'Original-StandardsBuildingType': bt, 'Original-StandardSpaceType': st}
|
|
25
|
-
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
unique_list = spacetype_list.uniq.sort_by { |st| st[:name] }
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
CSV.open("data.csv", "wb") do |csv|
|
|
34
|
-
csv << unique_list.first.keys # adds the attributes name on the first line
|
|
35
|
-
unique_list.each do |hash|
|
|
36
|
-
csv << hash.values
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
standard_space_type_list = Standard.build('NECB2011').standards_data['space_types'].map { |space_types| {'building_type': space_types['building_type'],
|
|
41
|
-
'space_type': space_types['space_type'],
|
|
42
|
-
"necb_hvac_system_selection_type": space_types['necb_hvac_system_selection_type'],
|
|
43
|
-
"necb_schedule_type": space_types['necb_schedule_type']
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} }
|
|
47
|
-
standards_space_type_list.s
|
|
48
|
-
|
|
49
|
-
CSV.open("spacetypes.csv", "wb") do |csv|
|
|
50
|
-
csv << standard_space_type_list.first.keys # adds the attributes name on the first line
|
|
51
|
-
standard_space_type_list.each do |hash|
|
|
52
|
-
csv << hash.values
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def map_spacetypes()
|
|
58
|
-
|
|
59
|
-
map_list = CSV.open("cold_lake_map.csv", headers: :first_row).map(&:to_h)
|
|
60
|
-
path = "/home/osdev/openstudio-standards/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/DND*.osm"
|
|
61
|
-
Dir.glob(path) do |osm_file|
|
|
62
|
-
model = BTAP::FileIO::load_osm(osm_file)
|
|
63
|
-
model.getSpaceTypes.each do |st|
|
|
64
|
-
map_item = map_list.select { |item| item["Original Spacetype Name"] == st.name.get }
|
|
65
|
-
unless map_item.empty?
|
|
66
|
-
new_name = map_item.first()['New-StandardsBuildingType'].to_s + '-'+map_item.first()['New-StandardSpaceType'].to_s
|
|
67
|
-
st.setName(new_name)
|
|
68
|
-
st.setStandardsBuildingType(map_item.first()["New-StandardsBuildingType"])
|
|
69
|
-
st.setStandardsSpaceType(map_item.first()["New-StandardSpaceType"])
|
|
70
|
-
puts st
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
BTAP::FileIO::save_osm(model,File.join(__dir__,File.basename(osm_file)))
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
map_spacetypes()
|