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
|
@@ -17,111 +17,11 @@
|
|
|
17
17
|
# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18
18
|
# **********************************************************************/
|
|
19
19
|
|
|
20
|
-
require "#{File.dirname(__FILE__)}/btap"
|
|
21
|
-
|
|
22
|
-
|
|
23
20
|
module BTAP
|
|
24
21
|
module Resources #Resources
|
|
25
22
|
|
|
26
|
-
|
|
27
23
|
# This module contains methods that relate to Materials, Constructions and Construction Sets
|
|
28
|
-
|
|
29
24
|
module Schedules # BTAP::Resources::Schedules
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
#Test Schedules Module
|
|
34
|
-
if __FILE__ == $0
|
|
35
|
-
require 'test/unit'
|
|
36
|
-
class SchedulesTests < Test::Unit::TestCase
|
|
37
|
-
|
|
38
|
-
def test_create_all_schedule_types()
|
|
39
|
-
model = OpenStudio::Model::Model.new()
|
|
40
|
-
schedule_struct =
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
#Start and stop date of schedule in gregorian format.
|
|
44
|
-
["Jan-01","May-31"],
|
|
45
|
-
# Days of the week that it applies
|
|
46
|
-
["M","T","W","TH","F","S","SN"],# Days of the week are "M","T","W","TH","F","S","SN", or wild cards for weekend and weekdays "WKD","WKE"
|
|
47
|
-
# value up until the hour and minute for each block.
|
|
48
|
-
[
|
|
49
|
-
[ "9:00", 13.0], #time, value_until_this_time
|
|
50
|
-
[ "17:00", 21.0] #time, value_until_this_time
|
|
51
|
-
]
|
|
52
|
-
],
|
|
53
|
-
[
|
|
54
|
-
#Start and stop date of schedule in gregorian format.
|
|
55
|
-
["Jun-01","Sep-30"],
|
|
56
|
-
# Days of the week that it applies
|
|
57
|
-
["M","T","W","TH","F","S","SN"], # Days of the week are "M","T","W","TH","F","S","SN", or wild cards for weekend and weekdays "WKD","WKE"
|
|
58
|
-
# value up until the hour and minute for each block.
|
|
59
|
-
[
|
|
60
|
-
["24:00", 13.0] #time, value_until_this_time
|
|
61
|
-
]
|
|
62
|
-
],
|
|
63
|
-
[
|
|
64
|
-
#Period for schedule in gregorian format.
|
|
65
|
-
[ "Oct-01","Dec-31"],
|
|
66
|
-
# Days of the week that it applies
|
|
67
|
-
["M","T","W","TH","F","S","SN"], # Days of the week are "M","T","W","TH","F","S","SN", or wild cards for weekend and weekdays "WKD","WKE"
|
|
68
|
-
# value up until the hour and minute for each block.
|
|
69
|
-
[
|
|
70
|
-
[ "9:00", 1], #time, value_until_this_time
|
|
71
|
-
[ "17:00", 2] #time, value_until_this_time
|
|
72
|
-
]
|
|
73
|
-
]
|
|
74
|
-
]
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
temperature_array =
|
|
78
|
-
[
|
|
79
|
-
Array.new(24){21}, #Weekday
|
|
80
|
-
Array.new(24){21}, #Sat
|
|
81
|
-
Array.new(24){21}, #Sun
|
|
82
|
-
]
|
|
83
|
-
|
|
84
|
-
fraction_array =
|
|
85
|
-
[
|
|
86
|
-
Array.new(24){0.5}, #Weekday
|
|
87
|
-
Array.new(24){0.5}, #Sat
|
|
88
|
-
Array.new(24){0.5}, #Sun
|
|
89
|
-
]
|
|
90
|
-
|
|
91
|
-
on_off_array =
|
|
92
|
-
[
|
|
93
|
-
Array.new(24){1}, #Weekday
|
|
94
|
-
Array.new(24){0}, #Sat
|
|
95
|
-
Array.new(24){0}, #Sun
|
|
96
|
-
]
|
|
97
|
-
#Check to see if the objects were really created.
|
|
98
|
-
temperature_ruleset_sched = BTAP::Resources::Schedules::create_annual_ruleset_schedule(model,"test schedule ruleset","TEMPERATURE",temperature_array)
|
|
99
|
-
assert( !(temperature_ruleset_sched.to_ScheduleRuleset.empty?))
|
|
100
|
-
|
|
101
|
-
BTAP::Resources::Schedules::modify_schedule!(model, temperature_ruleset_sched, 0.90 , "*")
|
|
102
|
-
temperature_ruleset_sched.scheduleRules.each do |week_rule|
|
|
103
|
-
week_rule.daySchedule().values.each do |value|
|
|
104
|
-
assert_in_delta(21.0 * 0.90,value,0.000001)
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
fraction_ruleset_sched = BTAP::Resources::Schedules::create_annual_ruleset_schedule(model,"test schedule ruleset","FRACTION",fraction_array)
|
|
108
|
-
assert( !(fraction_ruleset_sched.to_ScheduleRuleset.empty?))
|
|
109
|
-
|
|
110
|
-
on_off_ruleset_sched = BTAP::Resources::Schedules::create_annual_ruleset_schedule(model,"test schedule ruleset","ON_OFF",on_off_array)
|
|
111
|
-
assert( !(on_off_ruleset_sched.to_ScheduleRuleset.empty?))
|
|
112
|
-
|
|
113
|
-
constant_ruleset_sched = BTAP::Resources::Schedules::create_annual_constant_ruleset_schedule(model,"test constant schedule","TEMPERATURE",21)
|
|
114
|
-
assert( !(constant_ruleset_sched.to_ScheduleRuleset.empty?))
|
|
115
|
-
dual_setpoint_schedule = BTAP::Resources::Schedules::create_annual_thermostat_setpoint_dual_setpoint(model,"dual setpoint test",constant_ruleset_sched,constant_ruleset_sched)
|
|
116
|
-
assert( !(dual_setpoint_schedule.to_ThermostatSetpointDualSetpoint.empty?))
|
|
117
|
-
|
|
118
|
-
detailed_ruleset_schedule = BTAP::Resources::Schedules::create_annual_ruleset_schedule_detailed(model,"test detailed schedule","FRACTION",schedule_struct )
|
|
119
|
-
assert( !(detailed_ruleset_schedule.to_ScheduleRuleset.empty?))
|
|
120
|
-
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end # End Test Schedules
|
|
124
|
-
|
|
125
25
|
module StandardScheduleTypeLimits
|
|
126
26
|
def self.get_fraction(model)
|
|
127
27
|
name = "FRACTION"
|
|
@@ -187,52 +87,14 @@ module BTAP
|
|
|
187
87
|
return temperature_schedule_type_limits.get
|
|
188
88
|
end
|
|
189
89
|
end
|
|
190
|
-
|
|
191
90
|
end
|
|
192
91
|
|
|
193
|
-
|
|
194
|
-
|
|
195
92
|
module StandardSchedules
|
|
196
|
-
|
|
197
|
-
module Fraction
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
def self.always_off(model)
|
|
201
|
-
fraction_always_off_name = "FRACTION_ALWAYS_OFF"
|
|
202
|
-
schedule = model.getScheduleRulesetByName(fraction_always_off_name)
|
|
203
|
-
if schedule.empty?
|
|
204
|
-
#create Schedule
|
|
205
|
-
return BTAP::Resources::Schedules::create_annual_constant_ruleset_schedule(
|
|
206
|
-
fraction_always_off_name,
|
|
207
|
-
"FRACTION",
|
|
208
|
-
0.0)
|
|
209
|
-
else
|
|
210
|
-
return schedule.get
|
|
211
|
-
end
|
|
212
|
-
end
|
|
213
|
-
def self.always_on(model)
|
|
214
|
-
fraction_always_on_name = "FRACTION_ALWAYS_ON"
|
|
215
|
-
schedule = model.getScheduleRulesetByName(fraction_always_on_name)
|
|
216
|
-
if schedule.empty?
|
|
217
|
-
#create Schedule
|
|
218
|
-
return BTAP::Resources::Schedules::create_annual_constant_ruleset_schedule(
|
|
219
|
-
model,
|
|
220
|
-
fraction_always_on_name,
|
|
221
|
-
"FRACTION",
|
|
222
|
-
1.0)
|
|
223
|
-
else
|
|
224
|
-
return schedule.get
|
|
225
|
-
end
|
|
226
|
-
end
|
|
227
|
-
end
|
|
228
93
|
module ON_OFF
|
|
229
|
-
|
|
230
|
-
|
|
231
94
|
def self.always_off(model)
|
|
232
|
-
on_off_always_off
|
|
95
|
+
on_off_always_off = "ON_OFF_ALWAYS_OFF"
|
|
233
96
|
schedule = model.getScheduleRulesetByName(on_off_always_off)
|
|
234
97
|
if schedule.empty?
|
|
235
|
-
#create Schedule
|
|
236
98
|
return BTAP::Resources::Schedules::create_annual_constant_ruleset_schedule(
|
|
237
99
|
model,
|
|
238
100
|
on_off_always_off,
|
|
@@ -242,285 +104,16 @@ module BTAP
|
|
|
242
104
|
return schedule.get
|
|
243
105
|
end
|
|
244
106
|
end
|
|
245
|
-
def self.always_on(model)
|
|
246
|
-
on_off_always_on = "ON_OFF_ALWAYS_ON"
|
|
247
|
-
schedule = model.getScheduleRulesetByName(on_off_always_on)
|
|
248
|
-
if schedule.empty?
|
|
249
|
-
#create Schedule
|
|
250
|
-
return BTAP::Resources::Schedules::create_annual_constant_ruleset_schedule(
|
|
251
|
-
model,
|
|
252
|
-
on_off_always_on,
|
|
253
|
-
"ON_OFF",
|
|
254
|
-
1)
|
|
255
|
-
else
|
|
256
|
-
return schedule.get
|
|
257
|
-
end
|
|
258
|
-
end
|
|
259
|
-
end
|
|
260
|
-
module Temperature
|
|
261
|
-
def self.no_heating(model)
|
|
262
|
-
no_heating = "NO_HEATING_SETPOINT"
|
|
263
|
-
schedule = model.getScheduleRulesetByName(no_heating)
|
|
264
|
-
if schedule.empty?
|
|
265
|
-
#create Schedule
|
|
266
|
-
return BTAP::Resources::Schedules::create_annual_constant_ruleset_schedule(
|
|
267
|
-
model,
|
|
268
|
-
no_heating,
|
|
269
|
-
"TEMPERATURE",
|
|
270
|
-
-200.0)
|
|
271
|
-
else
|
|
272
|
-
return schedule.get
|
|
273
|
-
end
|
|
274
|
-
end
|
|
275
|
-
def self.no_cooling(model)
|
|
276
|
-
no_cooling = "NO_COOLING_SETPOINT"
|
|
277
|
-
schedule = model.getScheduleRulesetByName(no_cooling)
|
|
278
|
-
if schedule.empty?
|
|
279
|
-
#create Schedule
|
|
280
|
-
return BTAP::Resources::Schedules::create_annual_constant_ruleset_schedule(
|
|
281
|
-
model,
|
|
282
|
-
no_cooling,
|
|
283
|
-
"TEMPERATURE",
|
|
284
|
-
200.0)
|
|
285
|
-
else
|
|
286
|
-
return schedule.get
|
|
287
|
-
end
|
|
288
|
-
end
|
|
289
|
-
def self.no_heating_cooling_dual_setpoint_schedule(model)
|
|
290
|
-
dual_setpoint_name = "FREE_FLOATING_DUAL_SETPOINT_THERMOSTAT"
|
|
291
|
-
schedule = model.getScheduleRulesetByName(dual_setpoint_name)
|
|
292
|
-
if schedule.empty?
|
|
293
|
-
#create Schedule
|
|
294
|
-
return BTAP::Resources::Schedules::create_annual_thermostat_setpoint_dual_setpoint( model, dual_setpoint_name, self.heating_setpoint_off, self.cooling_setpoint_off)
|
|
295
|
-
else
|
|
296
|
-
return schedule.getThermostatSetpointDualSetpointByName()
|
|
297
|
-
end
|
|
298
|
-
end
|
|
299
|
-
end
|
|
300
|
-
end
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
def self.remove_all_schedules(model)
|
|
304
|
-
model.getScheduleBases.sort.each { |item| item.remove }
|
|
305
|
-
end
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
def self.create_zonal_occupancy_schedule_on_off(model, thermal_zone)
|
|
309
|
-
|
|
310
|
-
model.getFanZoneExhausts.sort.each {|zfe| puts "Fan Ex:#{zfe}"}
|
|
311
|
-
|
|
312
|
-
#Create new timeseries object to keep track of on/off states. Default to 30min intervals.
|
|
313
|
-
timeseries = OpenStudio::TimeSeries.new
|
|
314
|
-
thermal_zone.spaces.sort.each do |space|
|
|
315
|
-
#Iterate through the people object in the space.
|
|
316
|
-
space.spaceType.get.people.each do |people|
|
|
317
|
-
if people.numberofPeopleSchedule.is_initialized() and people.numberofPeopleSchedule.get.to_ScheduleRuleset.is_initialized
|
|
318
|
-
#Get the occupancy schedule.
|
|
319
|
-
occ_schedule = people.numberofPeopleSchedule.get
|
|
320
|
-
#Convert schedule to timeseries and sum up timeseries objects for this space / zone.
|
|
321
|
-
occ_time_series = create_timeseries_from_schedule_ruleset(model,occ_schedule)
|
|
322
|
-
timeseries = timeseries + occ_time_series
|
|
323
|
-
end
|
|
324
|
-
end
|
|
325
|
-
end
|
|
326
|
-
#return the timeseries converted to
|
|
327
|
-
return create_schedule_variable_interval_from_time_series(model,timeseries)
|
|
328
|
-
end
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
#This method will only work with a single occupancy definition.
|
|
332
|
-
def self.set_exhaust_fans_availability_to_building_default_occ_schedule(model)
|
|
333
|
-
# get occupancy schedule if possible.
|
|
334
|
-
if model.building.get.defaultScheduleSet.is_initialized and
|
|
335
|
-
model.building.get.defaultScheduleSet.get.numberofPeopleSchedule.is_initialized and
|
|
336
|
-
model.building.get.defaultScheduleSet.get.numberofPeopleSchedule.get.to_ScheduleRuleset.is_initialized
|
|
337
|
-
occ_schedule = model.building.get.defaultScheduleSet.get.numberofPeopleSchedule.get
|
|
338
|
-
#get building default occupancy schedule.
|
|
339
|
-
model.getFanZoneExhausts.sort.each do |zfe|
|
|
340
|
-
zfe.setAvailabilitySchedule(occ_schedule)
|
|
341
|
-
zfe.setBalancedExhaustFractionSchedule(occ_schedule)
|
|
342
|
-
end
|
|
343
|
-
else
|
|
344
|
-
raise ("Default occupancy schedule has not been set in model! Unsure what to set exhaust fans to. Exiting.")
|
|
345
|
-
end
|
|
346
|
-
return model.getFanZoneExhausts
|
|
347
|
-
end
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
def self.modify_schedule( model, schedule_ruleset, a_coef = 0.0 ,b_coef = 0.0 ,c_coef= 0.0 ,time_shift = nil,time_sign = nil)
|
|
351
|
-
new_schedule = schedule_ruleset.clone( model ).to_ScheduleRuleset.get
|
|
352
|
-
self.modify_schedule!(model, new_schedule, a_coef,b_coef,c_coef ,time_shift,time_sign)
|
|
353
|
-
end
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
def self.modify_schedule!(model, schedule_ruleset, a_coef = 0.0 ,b_coef = 0.0 ,c_coef= 0.0 ,time_shift = nil,time_sign = nil)
|
|
357
|
-
schedule_ruleset.scheduleRules.each do |week_rule|
|
|
358
|
-
day_rule = week_rule.daySchedule()
|
|
359
|
-
times = day_rule.times()
|
|
360
|
-
times.each do |time|
|
|
361
|
-
old_value = day_rule.getValue(time)
|
|
362
|
-
day_rule.removeValue(time)
|
|
363
|
-
new_value = "error"
|
|
364
|
-
new_time = "error"
|
|
365
|
-
#set the new value according to Ax2+Bx+C.
|
|
366
|
-
new_value = a_coef * old_value ** 2.0 + b_coef * old_value + c_coef
|
|
367
|
-
unless time_shift.nil? or time_sign.nil?
|
|
368
|
-
command = "new_time = time #{time_sign} #{BTAP::Common::get_time_from_string(time_shift)}"
|
|
369
|
-
eval(command)
|
|
370
|
-
#make sure time is not past 24 hours.
|
|
371
|
-
new_time = new_time - BTAP::Common::get_time_from_string("24:00") if new_time > BTAP::Common::get_time_from_string("24:00")
|
|
372
|
-
end
|
|
373
|
-
day_rule.addValue(time, new_value)
|
|
374
|
-
end
|
|
375
|
-
end
|
|
376
|
-
end
|
|
377
|
-
|
|
378
|
-
def self.create_availability_schedule_based_on_another_schedule(model, occupancy_schedule, threshold = 0.05)
|
|
379
|
-
#create new On-Off schedule ruleset.
|
|
380
|
-
availability_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
|
|
381
|
-
availability_ruleset.setName("availabilty_based_on_occupancy")
|
|
382
|
-
#iterate though all rules.
|
|
383
|
-
occupancy_schedule.scheduleRules.each do |occ_rule|
|
|
384
|
-
#Create new hourly rule to populate availability schedule hourly data.
|
|
385
|
-
hourly_data = OpenStudio::Model::ScheduleDay.new(model)
|
|
386
|
-
#set schedule type to availabilty.
|
|
387
|
-
hourly_data.setScheduleTypeLimits(BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_on_off(model))
|
|
388
|
-
#iterate though hour / value pairs for 24 hour period.
|
|
389
|
-
occ_rule.daySchedule().times().each do |time|
|
|
390
|
-
#check if time value is greater or equal to the threshold. If true set hour value to 1, else 0.
|
|
391
|
-
occ_rule.daySchedule().getValue(time) >= threshold ? hourly_data.addValue(time, 1.0) : hourly_data.addValue(time, 0.0)
|
|
392
|
-
end
|
|
393
|
-
#create new rule with hourly data and add to availablity ruleset.
|
|
394
|
-
avail_rule = OpenStudio::Model::ScheduleRule.new(availability_ruleset,hourly_data)
|
|
395
|
-
#Set same start and end date.
|
|
396
|
-
avail_rule.setStartDate(occ_rule.getStartDate)
|
|
397
|
-
avail_rule.setEndDate(occ_rule.getEndDate)
|
|
398
|
-
end #loop occ_rule
|
|
399
|
-
#Make sure to set the default schedule to be the same as well.
|
|
400
|
-
avail_default_day = availability_ruleset.defaultDaySchedule()
|
|
401
|
-
avail_default_day.clearValues()
|
|
402
|
-
#iterate though hour / value pairs for 24 hour period.
|
|
403
|
-
occupancy_schedule.defaultDaySchedule().times().each do |time|
|
|
404
|
-
#check if time value is greater or equal to the threshold. If true set hour value to 1, else 0.
|
|
405
|
-
occupancy_schedule.defaultDaySchedule().getValue(time) >= threshold ? avail_default_day.addValue(time, 1.0) : avail_default_day.addValue(time, 0.0)
|
|
406
|
-
end
|
|
407
|
-
return availability_ruleset
|
|
408
|
-
end
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
def self.create_setback_schedule_based_on_another_schedule(
|
|
412
|
-
model,
|
|
413
|
-
occupancy_schedule,
|
|
414
|
-
threshold = 0.05,
|
|
415
|
-
heat_setpoint = 22.0,
|
|
416
|
-
heat_setback = 17.0,
|
|
417
|
-
cool_setpoint = 24.0,
|
|
418
|
-
cool_setback =99.0)
|
|
419
|
-
#create new On-Off schedule ruleset.
|
|
420
|
-
heating_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
|
|
421
|
-
heating_ruleset.setName("heat_thermostat_based_on_occupancy")
|
|
422
|
-
cooling_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
|
|
423
|
-
cooling_ruleset.setName("cool_thermostat_based_on_occupancy")
|
|
424
|
-
#iterate though all rules.
|
|
425
|
-
occupancy_schedule.to_ScheduleRuleset.get.scheduleRules.each do |occ_rule|
|
|
426
|
-
#Create new hourly rule to populate heat/cold schedule hourly data.
|
|
427
|
-
heating_hourly_data = OpenStudio::Model::ScheduleDay.new(model)
|
|
428
|
-
cooling_hourly_data = OpenStudio::Model::ScheduleDay.new(model)
|
|
429
|
-
#set schedule type to availabilty.
|
|
430
|
-
heating_hourly_data.setScheduleTypeLimits(BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_temperature(model))
|
|
431
|
-
cooling_hourly_data.setScheduleTypeLimits(BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_temperature(model))
|
|
432
|
-
#iterate though hour / value pairs for 24 hour period.
|
|
433
|
-
occ_rule.daySchedule().times().each do |time|
|
|
434
|
-
#check if time value is greater or equal to the threshold. If true set hour value to 1, else 0.
|
|
435
|
-
occ_rule.daySchedule().getValue(time) >= threshold ? heating_hourly_data.addValue(time, heat_setpoint) : heating_hourly_data.addValue(time,heat_setback)
|
|
436
|
-
occ_rule.daySchedule().getValue(time) >= threshold ? cooling_hourly_data.addValue(time, cool_setpoint) : cooling_hourly_data.addValue(time,cool_setback)
|
|
437
|
-
end
|
|
438
|
-
#create new rule with hourly data and add to availablity ruleset.
|
|
439
|
-
heating_avail_rule = OpenStudio::Model::ScheduleRule.new(heating_ruleset,heating_hourly_data)
|
|
440
|
-
cooling_avail_rule = OpenStudio::Model::ScheduleRule.new(cooling_ruleset,cooling_hourly_data)
|
|
441
|
-
#Set same start and end date.
|
|
442
|
-
heating_avail_rule.setStartDate(occ_rule.startDate.get)
|
|
443
|
-
heating_avail_rule.setEndDate(occ_rule.endDate.get)
|
|
444
|
-
cooling_avail_rule.setStartDate(occ_rule.startDate.get)
|
|
445
|
-
cooling_avail_rule.setEndDate(occ_rule.endDate.get)
|
|
446
|
-
#set days enforced.
|
|
447
|
-
heating_avail_rule.setApplySunday(occ_rule.applySunday)
|
|
448
|
-
heating_avail_rule.setApplyMonday(occ_rule.applyMonday)
|
|
449
|
-
heating_avail_rule.setApplyTuesday(occ_rule.applyTuesday)
|
|
450
|
-
heating_avail_rule.setApplyWednesday(occ_rule.applyWednesday)
|
|
451
|
-
heating_avail_rule.setApplyThursday(occ_rule.applyThursday)
|
|
452
|
-
heating_avail_rule.setApplyFriday(occ_rule.applyFriday)
|
|
453
|
-
heating_avail_rule.setApplySaturday(occ_rule.applySaturday)
|
|
454
|
-
|
|
455
|
-
cooling_avail_rule.setApplySunday(occ_rule.applySunday)
|
|
456
|
-
cooling_avail_rule.setApplyMonday(occ_rule.applyMonday)
|
|
457
|
-
cooling_avail_rule.setApplyTuesday(occ_rule.applyTuesday)
|
|
458
|
-
cooling_avail_rule.setApplyWednesday(occ_rule.applyWednesday)
|
|
459
|
-
cooling_avail_rule.setApplyThursday(occ_rule.applyThursday)
|
|
460
|
-
cooling_avail_rule.setApplyFriday(occ_rule.applyFriday)
|
|
461
|
-
cooling_avail_rule.setApplySaturday(occ_rule.applySaturday)
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
end #loop occ_rule
|
|
465
|
-
#Make sure to set the default schedule to be the same as well.
|
|
466
|
-
heating_default_day = heating_ruleset.defaultDaySchedule()
|
|
467
|
-
heating_default_day.clearValues()
|
|
468
|
-
cooling_default_day = cooling_ruleset.defaultDaySchedule()
|
|
469
|
-
cooling_default_day.clearValues()
|
|
470
|
-
|
|
471
|
-
#iterate though hour / value pairs for 24 hour period.
|
|
472
|
-
occupancy_schedule.to_ScheduleRuleset.get.defaultDaySchedule().times().each do |time|
|
|
473
|
-
#check if time value is greater or equal to the threshold. If true set hour value to 1, else 0.
|
|
474
|
-
occupancy_schedule.to_ScheduleRuleset.get.defaultDaySchedule().getValue(time) >= threshold ? heating_default_day.addValue(time, heat_setpoint) : heating_default_day.addValue(time, heat_setback)
|
|
475
|
-
occupancy_schedule.to_ScheduleRuleset.get.defaultDaySchedule().getValue(time) >= threshold ? cooling_default_day.addValue(time, cool_setpoint) : cooling_default_day.addValue(time, cool_setback)
|
|
476
107
|
end
|
|
477
|
-
return heating_ruleset,cooling_ruleset
|
|
478
108
|
end
|
|
479
109
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
#
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
schedule_ruleset.scheduleRules.each do |week_rule|
|
|
488
|
-
day_rule = week_rule.daySchedule()
|
|
489
|
-
times = day_rule.times()
|
|
490
|
-
times.each do |time|
|
|
491
|
-
old_value = day_rule.getValue(time).to_f
|
|
492
|
-
day_rule.removeValue(time)
|
|
493
|
-
new_value = old_value
|
|
494
|
-
new_value = min_value if old_value < min_value
|
|
495
|
-
day_rule.addValue(time, new_value)
|
|
496
|
-
end
|
|
497
|
-
end
|
|
498
|
-
|
|
499
|
-
end
|
|
500
|
-
|
|
501
|
-
#Sets all values in a schedule greater than max_value to max_value.
|
|
502
|
-
def self.apply_schedule_maximum(max_value,schedule)
|
|
503
|
-
schedule_ruleset = schedule.to_ScheduleRuleset.get unless schedule.to_ScheduleRuleset.empty?
|
|
504
|
-
schedule_ruleset.scheduleRules.each do |week_rule|
|
|
505
|
-
day_rule = week_rule.daySchedule()
|
|
506
|
-
times = day_rule.times()
|
|
507
|
-
times.each do |time|
|
|
508
|
-
old_value = day_rule.getValue(time).to_f
|
|
509
|
-
day_rule.removeValue(time)
|
|
510
|
-
new_value = old_value
|
|
511
|
-
new_value = max_value if old_value > max_value
|
|
512
|
-
day_rule.addValue(time, new_value)
|
|
513
|
-
end
|
|
514
|
-
end
|
|
515
|
-
end
|
|
516
|
-
|
|
517
|
-
#Creates a new ruleset schedule object. This is the basic schedule component
|
|
518
|
-
#used in openstudio.
|
|
519
|
-
#name = string: name of schedule
|
|
520
|
-
#type = TEMPERATURE, ON_OFF, FRACTION
|
|
521
|
-
#hourArrayValues = a 3 x 24 array representing week, sat and sun hours.
|
|
522
|
-
#examples:
|
|
523
|
-
#hourArrayValues =
|
|
110
|
+
# Creates a new ruleset schedule object. This is the basic schedule component
|
|
111
|
+
# used in openstudio.
|
|
112
|
+
# name = string: name of schedule
|
|
113
|
+
# type = TEMPERATURE, ON_OFF, FRACTION
|
|
114
|
+
# hourArrayValues = a 3 x 24 array representing week, sat and sun hours.
|
|
115
|
+
# examples:
|
|
116
|
+
# hourArrayValues =
|
|
524
117
|
# [
|
|
525
118
|
# [18,18,18,18,21,21,21,21,23,23,23,23,23,23,21,21,21,18,18,18,18,18,18,18],#Weekday
|
|
526
119
|
# [18,18,18,18,21,21,21,21,23,23,23,23,23,23,21,21,21,18,18,18,18,18,18,18],#Saturday
|
|
@@ -529,9 +122,9 @@ module BTAP
|
|
|
529
122
|
# or if you need a constant temperature you can use this shorthand method.
|
|
530
123
|
# heat_setpoint_array =
|
|
531
124
|
# [
|
|
532
|
-
# Array.new(24){21}, #Weekday
|
|
533
|
-
# Array.new(24){21}, #Sat
|
|
534
|
-
# Array.new(24){21}, #Sun
|
|
125
|
+
# Array.new(24){21}, # Weekday
|
|
126
|
+
# Array.new(24){21}, # Sat
|
|
127
|
+
# Array.new(24){21}, # Sun
|
|
535
128
|
# ]
|
|
536
129
|
def self.create_annual_ruleset_schedule(model,name,type,hourArrayValues,start_date = "Jan-1",end_date = "Dec-31" )
|
|
537
130
|
raise("array size not 3x24. Please verify your hourly array") if hourArrayValues.size != 3 or hourArrayValues[0].size != 24 or hourArrayValues[1].size != 24 or hourArrayValues[2].size != 24
|
|
@@ -672,197 +265,6 @@ module BTAP
|
|
|
672
265
|
]
|
|
673
266
|
]
|
|
674
267
|
|
|
675
|
-
def self.create_annual_ruleset_schedule_detailed(model,name,type,schedule_struct )
|
|
676
|
-
#create new ruleset
|
|
677
|
-
ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
|
|
678
|
-
ruleset.setName(name)
|
|
679
|
-
default_day = ruleset.defaultDaySchedule
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
#set types limits
|
|
683
|
-
scheduletype = ""
|
|
684
|
-
case type.downcase
|
|
685
|
-
when "FRACTION".downcase
|
|
686
|
-
scheduletype = BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_fraction(model)
|
|
687
|
-
when "ON_OFF".downcase
|
|
688
|
-
scheduletype = BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_on_off(model)
|
|
689
|
-
when "TEMPERATURE".downcase
|
|
690
|
-
scheduletype = BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_temperature(model)
|
|
691
|
-
# this will set the default day for temperatures to 23.5C
|
|
692
|
-
default_day.clearValues()
|
|
693
|
-
raise "unable to set ScheduleDay type limits" unless default_day.setScheduleTypeLimits(scheduletype)
|
|
694
|
-
default_day.addValue(BTAP::Common::get_time_from_string( "24:00"), 23.5 )
|
|
695
|
-
when "ACTIVITY".downcase
|
|
696
|
-
scheduletype = BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_activity(model)
|
|
697
|
-
# this will set the default day for temperatures to 23.5C
|
|
698
|
-
default_day.clearValues()
|
|
699
|
-
raise "unable to set ScheduleDay type limits" unless default_day.setScheduleTypeLimits(scheduletype)
|
|
700
|
-
default_day.addValue(BTAP::Common::get_time_from_string( "24:00"), 120.0 )
|
|
701
|
-
else
|
|
702
|
-
#if schedule type could not be found raise an exception.
|
|
703
|
-
raise "could not find schedule limits type :" + type
|
|
704
|
-
end
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
#loop through each schedule ruleset.
|
|
709
|
-
schedule_struct.each do |run_period_profile|
|
|
710
|
-
|
|
711
|
-
start_end_dates = run_period_profile[0]
|
|
712
|
-
days_of_the_week = run_period_profile[1]
|
|
713
|
-
hourly_schedule = run_period_profile[2]
|
|
714
|
-
|
|
715
|
-
day_rule = OpenStudio::Model::ScheduleDay.new(model)
|
|
716
|
-
day_rule.setName( name )
|
|
717
|
-
if not day_rule.setScheduleTypeLimits(scheduletype)
|
|
718
|
-
raise "unable to set ScheduleDay type limits"
|
|
719
|
-
end
|
|
720
|
-
|
|
721
|
-
hourly_schedule.each do |hour|
|
|
722
|
-
day_rule.addValue(BTAP::Common::get_time_from_string( hour[0]), hour[1] )
|
|
723
|
-
end
|
|
724
|
-
|
|
725
|
-
#create weekday rule
|
|
726
|
-
week_rule = OpenStudio::Model::ScheduleRule.new(ruleset,day_rule)
|
|
727
|
-
#Set Default to false
|
|
728
|
-
week_rule.setApplySunday(false)
|
|
729
|
-
week_rule.setApplyMonday(false)
|
|
730
|
-
week_rule.setApplyTuesday(false)
|
|
731
|
-
week_rule.setApplyWednesday(false)
|
|
732
|
-
week_rule.setApplyThursday(false)
|
|
733
|
-
week_rule.setApplyFriday(false)
|
|
734
|
-
week_rule.setApplySaturday(false)
|
|
735
|
-
# Now set actual days it is applied.
|
|
736
|
-
week_rule.setApplySunday(true) if days_of_the_week.include?("Su") or days_of_the_week.include?("Wke") or days_of_the_week.include?("All")
|
|
737
|
-
week_rule.setApplyMonday(true) if days_of_the_week.include?("M") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
738
|
-
week_rule.setApplyTuesday(true) if days_of_the_week.include?("T") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
739
|
-
week_rule.setApplyWednesday(true) if days_of_the_week.include?("W") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
740
|
-
week_rule.setApplyThursday(true) if days_of_the_week.include?("Th") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
741
|
-
week_rule.setApplyFriday(true) if days_of_the_week.include?("F") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
742
|
-
week_rule.setApplySaturday(true) if days_of_the_week.include?("S") or days_of_the_week.include?("Wke") or days_of_the_week.include?("All")
|
|
743
|
-
|
|
744
|
-
#Set Period Rule
|
|
745
|
-
week_rule.setStartDate( BTAP::Common::get_date_from_string(start_end_dates[0] ) )
|
|
746
|
-
week_rule.setEndDate( BTAP::Common::get_date_from_string(start_end_dates[1] ) )
|
|
747
|
-
end
|
|
748
|
-
return ruleset
|
|
749
|
-
end
|
|
750
|
-
|
|
751
|
-
def self.create_annual_fraction_ruleset_schedule(model,name,hourArrayValues)
|
|
752
|
-
self.create_annual_ruleset_schedule(model,name,"FRACTION",hourArrayValues)
|
|
753
|
-
end
|
|
754
|
-
|
|
755
|
-
def self.create_annual_on_off_ruleset_schedule(model,name,hourArrayValues)
|
|
756
|
-
self.create_annual_ruleset_schedule(model,name,"ON_OFF",hourArrayValues)
|
|
757
|
-
end
|
|
758
|
-
|
|
759
|
-
def self.create_annual_temperature_ruleset_schedule(model,name,hourArrayValues)
|
|
760
|
-
self.create_annual_ruleset_schedule(model,name,"TEMPERATURE",hourArrayValues)
|
|
761
|
-
end
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
# This method will create a detailed schedule using a "compact format"
|
|
765
|
-
# @param model [OpenStudio::Model::Model] The building model you wish to add the schedule to.
|
|
766
|
-
# @param json_string_data [String] This is a json format to contain the minimal information required for a detailed schedule.
|
|
767
|
-
# '{"sch":{"name":"always 21C",
|
|
768
|
-
# "type":"TEMPERATURE",
|
|
769
|
-
# "period_rules":[ { "start":"Jan-31","end":"Dec-31",
|
|
770
|
-
# "day_rules":[
|
|
771
|
-
# { "days" :"M,T,W,T,F,S,SN",
|
|
772
|
-
# "hour_rules":[ { "value":"21.0", "until":"24:00"},
|
|
773
|
-
# { "value":"21.0", "until":"24:00"} ]
|
|
774
|
-
# }
|
|
775
|
-
# ]
|
|
776
|
-
# }
|
|
777
|
-
# ]
|
|
778
|
-
# }}'
|
|
779
|
-
|
|
780
|
-
# def self.create_annual_ruleset_schedule_detailed_json(model,json_string_data)
|
|
781
|
-
# #create new ruleset
|
|
782
|
-
# ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
|
|
783
|
-
# json_hash_data = JSON.parse(json_string_data)
|
|
784
|
-
# ruleset.setName(json_hash_data["sch"]["name"])
|
|
785
|
-
# type = json_hash_data["sch"]["type"]
|
|
786
|
-
# default_day = ruleset.defaultDaySchedule
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
# #set types limits
|
|
790
|
-
# scheduletype = ""
|
|
791
|
-
# case type.downcase
|
|
792
|
-
# when "FRACTION".downcase
|
|
793
|
-
# scheduletype = BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_fraction(model)
|
|
794
|
-
# when "ON_OFF".downcase
|
|
795
|
-
# scheduletype = BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_on_off(model)
|
|
796
|
-
# when "TEMPERATURE".downcase
|
|
797
|
-
# scheduletype = BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_temperature(model)
|
|
798
|
-
# # this will set the default day for temperatures to 23.5C
|
|
799
|
-
# default_day.clearValues()
|
|
800
|
-
# raise "unable to set ScheduleDay type limits" unless default_day.setScheduleTypeLimits(scheduletype)
|
|
801
|
-
# default_day.addValue(BTAP::Common::get_time_from_string( "24:00"), 23.5 )
|
|
802
|
-
# when "ACTIVITY".downcase
|
|
803
|
-
# scheduletype = BTAP::Resources::Schedules::StandardScheduleTypeLimits::get_activity(model)
|
|
804
|
-
# # this will set the default day for activity level to 120
|
|
805
|
-
# default_day.clearValues()
|
|
806
|
-
# raise "unable to set ScheduleDay type limits" unless default_day.setScheduleTypeLimits(scheduletype)
|
|
807
|
-
# default_day.addValue(BTAP::Common::get_time_from_string( "24:00"), 120.0 )
|
|
808
|
-
# else
|
|
809
|
-
# #if schedule type could not be found raise an exception.
|
|
810
|
-
# raise "could not find schedule limits type :" + type
|
|
811
|
-
# end
|
|
812
|
-
|
|
813
|
-
# scheduletype = OpenStudio::Model::ScheduleTypeLimits.new( model )
|
|
814
|
-
# # raise "unable to set ScheduleDay type limits" unless ruleset.setScheduleTypeLimits(scheduletype)
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
# #loop through each schedule ruleset Top level Period
|
|
818
|
-
# json_hash_data["sch"]["period_rules"].each do |period_profile|
|
|
819
|
-
|
|
820
|
-
# #
|
|
821
|
-
# start_date = period_profile["start"]
|
|
822
|
-
# end_date = period_profile["end"]
|
|
823
|
-
# period_profile[1]
|
|
824
|
-
|
|
825
|
-
# period_profile["day_rules"].each do |day_rules|
|
|
826
|
-
# days_of_the_week = day_rules["days"]
|
|
827
|
-
# #Create Day rule.
|
|
828
|
-
# day_rule = OpenStudio::Model::ScheduleDay.new(model)
|
|
829
|
-
# # if not day_rule.setScheduleTypeLimits(scheduletype)
|
|
830
|
-
# # raise "unable to set ScheduleDay type limits"
|
|
831
|
-
# # end
|
|
832
|
-
|
|
833
|
-
# day_rules["hour_rules"].each do |hour_rules|
|
|
834
|
-
# day_rule.addValue(BTAP::Common::get_time_from_string( hour_rules["until"]), hour_rules["value"].to_f )
|
|
835
|
-
# end
|
|
836
|
-
|
|
837
|
-
# #create weekday rule
|
|
838
|
-
# week_rule = OpenStudio::Model::ScheduleRule.new(ruleset,day_rule)
|
|
839
|
-
# #Set Default to false
|
|
840
|
-
# week_rule.setApplySunday(false)
|
|
841
|
-
# week_rule.setApplyMonday(false)
|
|
842
|
-
# week_rule.setApplyTuesday(false)
|
|
843
|
-
# week_rule.setApplyWednesday(false)
|
|
844
|
-
# week_rule.setApplyThursday(false)
|
|
845
|
-
# week_rule.setApplyFriday(false)
|
|
846
|
-
# week_rule.setApplySaturday(false)
|
|
847
|
-
# # Now set actual days it is applied.
|
|
848
|
-
# week_rule.setApplySunday(true) if days_of_the_week.include?("Su") or days_of_the_week.include?("Wke") or days_of_the_week.include?("All")
|
|
849
|
-
# week_rule.setApplyMonday(true) if days_of_the_week.include?("M") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
850
|
-
# week_rule.setApplyTuesday(true) if days_of_the_week.include?("T") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
851
|
-
# week_rule.setApplyWednesday(true) if days_of_the_week.include?("W") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
852
|
-
# week_rule.setApplyThursday(true) if days_of_the_week.include?("Th") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
853
|
-
# week_rule.setApplyFriday(true) if days_of_the_week.include?("F") or days_of_the_week.include?("Wkd") or days_of_the_week.include?("All")
|
|
854
|
-
# week_rule.setApplySaturday(true) if days_of_the_week.include?("S") or days_of_the_week.include?("Wke") or days_of_the_week.include?("All")
|
|
855
|
-
|
|
856
|
-
# #Set Period Rule
|
|
857
|
-
# week_rule.setStartDate( BTAP::Common::get_date_from_string(start_date ) )
|
|
858
|
-
# week_rule.setEndDate( BTAP::Common::get_date_from_string(end_date ) )
|
|
859
|
-
# end
|
|
860
|
-
# end
|
|
861
|
-
# return ruleset
|
|
862
|
-
# end
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
268
|
# This method creates a new dual setpoint schedule using pre-created heating and cooling schedules.
|
|
867
269
|
# name - name of schedule.
|
|
868
270
|
# type - type of schedule (FRACTION, ON_OFF, TEMPERATURE)
|
|
@@ -920,8 +322,6 @@ module BTAP
|
|
|
920
322
|
def self.create_schedule_variable_interval_from_time_series(model, time_series)
|
|
921
323
|
result = OpenStudio::Model::ScheduleInterval.fromTimeSeries(time_series, model).get
|
|
922
324
|
end
|
|
923
|
-
|
|
924
325
|
end #module Schedules
|
|
925
|
-
|
|
926
326
|
end #module Resources
|
|
927
327
|
end
|