Class: GLHEProSetupExportLoadsforGroundHeatExchangerSizing

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

Overview

start the measure

Instance Method Summary collapse

Instance Method Details

#arguments(model) ⇒ Object

define the arguments that the user will input



23
24
25
26
27
# File 'lib/measures/GLHEProSetupExportLoadsforGroundHeatExchangerSizing/measure.rb', line 23

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

  return args
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



18
19
20
# File 'lib/measures/GLHEProSetupExportLoadsforGroundHeatExchangerSizing/measure.rb', line 18

def name
  return 'GLHEProSetupExportLoadsforGroundHeatExchangerSizing'
end

#run(model, runner, user_arguments) ⇒ Object

define what happens when the measure is run



30
31
32
33
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
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/measures/GLHEProSetupExportLoadsforGroundHeatExchangerSizing/measure.rb', line 30

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

  # Define the reporting frequency
  reporting_frequency = 'hourly'

  # Define the variables to report
  variable_names = []
  variable_names << 'District Heating Rate'
  variable_names << 'District Cooling Rate'

  # Request each output variable
  variable_names.each do |variable_name|
    output_variable = OpenStudio::Model::OutputVariable.new(variable_name, model)
    output_variable.setReportingFrequency(reporting_frequency)
    runner.registerInfo("Requested output for '#{output_variable.variableName}' at the #{output_variable.reportingFrequency} timestep.")
  end

  # Report the outlet node conditions for each plant loop in the model
  # Rename the outlet node so that it makes sense in the report
  outlet_node_variable_names = []
  outlet_node_variable_names << 'System Node Temperature'
  outlet_node_variable_names << 'System Node Setpoint Temperature'
  outlet_node_variable_names << 'System Node Mass Flow Rate'
  model.getPlantLoops.each do |plant_loop|
    outlet_node = plant_loop.supplyOutletNode
    outlet_node_name = "#{plant_loop.name} Supply Outlet Node"
    outlet_node.setName(outlet_node_name)
    outlet_node_variable_names.each do |outlet_node_variable_name|
      output_variable = OpenStudio::Model::OutputVariable.new(outlet_node_variable_name, model)
      output_variable.setKeyValue(outlet_node_name)
      output_variable.setReportingFrequency(reporting_frequency)
    end
  end

  return true
end