class EnergyPlus::EpwFile

Attributes

city[RW]
country[RW]
elevation[RW]
gmt[RW]
lat[RW]
lon[RW]
path[RW]
state[RW]
typ[RW]
url[RW]
wmo[RW]

Public Class Methods

new(path) click to toggle source
# File lib/energyplus/EpwFile.rb, line 38
def initialize(path)
  @path = Pathname.new(path)
  @city = ""
  @state = ""
  @country = ""
  @typ = ""
  @wmo = ""
  @lat = ""
  @lon = ""
  @gmt = ""
  @elevation = ""
  @url = ""
  init
end

Public Instance Methods

toKml(xml) click to toggle source
# File lib/energyplus/EpwFile.rb, line 53
def toKml(xml)
  xml.Placemark {
    xml.name @city
    xml.visibility "0"
    xml.description {
      xml.cdata!("<img src=\"kml/ep_header8.png\" width=180 align=right><br><table><tr><td colspan=\"2\">"+
                 "<b>#{@city}</b></href></td></tr>\n"+
       #"<tr><td></td><td><b>Data Type</td></tr>\n"+
       "<tr><td></td><td>WMO <b>#{@wmo}</b></td></tr>\n"+
       #"<tr><td></td><td>E   3� 15'   N 36� 43'</td></tr>\n"+
     #"<tr><td></td><td><b>25</b> m</td></tr>\n"+
     "<tr><td></td><td>Time Zone GMT <b>#{@gmt}</b> hours</td></tr>\n"+
     #"<tr><td></td><td>ASHRAE Std 169 Climate Zone <b>4A - Mixed - Humid</b></td></tr>\n"+
     #"<tr><td></td><td>99% Heating DB=<b>3.1</b>, 1% Cooling DB=<b>33.2</b></td></tr>\n"+
     #"<tr><td></td><td>HDD18 <b>1019</b>, CDD10 <b>2849</b></td></tr>\n"+
     "<tr><td></td><td>URL #{@url}</td></tr></table>")
    }
    xml.styleUrl "#weatherlocation"
    xml.Point {
      xml.altitudeMode "absolute"
      xml.coordinates "#{@lon},#{@lat},#{elevation}"
    }
  }
end
valid?() click to toggle source
# File lib/energyplus/EpwFile.rb, line 78
def valid?
  return @valid
end

Private Instance Methods

init() click to toggle source

initialize

# File lib/energyplus/EpwFile.rb, line 88
def init
  if @path.exist?
    rowCount = 0
    CSV.open(@path, 'r') do |row|
      rowCount += 1

      # LOCATION,Adak Nas,AK,USA,TMY3,704540,51.88,-176.65,-10.0,5.0
      @valid = true

      # process only header row
      if rowCount == 1
        @city = row[1].gsub("/","-")
        @state = row[2]
        @country = row[3]
        @typ = row[4]
        @wmo = row[5]
        @wmo = "wmoundefined" if @wmo.nil?
        @lat = row[6]
        @lon = row[7]
        @gmt = row[8]
        @elevation = row[9]
        break
      end


    end
  end
end