Module: BTAP::Reports
- Defined in:
- lib/openstudio-standards/btap/btap.rb
Class Method Summary collapse
-
.all_output_variables(model, frequency) ⇒ OpenStudio::Model::Model
This turns all output on.
-
.clear_output_variables(model) ⇒ OpenStudio::Model::Model
This method clears all the output variables to make simulations run faster or to start fresh.
-
.get_possible_output_variables(model) ⇒ Array<String>
This method returns a vector of the results that are available in the current model.
-
.set_output_variables(model, frequency, output_variable_array) ⇒ OpenStudio::Model::Model
This method sets up some predetermined output variables.
Class Method Details
.all_output_variables(model, frequency) ⇒ OpenStudio::Model::Model
This turns all output on. Warning: Long runtimes will result.
219 220 221 222 |
# File 'lib/openstudio-standards/btap/btap.rb', line 219 def self.all_output_variables(model,frequency) BTAP::Reports::set_output_variables(model, frequency, BTAP::Reports::get_possible_output_variables(model)) return model end |
.clear_output_variables(model) ⇒ OpenStudio::Model::Model
This method clears all the output variables to make simulations run faster or to start fresh.
206 207 208 209 210 211 212 |
# File 'lib/openstudio-standards/btap/btap.rb', line 206 def self.clear_output_variables(model) #remove existing outputs model.getOutputVariables.sort.each do |object| object.remove end return model end |
.get_possible_output_variables(model) ⇒ Array<String>
This method returns a vector of the results that are available in the current model.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/openstudio-standards/btap/btap.rb', line 229 def self.get_possible_output_variables( model ) #Run simulation copy = BTAP::FileIO::deep_copy(model) copy.building.get.setName("rdd_run") BTAP::SimulationSettings::set_run_period(copy, 1, 1, 1, 1) BTAP::SimManager::run_simulation(copy,"C:\\temp\\rdd_maker") rdd_file_path = "" Find.find("C:\\temp\\rdd_maker") do |path| rdd_file_path = path if path =~ /.*\.rdd$/ end contents = File.read(rdd_file_path) output_variables = Array.new() contents.each do |line| match = line.match /^\s*Output:Variable,\*,(.*),(.*);(.*)/ if match output_variables.push(match[1]) end end return output_variables end |
.set_output_variables(model, frequency, output_variable_array) ⇒ OpenStudio::Model::Model
This method sets up some predetermined output variables. May take a while to run with these settings.
256 257 258 259 260 261 262 263 264 |
# File 'lib/openstudio-standards/btap/btap.rb', line 256 def self.set_output_variables(model,frequency, output_variable_array) raise("Frequency is not valid. Must by \"Hourly\" or \"Timestep\" but got #{frequency}.") unless ["Hourly","Timestep"].include?(frequency) output_variable_array.each do |variable| output = OpenStudio::Model::OutputVariable.new(variable,model) output.setKeyValue("*") output.setReportingFrequency(frequency) end return model end |