Class: ShiftScheduleByType_Test

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/measures/ShiftScheduleByType/tests/ShiftScheduleByType_Test.rb

Instance Method Summary collapse

Instance Method Details

#test_ShiftScheduleByType_aObject



14
15
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
# File 'lib/measures/ShiftScheduleByType/tests/ShiftScheduleByType_Test.rb', line 14

def test_ShiftScheduleByType_a
  # create an instance of the measure
  measure = ShiftScheduleByType.new

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

  # load the test model
  translator = OpenStudio::OSVersion::VersionTranslator.new
  path = OpenStudio::Path.new(File.dirname(__FILE__) + '/3Story2Space.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)

  shift_value = arguments[0].clone
  assert(shift_value.setValue(1.5))
  argument_map['shift_value'] = shift_value

  schedchoice = arguments[1].clone
  assert(schedchoice.setValue('CoolHeat'))
  argument_map['schedchoice'] = schedchoice

  measure.run(model, runner, argument_map)
  result = runner.result
  show_output(result)
  assert(result.value.valueName == 'Success')
  assert(result.warnings.empty?)
  # assert(result.info.size == 5)

  # save the model
  # output_file_path = OpenStudio::Path.new('C:\SVN_Utilities\OpenStudio\measures\test.osm')
  # model.save(output_file_path,true)
end

#test_ShiftScheduleByType_all_schedulesObject



90
91
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
# File 'lib/measures/ShiftScheduleByType/tests/ShiftScheduleByType_Test.rb', line 90

def test_ShiftScheduleByType_all_schedules
  # create an instance of the measure
  measure = ShiftScheduleByType.new

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

  # load the test model
  translator = OpenStudio::OSVersion::VersionTranslator.new
  path = OpenStudio::Path.new(File.dirname(__FILE__) + '/3Story2Space.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)

  shift_value = arguments[0].clone
  assert(shift_value.setValue(-6.0))
  argument_map['shift_value'] = shift_value

  schedchoice = arguments[1].clone
  assert(schedchoice.setValue('CoolHeat'))
  argument_map['schedchoice'] = schedchoice

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

  # save the model
  # output_file_path = OpenStudio::Path.new('C:\SVN_Utilities\OpenStudio\measures\test.osm')
  # model.save(output_file_path,true)
end

#test_ShiftScheduleByType_bObject



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
# File 'lib/measures/ShiftScheduleByType/tests/ShiftScheduleByType_Test.rb', line 52

def test_ShiftScheduleByType_b
  # create an instance of the measure
  measure = ShiftScheduleByType.new

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

  # load the test model
  translator = OpenStudio::OSVersion::VersionTranslator.new
  path = OpenStudio::Path.new(File.dirname(__FILE__) + '/3Story2Space.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)

  shift_value = arguments[0].clone
  assert(shift_value.setValue(-6.0))
  argument_map['shift_value'] = shift_value

  schedchoice = arguments[1].clone
  assert(schedchoice.setValue('CoolHeat'))
  argument_map['schedchoice'] = schedchoice

  measure.run(model, runner, argument_map)
  result = runner.result
  show_output(result)
  assert(result.value.valueName == 'Success')
  assert(result.warnings.empty?)
  # assert(result.info.size == 5)

  # save the model
  # output_file_path = OpenStudio::Path.new('C:\SVN_Utilities\OpenStudio\measures\test.osm')
  # model.save(output_file_path,true)
end

#test_ShiftScheduleByType_NAObject



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
# File 'lib/measures/ShiftScheduleByType/tests/ShiftScheduleByType_Test.rb', line 128

def test_ShiftScheduleByType_NA
  # create an instance of the measure
  measure = ShiftScheduleByType.new

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

  # load the test model
  translator = OpenStudio::OSVersion::VersionTranslator.new
  path = OpenStudio::Path.new(File.dirname(__FILE__) + '/3Story2Space.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)

  shift_value = arguments[0].clone
  assert(shift_value.setValue(24))
  argument_map['shift_value'] = shift_value

  schedchoice = arguments[1].clone
  assert(schedchoice.setValue('CoolHeat'))
  argument_map['schedchoice'] = schedchoice

  measure.run(model, runner, argument_map)
  result = runner.result
  show_output(result)
  assert(result.value.valueName == 'NA')

  # save the model
  # output_file_path = OpenStudio::Path.new('C:\SVN_Utilities\OpenStudio\measures\test.osm')
  # model.save(output_file_path,true)
end