Class: RubyPvWatts
- Inherits:
-
Object
- Object
- RubyPvWatts
- Includes:
- HTTParty
- Defined in:
- lib/ruby_pvwatts.rb,
lib/ruby_pvwatts/version.rb
Overview
Creates the wrapper object for querying NREL PVWatts. Uses the JSON API provided by NREL. More information is available at developer.nrel.gov/docs/solar/pvwatts-v5/
Constant Summary collapse
- VERSION =
'0.0.2'
Instance Method Summary collapse
- #ac ⇒ Object (also: #hourly_ac_output)
- #ac_monthly ⇒ Object
- #dc ⇒ Object (also: #hourly_diffuse_irradiance)
- #dc_monthly ⇒ Object
- #df ⇒ Object
- #dn ⇒ Object (also: #hourly_beam_normal_irradiance)
-
#initialize(api_key, opts) ⇒ RubyPvWatts
constructor
Required Parameters.
- #poa ⇒ Object (also: #hourly_plane_of_array_irradiance)
- #poa_monthly ⇒ Object
- #solrad_annual ⇒ Object
- #solrad_monthly ⇒ Object
- #tamb ⇒ Object (also: #hourly_ambient_temperature)
- #tcell ⇒ Object (also: #hourly_module_temperature)
- #wspd ⇒ Object (also: #hourly_windspeed)
Constructor Details
#initialize(api_key, opts) ⇒ RubyPvWatts
Required Parameters
These are the minimum fields required to use the API. Support for file_id has not been implemented. Additionally, the callback option is not supported.
- :
system_capacity
: -
Nameplate capacity (kW) Range: 0.05 to 500000
- :
module_type
: -
Module Type. 0=standard 1=premium 2=thin film
- :
losses
: -
System losses (percent). Range -5 to 99
- :
array_type
: -
Array Type
0 = Fixed - Open Rack
1 = Fixed - Roof Mounted
2 = 1-Axis
3 = 1-Axis Backtracking
4 = 2-Axis
- :
tilt
: -
Tilt angle (degrees). range: 0 to 90
- :
azimuth
: -
Azimuth angle (degrees) Range: 0 to 359
Conditional Params
- :
address
: -
The address to use. (lat/lon returned by Google’s geocoding
service). Required if lat/lon is not specified
- :
lat
: -
The latitude for the location in use. Required if address is not
specified.
- :
lon
: -
The longitude for the location in use. Required if address is not
specified.
Optional Parameters
- :
dataset
: -
The climate dataset to use.
tmy2 = TMY2 station data (see http://rredc.nrel.gov/solar/old_data/nsrdb/1961-1990/tmy2/State.html)
tmy3 = TMY3 station data (see http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/tmy3/by_USAFN.html)
intl = International station data
- :
radius
: -
The search radius to use when searching for the closest
climate data station (miles). Pass in radius=0 to use the closest
station regardless of the distance.
- :
timeframe
: -
Granularity of the output response
- :
dc_ac_ratio
: -
DC to AC ratio
- :
gcr
: -
Ground coverage ratio
- :
inv_eff
: -
Inverter efficiency at rated power.
60 61 62 63 |
# File 'lib/ruby_pvwatts.rb', line 60 def initialize(api_key, opts) = { query: { api_key: api_key }.merge(opts) } @response = self.class.get('/api/pvwatts/v5.json', ) end |
Instance Method Details
#ac ⇒ Object Also known as: hourly_ac_output
85 86 87 88 |
# File 'lib/ruby_pvwatts.rb', line 85 def ac return nil unless @response['inputs']['timeframe'] == 'hourly' @response['outputs']['ac'] end |
#ac_monthly ⇒ Object
73 74 75 |
# File 'lib/ruby_pvwatts.rb', line 73 def ac_monthly @response['outputs']['ac_monthly'] end |
#dc ⇒ Object Also known as: hourly_diffuse_irradiance
100 101 102 103 |
# File 'lib/ruby_pvwatts.rb', line 100 def dc return nil unless @response['inputs']['timeframe'] == 'hourly' @response['outputs']['dc'] end |
#dc_monthly ⇒ Object
69 70 71 |
# File 'lib/ruby_pvwatts.rb', line 69 def dc_monthly @response['outputs']['dc_monthly'] end |
#df ⇒ Object
105 106 107 108 |
# File 'lib/ruby_pvwatts.rb', line 105 def df return nil unless @response['inputs']['timeframe'] == 'hourly' @response['outputs']['df'] end |
#dn ⇒ Object Also known as: hourly_beam_normal_irradiance
95 96 97 98 |
# File 'lib/ruby_pvwatts.rb', line 95 def dn return nil unless @response['inputs']['timeframe'] == 'hourly' @response['outputs']['dn'] end |
#poa ⇒ Object Also known as: hourly_plane_of_array_irradiance
90 91 92 93 |
# File 'lib/ruby_pvwatts.rb', line 90 def poa return nil unless @response['inputs']['timeframe'] == 'hourly' @response['outputs']['poa'] end |
#poa_monthly ⇒ Object
65 66 67 |
# File 'lib/ruby_pvwatts.rb', line 65 def poa_monthly @response['outputs']['poa_monthly'] end |
#solrad_annual ⇒ Object
81 82 83 |
# File 'lib/ruby_pvwatts.rb', line 81 def solrad_annual @response['outputs']['solrad_annual'] end |
#solrad_monthly ⇒ Object
77 78 79 |
# File 'lib/ruby_pvwatts.rb', line 77 def solrad_monthly @response['outputs']['solrad_monthly'] end |
#tamb ⇒ Object Also known as: hourly_ambient_temperature
110 111 112 113 |
# File 'lib/ruby_pvwatts.rb', line 110 def tamb return nil unless @response['inputs']['timeframe'] == 'hourly' @response['outputs']['tamb'] end |
#tcell ⇒ Object Also known as: hourly_module_temperature
115 116 117 118 |
# File 'lib/ruby_pvwatts.rb', line 115 def tcell return nil unless @response['inputs']['timeframe'] == 'hourly' @response['outputs']['tcell'] end |
#wspd ⇒ Object Also known as: hourly_windspeed
120 121 122 123 |
# File 'lib/ruby_pvwatts.rb', line 120 def wspd return nil unless @response['inputs']['timeframe'] == 'hourly' @response['outputs']['wspd'] end |