Class: EnableDemandControlledVentilation_Test

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/measures/Enable Demand Controlled Ventilation/tests/EnableDemandControlledVentilation_Test.rb

Instance Method Summary collapse

Instance Method Details

#test_DisableDemandControlledVentilationObject



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
90
91
92
# File 'lib/measures/Enable Demand Controlled Ventilation/tests/EnableDemandControlledVentilation_Test.rb', line 55

def test_DisableDemandControlledVentilation
  # create an instance of the measure
  measure = EnableDemandControlledVentilation.new

  # create an instance of a runner
  runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)

  # make an empty model
  model = OpenStudio::Model::Model.new

  # get arguments and test that they are what we are expecting
  arguments = measure.arguments(model)
  assert_equal(1, arguments.size)

  # load the test model
  translator = OpenStudio::OSVersion::VersionTranslator.new
  path = OpenStudio::Path.new(File.dirname(__FILE__) + '/0320_ModelWithHVAC_01.osm')
  model = translator.loadModel(path)
  assert(!model.empty?)
  model = model.get

  # set argument values to good values and run the measure on model with spaces
  arguments = measure.arguments(model)
  argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)

  count = -1

  dcv_type = arguments[count += 1].clone
  assert(dcv_type.setValue('DisableDCV'))
  argument_map['dcv_type'] = dcv_type

  measure.run(model, runner, argument_map)
  result = runner.result
  show_output(result)
  assert(result.value.valueName == 'NA')
  # assert(result.warnings.size == 2)
  # assert(result.info.size == 1)
end

#test_EnableDemandControlledVentilationObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/measures/Enable Demand Controlled Ventilation/tests/EnableDemandControlledVentilation_Test.rb', line 16

def test_EnableDemandControlledVentilation
  # create an instance of the measure
  measure = EnableDemandControlledVentilation.new

  # create an instance of a runner
  runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)

  # make an empty model
  model = OpenStudio::Model::Model.new

  # get arguments and test that they are what we are expecting
  arguments = measure.arguments(model)
  assert_equal(1, arguments.size)

  # load the test model
  translator = OpenStudio::OSVersion::VersionTranslator.new
  path = OpenStudio::Path.new(File.dirname(__FILE__) + '/0320_ModelWithHVAC_01.osm')
  model = translator.loadModel(path)
  assert(!model.empty?)
  model = model.get

  # set argument values to good values and run the measure on model with spaces
  arguments = measure.arguments(model)
  argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)

  count = -1

  dcv_type = arguments[count += 1].clone
  assert(dcv_type.setValue('EnableDCV'))
  argument_map['dcv_type'] = dcv_type

  measure.run(model, runner, argument_map)
  result = runner.result
  show_output(result)
  assert(result.value.valueName == 'Success')
  # assert(result.warnings.size == 2)
  # assert(result.info.size == 1)
end