Class: EnergyPlus::WaterMainsFile

Inherits:
Object
  • Object
show all
Defined in:
lib/energyplus/WaterMains.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWaterMainsFile

Returns a new instance of WaterMainsFile.



29
30
31
32
# File 'lib/energyplus/WaterMains.rb', line 29

def initialize
  @ave_outdoor_db_t = -9999
  @max_diff_outdoor_db_t = -9999
end

Instance Attribute Details

#ave_outdoor_db_tObject

Returns the value of attribute ave_outdoor_db_t.



26
27
28
# File 'lib/energyplus/WaterMains.rb', line 26

def ave_outdoor_db_t
  @ave_outdoor_db_t
end

#max_diff_outdoor_db_tObject

Returns the value of attribute max_diff_outdoor_db_t.



27
28
29
# File 'lib/energyplus/WaterMains.rb', line 27

def max_diff_outdoor_db_t
  @max_diff_outdoor_db_t
end

#validObject

Returns the value of attribute valid.



25
26
27
# File 'lib/energyplus/WaterMains.rb', line 25

def valid
  @valid
end

Instance Method Details

#idf_snippetObject



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/energyplus/WaterMains.rb', line 42

def idf_snippet
  result = nil

  if valid?
    result  = "Site:WaterMainsTemperature,\n"
    result += "  CORRELATION,             !- Calculation Method\n"
    result += "  ,                        !- Temperature Schedule Name\n"
    result += "  #{@ave_outdoor_db_t},               !- Annual Average Outdoor Air Temperature {C}\n"
    result += "  #{@max_diff_outdoor_db_t};              !- Maximum Difference In Monthly Average Outdoor Air Temperatures {deltaC}\n"
  end

  return result
end

#valid?Boolean

Returns:

  • (Boolean)


34
35
36
37
38
39
40
# File 'lib/energyplus/WaterMains.rb', line 34

def valid?
  if @ave_outdoor_db_t != -9999 and @max_diff_outdoor_db_t != -9999
    result = true
  else
    result = false
  end
end

#write_idf_snippet(filename) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/energyplus/WaterMains.rb', line 56

def write_idf_snippet(filename)
  if valid?
    File.delete(filename) if File.exists?(filename)
    File.open(filename, 'w') do |fl|
  #add version identifier to file
    fl << "\nVersion,\n  7.1;                                    ! Version Identifier \n\n"
      fl << idf_snippet
    end
  else
    puts "[WaterMains] ERROR ****** No Temperatures #{filename}"
  end
end