Class: AedgSmallToMediumOfficeExteriorLighting

Inherits:
OpenStudio::Measure::ModelMeasure
  • Object
show all
Includes:
OsLib_AedgMeasures, OsLib_HelperMethods, OsLib_LightingAndEquipment
Defined in:
lib/measures/AedgSmallToMediumOfficeExteriorLighting/measure.rb

Overview

start the measure

Instance Method Summary collapse

Methods included from OsLib_HelperMethods

checkChoiceArgFromModelObjects, checkDoubleAndIntegerArguments, checkOptionalChoiceArgFromModelObjects, check_upstream_measure_for_arg, createRunVariables, getAreaOfSpacesInArray, getSpaceTypeStandardsInformation, getTotalCostForObjects, log_msgs, neatConvertWithUnitDisplay, populateChoiceArgFromModelObjects, setup_log_msgs

Methods included from OsLib_AedgMeasures

getClimateZoneNumber, getK12Tips, getLongHowToTips, getSmMdOffTips

Instance Method Details

#arguments(model) ⇒ Object

define the arguments that the user will input



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/measures/AedgSmallToMediumOfficeExteriorLighting/measure.rb', line 37

def arguments(model)
  args = OpenStudio::Measure::OSArgumentVector.new

  # no argument to remove exterior lights. that will always be done.

  # make choice argument for target performance
  choices = OpenStudio::StringVector.new
  choices << 'AEDG SmMdOff - Baseline'
  choices << 'AEDG SmMdOff - Target'
  target = OpenStudio::Measure::OSArgument.makeChoiceArgument('target', choices)
  target.setDisplayName('Exterior Lighting Target Performance')
  target.setDefaultValue('AEDG SmMdOff - Target')
  args << target

  # make choice argument for target performance
  choices = OpenStudio::StringVector.new
  # hiding area 1 and 2 because no lighting is recommended
  # choices << "0 - Parks/Rural Areas (Undeveloped)"
  # choices << "1 - Parks/Rural Areas (Developed)"
  choices << '2 - Residential, Mixed Use'
  choices << '3 - All Other Areas'
  choices << '4 - High Activity Commercial'
  lightingZone = OpenStudio::Measure::OSArgument.makeChoiceArgument('lightingZone', choices)
  lightingZone.setDisplayName('Exterior Lighting Zone')
  lightingZone.setDefaultValue('2 - Residential, Mixed Use')
  args << lightingZone

  # make an argument for facadeLandscapeLighting
  facadeLandscapeLighting = OpenStudio::Measure::OSArgument.makeDoubleArgument('facadeLandscapeLighting', true)
  facadeLandscapeLighting.setDisplayName('Wall Coverage Area for Decorative Facade Lighting (ft^2)')
  facadeLandscapeLighting.setDefaultValue(0.0)
  args << facadeLandscapeLighting

  # make an argument for parkingDrivesLighting
  parkingDrivesLighting = OpenStudio::Measure::OSArgument.makeDoubleArgument('parkingDrivesLighting', true)
  parkingDrivesLighting.setDisplayName('Ground Coverage Area for Parking Lots and Drives Lighting (ft^2)')
  parkingDrivesLighting.setDefaultValue(0.0)
  args << parkingDrivesLighting

  # make an argument for walkwayPlazaSpecialLighting
  walkwayPlazaSpecialLighting = OpenStudio::Measure::OSArgument.makeDoubleArgument('walkwayPlazaSpecialLighting', true)
  walkwayPlazaSpecialLighting.setDisplayName('Gound Coverage Area for Walkway and Plaza Lighting (ft^2)')
  walkwayPlazaSpecialLighting.setDefaultValue(0.0)
  args << walkwayPlazaSpecialLighting

  # make an argument for material and installation cost
  costTotalExteriorLights = OpenStudio::Measure::OSArgument.makeDoubleArgument('costTotalExteriorLights', true)
  costTotalExteriorLights.setDisplayName('Total cost for all Exterior Lighting ($).')
  costTotalExteriorLights.setDefaultValue(0.0)
  args << costTotalExteriorLights

  return args
