Class: CreateAndAssignThermalZonesForUnassignedSpaces
- Inherits:
-
OpenStudio::Measure::ModelMeasure
- Object
- OpenStudio::Measure::ModelMeasure
- CreateAndAssignThermalZonesForUnassignedSpaces
- Defined in:
- lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/measure.rb
Overview
start the measure
Instance Method Summary collapse
-
#arguments(model) ⇒ Object
define the arguments that the user will input.
-
#description ⇒ Object
human readable description.
-
#modeler_description ⇒ Object
human readable description of modeling approach.
-
#name ⇒ Object
human readable name.
-
#run(model, runner, user_arguments) ⇒ Object
define what happens when the measure is run.
Instance Method Details
#arguments(model) ⇒ Object
define the arguments that the user will input
27 28 29 30 31 |
# File 'lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/measure.rb', line 27 def arguments(model) args = OpenStudio::Measure::OSArgumentVector.new return args end |
#description ⇒ Object
human readable description
17 18 19 |
# File 'lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/measure.rb', line 17 def description return 'If any spaces are not part of a thermal zone, then this measure will create a new thermal zone and assign it to the space.' end |
#modeler_description ⇒ Object
human readable description of modeling approach
22 23 24 |
# File 'lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/measure.rb', line 22 def modeler_description return 'Thermal zones will be named after the spac with a prefix added' end |
#name ⇒ Object
human readable name
12 13 14 |
# File 'lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/measure.rb', line 12 def name return 'Create and Assign Thermal Zones for Unassigned Spaces' end |
#run(model, runner, user_arguments) ⇒ Object
define what happens when the measure is run
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/measures/create_and_assign_thermal_zones_for_unassigned_spaces/measure.rb', line 34 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 # report initial condition of model runner.registerInitialCondition("The building started with #{model.getThermalZones.size} thermal zones.") # loop through spaces model.getSpaces.sort.each do |space| # if space doesn't have zone, then add, rename and assign if !space.thermalZone.is_initialized zone = OpenStudio::Model::ThermalZone.new(model) zone.setName("Zone - #{space.name.get}") space.setThermalZone(zone) runner.registerInfo("Assigning #{space.name} to new thermal zone named #{zone.name}") end end # report final condition of model runner.registerFinalCondition("The building finished with #{model.getThermalZones.size} thermal zones.") return true end |