Class: DEERSpaceTypeAndConstructionSetWizard

Inherits:
OpenStudio::Measure::ModelMeasure
  • Object
show all
Defined in:
lib/measures/deer_space_type_and_construction_set_wizard/measure.rb

Overview

start the measure

Instance Method Summary collapse

Instance Method Details

#arguments(model) ⇒ Object

define the arguments that the user will input



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/measures/deer_space_type_and_construction_set_wizard/measure.rb', line 36

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

  # Make an argument for the building type
  building_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('building_type', OpenstudioStandards::CreateTypical.get_deer_building_types, true)
  building_type.setDisplayName('Building Type.')
  building_type.setDefaultValue('Asm')
  args << building_type

  # Make an argument for the template
  template = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', OpenstudioStandards::CreateTypical.get_deer_templates, true)
  template.setDisplayName('Template.')
  template.setDefaultValue('DEER 2017')
  args << template

  # Make an argument for the climate zone
  climate_zone = OpenStudio::Measure::OSArgument.makeChoiceArgument('climate_zone', OpenstudioStandards::CreateTypical.get_deer_climate_zones, true)
  climate_zone.setDisplayName('Climate Zone.')
  climate_zone.setDefaultValue('CEC T24-CEC8')
  args << climate_zone

  # make an argument to add new space types
  create_space_types = OpenStudio::Measure::OSArgument.makeBoolArgument('create_space_types', true)
  create_space_types.setDisplayName('Create Space Types?')
  create_space_types.setDefaultValue(true)
  args << create_space_types

  # make an argument to add new construction set
  create_construction_set = OpenStudio::Measure::OSArgument.makeBoolArgument('create_construction_set', true)
  create_construction_set.setDisplayName('Create Construction Set?')
  create_construction_set.setDefaultValue(true)
  args << create_construction_set

  # make an argument to determine if building defaults should be set
  set_building_defaults = OpenStudio::Measure::OSArgument.makeBoolArgument('set_building_defaults', true)
  set_building_defaults.setDisplayName('Set Building Defaults Using New Objects?')
  set_building_defaults.setDefaultValue(true)
  args << set_building_defaults

  return args
end

#descriptionObject

human readable description



26
27
28
# File 'lib/measures/deer_space_type_and_construction_set_wizard/measure.rb', line 26

def description
  return 'Create DEER space types and or construction sets for the requested building type, climate zone, and target.'
end

#modeler_descriptionObject

human readable description of modeling approach



31
32
33
# File 'lib/measures/deer_space_type_and_construction_set_wizard/measure.rb', line 31

def modeler_description
  return 'The data for this measure comes from the openstudio-standards Ruby Gem. They are no longer created from the same JSON file that was used to make the OpenStudio templates. Optionally this will also set the building default space type and construction set.'
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



21
22
23
# File 'lib/measures/deer_space_type_and_construction_set_wizard/measure.rb', line 21

def name
  return 'DEER Space Type and Construction Set Wizard'
end

#run(model, runner, user_arguments) ⇒ Object

define what happens when the measure is run



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/measures/deer_space_type_and_construction_set_wizard/measure.rb', line 79

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

  # assign the user inputs to variables
  args = runner.getArgumentValues(arguments(model), user_arguments)
  args = Hash[args.collect{ |k, v| [k.to_s, v] }]
  if !args then return false end

  # run create_space_types_and_constructions
  results = OpenstudioStandards::CreateTypical.create_space_types_and_constructions(model, args['building_type'], args['template'], args['climate_zone'])

  if results == false
    return false
  else
    return true
  end
end