end

#nameObject

define the name that a user will see, this method may be deprecated as the display name in PAT comes from the name field in measure.xml



32
33
34
# File 'lib/measures/AedgSmallToMediumOfficeExteriorLighting/measure.rb', line 32

def name
  return 'AedgSmallToMediumOfficeExteriorLighting'
end

#run(model, runner, user_arguments) ⇒ Object

define what happens when the measure is run



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/measures/AedgSmallToMediumOfficeExteriorLighting/measure.rb', line 92

def run(model, runner, user_arguments)
  super(model, runner, user_arguments)

  # use the built-in error checking
  if !runner.validateUserArguments(arguments(model), user_arguments)
    return false
  end

  # assign the user inputs to variables
  target = runner.getStringArgumentValue('target', user_arguments)
  lightingZone = runner.getStringArgumentValue('lightingZone', user_arguments).split(//).first # I only want the first character
  facadeLandscapeLighting = runner.getDoubleArgumentValue('facadeLandscapeLighting', user_arguments)
  parkingDrivesLighting = runner.getDoubleArgumentValue('parkingDrivesLighting', user_arguments)
  walkwayPlazaSpecialLighting = runner.getDoubleArgumentValue('walkwayPlazaSpecialLighting', user_arguments)
  costTotalExteriorLights = runner.getDoubleArgumentValue('costTotalExteriorLights', user_arguments)

  # check arguments for reasonableness
  checkDoubleArguments = OsLib_HelperMethods.checkDoubleAndIntegerArguments(runner, user_arguments, 'min' => 0.0, 'max' => nil, 'min_eq_bool' => true, 'max_eq_bool' => false, 'arg_array' => ['facadeLandscapeLighting', 'parkingDrivesLighting', 'walkwayPlazaSpecialLighting', 'costTotalExteriorLights'])
  if !checkDoubleArguments then return false end

  # prepare rule hash
  rules = [] # exterior lighting zone, lighting type, LPD W/ft^2, setback fraction

  # exterior lighting recommendations is the same across all climate zones
  # TSD low energy - primary (2219 W), secondary (18,980 W). Total (21,200) .Both controlled by astronomical clock and schedule
  # TSD baseline - primary (5547 W), secondary (47,450 W). Total (53,000). Only controlled by astronomical clock.
  # Using 2.5x target values for baseline value.
  baselineToTargetRatio = 2.5

  # facadeLandscapeLighting Target
  # notes on controls: auto OFF between 12am and 6am
  rules << ['0', 'facadeLandscapeLighting', 'AEDG SmMdOff - Target', 'NA', 'NA']
  rules << ['1', 'facadeLandscapeLighting', 'AEDG SmMdOff - Target', 'NA', 'NA']
  rules << ['2', 'facadeLandscapeLighting', 'AEDG SmMdOff - Target', 0.05, 0.0]
  rules << ['3', 'facadeLandscapeLighting', 'AEDG SmMdOff - Target', 0.075, 0.0]
  rules << ['4', 'facadeLandscapeLighting', 'AEDG SmMdOff - Target', 0.075, 0.0]

  # parkingDrivesLighting  Target
  # notes on controls: reduce to 25% between 12am and 6am
  rules << ['0', 'parkingDrivesLighting', 'AEDG SmMdOff - Target', 'NA', 'NA', 'NA']
  rules << ['1', 'parkingDrivesLighting', 'AEDG SmMdOff - Target', 'NA', 'NA', 'NA']
  rules << ['2', 'parkingDrivesLighting', 'AEDG SmMdOff - Target', 0.06, 0.25]
  rules << ['3', 'parkingDrivesLighting', 'AEDG SmMdOff - Target', 0.1, 0.25]
  rules << ['4', 'parkingDrivesLighting', 'AEDG SmMdOff - Target', 0.1, 0.25]

  # walkwayPlazaSpecialLighting Target
  # notes on controls: reduce to 25% between 12am and 6am
  rules << ['0', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Target', 'NA', 'NA']
  rules << ['1', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Target', 'NA', 'NA']
  rules << ['2', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Target', 0.16, 0.25]
  rules << ['3', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Target', 0.14, 0.25]
  rules << ['4', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Target', 0.14, 0.25]

  # facadeLandscapeLighting Baseline
  # notes on controls: only astronomical
  rules << ['0', 'facadeLandscapeLighting', 'AEDG SmMdOff - Baseline', 'NA', 'NA']
  rules << ['1', 'facadeLandscapeLighting', 'AEDG SmMdOff - Baseline', 'NA', 'NA']
  rules << ['2', 'facadeLandscapeLighting', 'AEDG SmMdOff - Baseline', 0.05 * baselineToTargetRatio, 1.0]
  rules << ['3', 'facadeLandscapeLighting', 'AEDG SmMdOff - Baseline', 0.075 * baselineToTargetRatio, 1.0]
  rules << ['4', 'facadeLandscapeLighting', 'AEDG SmMdOff - Baseline', 0.075 * baselineToTargetRatio, 1.0]

  # parkingDrivesLighting Baseline
  # notes on controls: only astronomical
  rules << ['0', 'parkingDrivesLighting', 'AEDG SmMdOff - Baseline', 'NA', 'NA']
  rules << ['1', 'parkingDrivesLighting', 'AEDG SmMdOff - Baseline', 'NA', 'NA']
  rules << ['2', 'parkingDrivesLighting', 'AEDG SmMdOff - Baseline', 0.06 * baselineToTargetRatio, 1.0]
  rules << ['3', 'parkingDrivesLighting', 'AEDG SmMdOff - Baseline', 0.1 * baselineToTargetRatio, 1.0]
  rules << ['4', 'parkingDrivesLighting', 'AEDG SmMdOff - Baseline', 0.1 * baselineToTargetRatio, 1.0]

  # walkwayPlazaSpecialLighting Baseline
  # notes on controls: only astronomical
  rules << ['0', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Baseline', 'NA', 'NA']
  rules << ['1', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Baseline', 'NA', 'NA']
  rules << ['2', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Baseline', 0.16 * baselineToTargetRatio, 1.0]
  rules << ['3', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Baseline', 0.14 * baselineToTargetRatio, 1.0]
  rules << ['4', 'walkwayPlazaSpecialLighting', 'AEDG SmMdOff - Baseline', 0.14 * baselineToTargetRatio, 1.0]

  # make rule hash for cleaner code
  rulesHash = {}
  rules.each do |rule|
    rulesHash["#{rule[0]} #{rule[1]} #{rule[2]}"] = { 'LPD_ip' => rule[3], 'setbackFraction' => rule[4] }
  end

  # flag for roof surface type for tips
  facadeLandscapeLightingFlag = false
  parkingDrivesLightingFlag = false
  walkwayPlazaSpecialLightingFlag = false

  # get starting exterior lighting value
  getExteriorLightsValue = OsLib_LightingAndEquipment.getExteriorLightsValue(model)

  # reporting initial condition of model
  runner.registerInitialCondition("The initial model had #{getExteriorLightsValue['exterior_lights'].size} exterior lights with a total power of #{getExteriorLightsValue['exteriorLightingPower']} Watts.")

  # remove exterior lights
  lightsRemoved = OsLib_LightingAndEquipment.removeAllExteriorLights(model, runner)

  # TODO: - later could calculate good default value for facade lights, and possibly smart defaults based on building size

  # add facade lights
  if facadeLandscapeLighting > 0
    addExteriorLights_inputs = {
      'name' => 'Exterior Lights - Facade',
      'power' => rulesHash["#{lightingZone} facadeLandscapeLighting #{target}"]['LPD_ip'] * facadeLandscapeLighting,
      'setbackStartTime' => 0,
      'setbackEndTime' => 6,
      'setbackFraction' => rulesHash["#{lightingZone} facadeLandscapeLighting #{target}"]['setbackFraction']
    }
    facadeLights = OsLib_LightingAndEquipment.addExteriorLights(model, runner, addExteriorLights_inputs)
    facadeLandscapeLightingFlag = true
  end

  # add parking lights
  if parkingDrivesLighting > 0
    addExteriorLights_inputs = {
      'name' => 'Exterior Lights - Parking',
      'power' => rulesHash["#{lightingZone} parkingDrivesLighting #{target}"]['LPD_ip'] * parkingDrivesLighting,
      'setbackStartTime' => 0,
      'setbackEndTime' => 6,
      'setbackFraction' => rulesHash["#{lightingZone} parkingDrivesLighting #{target}"]['setbackFraction']
    }
    parkingLights = OsLib_LightingAndEquipment.addExteriorLights(model, runner, addExteriorLights_inputs)
    parkingDrivesLightingFlag = true
  end

  # add walkway lights
  if walkwayPlazaSpecialLighting > 0
    addExteriorLights_inputs = {
      'name' => 'Exterior Lights - Walkway',
      'power' => rulesHash["#{lightingZone} walkwayPlazaSpecialLighting #{target}"]['LPD_ip'] * walkwayPlazaSpecialLighting,
      'setbackStartTime' => 0,
      'setbackEndTime' => 6,
      'setbackFraction' => rulesHash["#{lightingZone} walkwayPlazaSpecialLighting #{target}"]['setbackFraction']
    }
    walkwayLights = OsLib_LightingAndEquipment.addExteriorLights(model, runner, addExteriorLights_inputs)
    walkwayPlazaSpecialLightingFlag = true
  end

  # get building to add cost to
  building = model.getBuilding

  # global variables for costs
  expected_life = 25
  years_until_costs_start = 0

  # add cost to building
  if costTotalExteriorLights > 0
    lcc_mat = OpenStudio::Model::LifeCycleCost.createLifeCycleCost('Exterior Lights', building, costTotalExteriorLights, 'CostPerEach', 'Construction', expected_life, years_until_costs_start)
    lcc_mat_TotalCost = lcc_mat.get.totalCost
  else
    lcc_mat_TotalCost = 0
  end

  # populate AEDG tip keys
  aedgTips = []

  # note: the K12 AEDG doesn't mention EL20, EL24, or E24 but they both seem relevant.

  if facadeLandscapeLightingFlag
    aedgTips.push('EL20', 'EL23', 'EL24', 'EL25')
  end
  if parkingDrivesLightingFlag
    aedgTips.push('EL20', 'EL21', 'EL24', 'EL25')
  end
  if walkwayPlazaSpecialLightingFlag
    aedgTips.push('EL20', 'EL22', 'EL24', 'EL25')
  end

  # create not applicable of no constructions were tagged to change
  if aedgTips.empty? && !lightsRemoved
    runner.registerAsNotApplicable('No exterior lights were added to the model, and no lights were removed.')
    return true
  end

  # populate how to tip messages
  aedgTipsLong = OsLib_AedgMeasures.getLongHowToTips('SmMdOff', aedgTips.uniq.sort, runner)
  if !aedgTipsLong
    return false # this should only happen if measure writer passes bad values to getLongHowToTips
  end

  # get final exterior lighting value
  getExteriorLightsValue = OsLib_LightingAndEquipment.getExteriorLightsValue(model)

  # reporting final condition of model
  # todo - add cost to final condition
  runner.registerFinalCondition("The final model had #{getExteriorLightsValue['exterior_lights'].size} exterior lights with a total power of #{getExteriorLightsValue['exteriorLightingPower']} Watts. Cost of exterior lights are $#{OpenStudio.toNeatString(lcc_mat_TotalCost, 0, true)}. #{aedgTipsLong}")

  return true
end