ruby_pvwatts 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +96 -0
- data/Guardfile +77 -0
- data/LICENSE +20 -0
- data/Rakefile +1 -0
- data/bin/_guard-core +16 -0
- data/bin/guard +16 -0
- data/lib/ruby_pvwatts/version.rb +3 -0
- data/lib/ruby_pvwatts.rb +132 -0
- data/ruby_pvwatts.gemspec +30 -0
- data/spec/ruby_pvwatts_spec.rb +120 -0
- data/spec/spec_helper.rb +7 -0
- data/tasks/rspec.rake +3 -0
- metadata +186 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5cb8e30db5df3dcdaf71aed6368e9379d3fd3442
|
4
|
+
data.tar.gz: cbc44c6f9c44e2365cd5a02a9b4f21aaf0cc7d45
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8d5b5a78b3125306f1367e4c2a7b0a6f7e93c5dcb4a17eaad36e51b98bad427d14909bb2c89d9bcd24d3aa70aa20c9278f4dc7600438708e26efd32085f06479
|
7
|
+
data.tar.gz: 373542ac62e583db1534333ef1eea2551ffd3a11d8df6fa4ee7ff26d3a82de3aa896176d182f1c3e70d45b5734bd1278448739e05431fdbbc0371052510db0fa
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ruby_pvwatts (0.0.2)
|
5
|
+
httparty (~> 0.13.3)
|
6
|
+
json (~> 1.8)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.3.7)
|
12
|
+
celluloid (0.16.0)
|
13
|
+
timers (~> 4.0.0)
|
14
|
+
coderay (1.1.0)
|
15
|
+
crack (0.4.2)
|
16
|
+
safe_yaml (~> 1.0.0)
|
17
|
+
diff-lcs (1.2.5)
|
18
|
+
docile (1.1.5)
|
19
|
+
ffi (1.9.8)
|
20
|
+
formatador (0.2.5)
|
21
|
+
guard (2.12.5)
|
22
|
+
formatador (>= 0.2.4)
|
23
|
+
listen (~> 2.7)
|
24
|
+
lumberjack (~> 1.0)
|
25
|
+
nenv (~> 0.1)
|
26
|
+
notiffany (~> 0.0)
|
27
|
+
pry (>= 0.9.12)
|
28
|
+
shellany (~> 0.0)
|
29
|
+
thor (>= 0.18.1)
|
30
|
+
guard-compat (1.2.1)
|
31
|
+
guard-rspec (4.5.0)
|
32
|
+
guard (~> 2.1)
|
33
|
+
guard-compat (~> 1.1)
|
34
|
+
rspec (>= 2.99.0, < 4.0)
|
35
|
+
hitimes (1.2.2)
|
36
|
+
httparty (0.13.3)
|
37
|
+
json (~> 1.8)
|
38
|
+
multi_xml (>= 0.5.2)
|
39
|
+
json (1.8.2)
|
40
|
+
listen (2.9.0)
|
41
|
+
celluloid (>= 0.15.2)
|
42
|
+
rb-fsevent (>= 0.9.3)
|
43
|
+
rb-inotify (>= 0.9)
|
44
|
+
lumberjack (1.0.9)
|
45
|
+
method_source (0.8.2)
|
46
|
+
multi_json (1.11.0)
|
47
|
+
multi_xml (0.5.5)
|
48
|
+
nenv (0.2.0)
|
49
|
+
notiffany (0.0.6)
|
50
|
+
nenv (~> 0.1)
|
51
|
+
shellany (~> 0.0)
|
52
|
+
pry (0.10.1)
|
53
|
+
coderay (~> 1.1.0)
|
54
|
+
method_source (~> 0.8.1)
|
55
|
+
slop (~> 3.4)
|
56
|
+
rb-fsevent (0.9.4)
|
57
|
+
rb-inotify (0.9.5)
|
58
|
+
ffi (>= 0.5.0)
|
59
|
+
rspec (3.2.0)
|
60
|
+
rspec-core (~> 3.2.0)
|
61
|
+
rspec-expectations (~> 3.2.0)
|
62
|
+
rspec-mocks (~> 3.2.0)
|
63
|
+
rspec-core (3.2.2)
|
64
|
+
rspec-support (~> 3.2.0)
|
65
|
+
rspec-expectations (3.2.0)
|
66
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
+
rspec-support (~> 3.2.0)
|
68
|
+
rspec-mocks (3.2.1)
|
69
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
70
|
+
rspec-support (~> 3.2.0)
|
71
|
+
rspec-support (3.2.2)
|
72
|
+
safe_yaml (1.0.4)
|
73
|
+
shellany (0.0.1)
|
74
|
+
simplecov (0.9.2)
|
75
|
+
docile (~> 1.1.0)
|
76
|
+
multi_json (~> 1.0)
|
77
|
+
simplecov-html (~> 0.9.0)
|
78
|
+
simplecov-html (0.9.0)
|
79
|
+
slop (3.6.0)
|
80
|
+
thor (0.19.1)
|
81
|
+
timers (4.0.1)
|
82
|
+
hitimes
|
83
|
+
webmock (1.20.4)
|
84
|
+
addressable (>= 2.3.6)
|
85
|
+
crack (>= 0.3.2)
|
86
|
+
|
87
|
+
PLATFORMS
|
88
|
+
ruby
|
89
|
+
|
90
|
+
DEPENDENCIES
|
91
|
+
guard (~> 2.12, >= 2.12.5)
|
92
|
+
guard-rspec (~> 4.5, >= 4.5.0)
|
93
|
+
rspec (~> 3.2, >= 3.2.0)
|
94
|
+
ruby_pvwatts!
|
95
|
+
simplecov (~> 0.9, >= 0.9.2)
|
96
|
+
webmock (~> 1.20, >= 1.20.4)
|
data/Guardfile
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features)
|
6
|
+
|
7
|
+
## Uncomment to clear the screen before every task
|
8
|
+
# clearing :on
|
9
|
+
|
10
|
+
## Guard internally checks for changes in the Guardfile and exits.
|
11
|
+
## If you want Guard to automatically start up again, run guard in a
|
12
|
+
## shell loop, e.g.:
|
13
|
+
##
|
14
|
+
## $ while bundle exec guard; do echo "Restarting Guard..."; done
|
15
|
+
##
|
16
|
+
## Note: if you are using the `directories` clause above and you are not
|
17
|
+
## watching the project directory ('.'), then you will want to move
|
18
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
19
|
+
#
|
20
|
+
# $ mkdir config
|
21
|
+
# $ mv Guardfile config/
|
22
|
+
# $ ln -s config/Guardfile .
|
23
|
+
#
|
24
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
25
|
+
|
26
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
27
|
+
# rspec may be run, below are examples of the most common uses.
|
28
|
+
# * bundler: 'bundle exec rspec'
|
29
|
+
# * bundler binstubs: 'bin/rspec'
|
30
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
31
|
+
# installed the spring binstubs per the docs)
|
32
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
33
|
+
# * 'just' rspec: 'rspec'
|
34
|
+
|
35
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
36
|
+
require "guard/rspec/dsl"
|
37
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
38
|
+
|
39
|
+
# Feel free to open issues for suggestions and improvements
|
40
|
+
|
41
|
+
# RSpec files
|
42
|
+
rspec = dsl.rspec
|
43
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
44
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
45
|
+
watch(rspec.spec_files)
|
46
|
+
|
47
|
+
# Ruby files
|
48
|
+
ruby = dsl.ruby
|
49
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
50
|
+
|
51
|
+
# Rails files
|
52
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
53
|
+
dsl.watch_spec_files_for(rails.app_files)
|
54
|
+
dsl.watch_spec_files_for(rails.views)
|
55
|
+
|
56
|
+
watch(rails.controllers) do |m|
|
57
|
+
[
|
58
|
+
rspec.spec.("routing/#{m[1]}_routing"),
|
59
|
+
rspec.spec.("controllers/#{m[1]}_controller"),
|
60
|
+
rspec.spec.("acceptance/#{m[1]}")
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
# Rails config changes
|
65
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
66
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
67
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
68
|
+
|
69
|
+
# Capybara features specs
|
70
|
+
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
71
|
+
|
72
|
+
# Turnip features and steps
|
73
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
74
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
75
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
76
|
+
end
|
77
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 Shad Self
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Dir.glob('tasks/**/*.rake').each(&method(:import))
|
data/bin/_guard-core
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application '_guard-core' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('guard', '_guard-core')
|
data/bin/guard
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'guard' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('guard', 'guard')
|
data/lib/ruby_pvwatts.rb
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
# Creates the wrapper object for querying NREL PVWatts. Uses the JSON
|
6
|
+
# API provided by NREL. More information is available at
|
7
|
+
# http://developer.nrel.gov/docs/solar/pvwatts-v5/
|
8
|
+
#
|
9
|
+
# @params [String] api_key Obtained from http://developer.nrel.gov/signup
|
10
|
+
#
|
11
|
+
# @author Shad Self
|
12
|
+
#
|
13
|
+
class RubyPvWatts
|
14
|
+
include HTTParty
|
15
|
+
|
16
|
+
base_uri 'https://developer.nrel.gov'
|
17
|
+
format :json
|
18
|
+
|
19
|
+
# == Required Parameters
|
20
|
+
#
|
21
|
+
# These are the minimum fields required to use the API.
|
22
|
+
# Support for file_id has not been implemented. Additionally, the callback
|
23
|
+
# option is not supported.
|
24
|
+
#
|
25
|
+
# [:+system_capacity+:] Nameplate capacity (kW) Range: 0.05 to 500000
|
26
|
+
# [:+module_type+:] Module Type. 0=standard 1=premium 2=thin film
|
27
|
+
# [:+losses+:] System losses (percent). Range -5 to 99
|
28
|
+
# [:+array_type+:] Array Type
|
29
|
+
# 0 = Fixed - Open Rack
|
30
|
+
# 1 = Fixed - Roof Mounted
|
31
|
+
# 2 = 1-Axis
|
32
|
+
# 3 = 1-Axis Backtracking
|
33
|
+
# 4 = 2-Axis
|
34
|
+
# [:+tilt+:] Tilt angle (degrees). range: 0 to 90
|
35
|
+
# [:+azimuth+:] Azimuth angle (degrees) Range: 0 to 359
|
36
|
+
#
|
37
|
+
# == Conditional Params
|
38
|
+
#
|
39
|
+
# [:+address+:] The address to use. (lat/lon returned by Google's geocoding
|
40
|
+
# service). Required if lat/lon is not specified
|
41
|
+
# [:+lat+:] The latitude for the location in use. Required if address is not
|
42
|
+
# specified.
|
43
|
+
# [:+lon+:] The longitude for the location in use. Required if address is not
|
44
|
+
# specified.
|
45
|
+
#
|
46
|
+
# == Optional Parameters
|
47
|
+
#
|
48
|
+
# [:+dataset+:] The climate dataset to use.
|
49
|
+
# tmy2 = TMY2 station data (see http://rredc.nrel.gov/solar/old_data/nsrdb/1961-1990/tmy2/State.html)
|
50
|
+
# tmy3 = TMY3 station data (see http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/tmy3/by_USAFN.html)
|
51
|
+
# intl = International station data
|
52
|
+
# [:+radius+:] The search radius to use when searching for the closest
|
53
|
+
# climate data station (miles). Pass in radius=0 to use the closest
|
54
|
+
# station regardless of the distance.
|
55
|
+
# [:+timeframe+:] Granularity of the output response
|
56
|
+
# [:+dc_ac_ratio+:] DC to AC ratio
|
57
|
+
# [:+gcr+:] Ground coverage ratio
|
58
|
+
# [:+inv_eff+:] Inverter efficiency at rated power.
|
59
|
+
#
|
60
|
+
def initialize(api_key, opts)
|
61
|
+
options = { query: { api_key: api_key }.merge(opts) }
|
62
|
+
@response = self.class.get('/api/pvwatts/v5.json', options)
|
63
|
+
end
|
64
|
+
|
65
|
+
def poa_monthly
|
66
|
+
@response['outputs']['poa_monthly']
|
67
|
+
end
|
68
|
+
|
69
|
+
def dc_monthly
|
70
|
+
@response['outputs']['dc_monthly']
|
71
|
+
end
|
72
|
+
|
73
|
+
def ac_monthly
|
74
|
+
@response['outputs']['ac_monthly']
|
75
|
+
end
|
76
|
+
|
77
|
+
def solrad_monthly
|
78
|
+
@response['outputs']['solrad_monthly']
|
79
|
+
end
|
80
|
+
|
81
|
+
def solrad_annual
|
82
|
+
@response['outputs']['solrad_annual']
|
83
|
+
end
|
84
|
+
|
85
|
+
def ac
|
86
|
+
return nil unless @response['inputs']['timeframe'] == 'hourly'
|
87
|
+
@response['outputs']['ac']
|
88
|
+
end
|
89
|
+
|
90
|
+
def poa
|
91
|
+
return nil unless @response['inputs']['timeframe'] == 'hourly'
|
92
|
+
@response['outputs']['poa']
|
93
|
+
end
|
94
|
+
|
95
|
+
def dn
|
96
|
+
return nil unless @response['inputs']['timeframe'] == 'hourly'
|
97
|
+
@response['outputs']['dn']
|
98
|
+
end
|
99
|
+
|
100
|
+
def dc
|
101
|
+
return nil unless @response['inputs']['timeframe'] == 'hourly'
|
102
|
+
@response['outputs']['dc']
|
103
|
+
end
|
104
|
+
|
105
|
+
def df
|
106
|
+
return nil unless @response['inputs']['timeframe'] == 'hourly'
|
107
|
+
@response['outputs']['df']
|
108
|
+
end
|
109
|
+
|
110
|
+
def tamb
|
111
|
+
return nil unless @response['inputs']['timeframe'] == 'hourly'
|
112
|
+
@response['outputs']['tamb']
|
113
|
+
end
|
114
|
+
|
115
|
+
def tcell
|
116
|
+
return nil unless @response['inputs']['timeframe'] == 'hourly'
|
117
|
+
@response['outputs']['tcell']
|
118
|
+
end
|
119
|
+
|
120
|
+
def wspd
|
121
|
+
return nil unless @response['inputs']['timeframe'] == 'hourly'
|
122
|
+
@response['outputs']['wspd']
|
123
|
+
end
|
124
|
+
|
125
|
+
alias_method :hourly_ac_output, :ac
|
126
|
+
alias_method :hourly_plane_of_array_irradiance, :poa
|
127
|
+
alias_method :hourly_beam_normal_irradiance, :dn
|
128
|
+
alias_method :hourly_diffuse_irradiance, :dc
|
129
|
+
alias_method :hourly_ambient_temperature, :tamb
|
130
|
+
alias_method :hourly_module_temperature, :tcell
|
131
|
+
alias_method :hourly_windspeed, :wspd
|
132
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'lib/ruby_pvwatts/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'ruby_pvwatts'
|
5
|
+
s.version = RubyPvWatts::VERSION
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.authors = ['Shad Self']
|
8
|
+
s.email = 'shad@greensandstudio.com'
|
9
|
+
s.licenses = ['MIT']
|
10
|
+
s.homepage = 'http://github.com/discypher/ruby_pvwatts'
|
11
|
+
s.summary = 'PVWatts JSON API wrapper'
|
12
|
+
s.description = 'API wrapper for version 5 of NREL PVWatts JSON API.'
|
13
|
+
s.required_ruby_version = '>= 1.9.3'
|
14
|
+
|
15
|
+
s.required_rubygems_version = '>= 1.3.6'
|
16
|
+
s.rubyforge_project = 'ruby_pvwatts'
|
17
|
+
|
18
|
+
s.add_dependency 'httparty', '~> 0.13.3'
|
19
|
+
s.add_dependency 'json', '~> 1.8'
|
20
|
+
|
21
|
+
s.add_development_dependency 'guard', '~> 2.12', '>= 2.12.5'
|
22
|
+
s.add_development_dependency 'guard-rspec', '~> 4.5', '>= 4.5.0'
|
23
|
+
s.add_development_dependency 'rspec', '~> 3.2', '>= 3.2.0'
|
24
|
+
s.add_development_dependency 'simplecov', '~> 0.9', '>= 0.9.2'
|
25
|
+
s.add_development_dependency 'webmock', '~> 1.20', '>= 1.20.4'
|
26
|
+
|
27
|
+
s.files = `git ls-files`.split("\n")
|
28
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
29
|
+
s.require_paths = ['lib']
|
30
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RubyPvWatts do
|
4
|
+
before :each do
|
5
|
+
stub_request(:get, 'https://developer.nrel.gov/api/pvwatts/v5.json?address=825%20Coolidge%20Street%20Honolulu,%20HI%2096826&api_key=FAKE_API_KEY&array_type=1&azimuth=143&dataset=tmy3&losses=14&module_type=1&radius=0&system_capacity=5&tilt=22').
|
6
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent' => 'Ruby' }).
|
7
|
+
to_return(
|
8
|
+
status: 200, body: {
|
9
|
+
'inputs' => {
|
10
|
+
'system_capacity' => '5',
|
11
|
+
'module_type' => '1',
|
12
|
+
'losses' => '10',
|
13
|
+
'array_type' => '1',
|
14
|
+
'tilt' => '22',
|
15
|
+
'azimuth' => '143',
|
16
|
+
'address' => '825 Coolidge Street Honolulu, HI 96826'
|
17
|
+
},
|
18
|
+
'errors' => [],
|
19
|
+
'warnings' => [],
|
20
|
+
'version' => '1.0.2',
|
21
|
+
'ssc_info' => {
|
22
|
+
'version' => 34,
|
23
|
+
'build' => 'Unix 64 bit GNU/C++ Aug 18 2014 13:38:36'
|
24
|
+
},
|
25
|
+
'station_info' => {
|
26
|
+
'lat' => 21.33333396911621,
|
27
|
+
'lon' => -157.9166717529297,
|
28
|
+
'elev' => 5.0,
|
29
|
+
'tz' => -10.0,
|
30
|
+
'location' => '22521',
|
31
|
+
'city' => 'HONOLULU',
|
32
|
+
'state' => 'HI',
|
33
|
+
'solar_resource_file' => '22521.tm2',
|
34
|
+
'distance' => 10745
|
35
|
+
},
|
36
|
+
'outputs' => {
|
37
|
+
'ac_monthly' => [606.8814086914062,
|
38
|
+
607.4061279296875,
|
39
|
+
725.9041137695312,
|
40
|
+
696.5216064453125,
|
41
|
+
768.7184448242188,
|
42
|
+
738.2608642578125,
|
43
|
+
767.6920166015625,
|
44
|
+
777.3290405273438,
|
45
|
+
759.6552124023438,
|
46
|
+
693.6257934570312,
|
47
|
+
601.835693359375,
|
48
|
+
594.517333984375],
|
49
|
+
'poa_monthly' => [149.582763671875,
|
50
|
+
149.54965209960938,
|
51
|
+
179.41624450683594,
|
52
|
+
171.45758056640625,
|
53
|
+
190.11830139160156,
|
54
|
+
182.50790405273438,
|
55
|
+
189.84628295898438,
|
56
|
+
193.2172393798828,
|
57
|
+
189.14675903320312,
|
58
|
+
171.23056030273438,
|
59
|
+
148.53952026367188,
|
60
|
+
146.6793212890625],
|
61
|
+
'solrad_monthly' => [4.825250625610352,
|
62
|
+
5.34105920791626,
|
63
|
+
5.787621021270752,
|
64
|
+
5.715252876281738,
|
65
|
+
6.132848262786865,
|
66
|
+
6.083596706390381,
|
67
|
+
6.124073505401611,
|
68
|
+
6.232814311981201,
|
69
|
+
6.304892063140869,
|
70
|
+
5.523566246032715,
|
71
|
+
4.951317310333252,
|
72
|
+
4.73159122467041],
|
73
|
+
'dc_monthly' => [633.7515258789062,
|
74
|
+
634.22705078125,
|
75
|
+
757.9922485351562,
|
76
|
+
727.2393188476562,
|
77
|
+
802.2755737304688,
|
78
|
+
771.1595458984375,
|
79
|
+
801.5697021484375,
|
80
|
+
811.2010498046875,
|
81
|
+
792.720947265625,
|
82
|
+
724.122314453125,
|
83
|
+
628.6134643554688,
|
84
|
+
620.5930786132812],
|
85
|
+
'ac_annual' => 8338.3486328125,
|
86
|
+
'solrad_annual' => 5.6461567878723145
|
87
|
+
}
|
88
|
+
}.to_json,
|
89
|
+
headers: {})
|
90
|
+
|
91
|
+
@ruby_pvwatts = RubyPvWatts.new('FAKE_API_KEY',
|
92
|
+
system_capacity: 5, module_type: 1,
|
93
|
+
losses: 14, array_type: 1, tilt: 22,
|
94
|
+
azimuth: 143,
|
95
|
+
address: '825 Coolidge Street Honolulu, HI 96826',
|
96
|
+
dataset: 'tmy3', radius: 0)
|
97
|
+
end
|
98
|
+
|
99
|
+
describe 'Methods' do
|
100
|
+
it 'should have the correct value for poa_monthly' do
|
101
|
+
expect(@ruby_pvwatts.poa_monthly).to eq(
|
102
|
+
[149.582763671875, 149.54965209960938, 179.41624450683594,
|
103
|
+
171.45758056640625, 190.11830139160156, 182.50790405273438,
|
104
|
+
189.84628295898438, 193.2172393798828, 189.14675903320312,
|
105
|
+
171.23056030273438, 148.53952026367188, 146.6793212890625])
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'should have the correct value for solrad monthly' do
|
109
|
+
expect(@ruby_pvwatts.solrad_monthly).to eq(
|
110
|
+
[4.825250625610352, 5.34105920791626, 5.787621021270752,
|
111
|
+
5.715252876281738, 6.132848262786865, 6.083596706390381,
|
112
|
+
6.124073505401611, 6.232814311981201, 6.304892063140869,
|
113
|
+
5.523566246032715, 4.951317310333252, 4.73159122467041])
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'should have the correct value for solrad annual' do
|
117
|
+
expect(@ruby_pvwatts.solrad_annual).to eq(5.6461567878723145)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/tasks/rspec.rake
ADDED
metadata
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_pvwatts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shad Self
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.13.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.13.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.12'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 2.12.5
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '2.12'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.12.5
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: guard-rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '4.5'
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 4.5.0
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '4.5'
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 4.5.0
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rspec
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '3.2'
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 3.2.0
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '3.2'
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 3.2.0
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: simplecov
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0.9'
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.9.2
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.9'
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 0.9.2
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
name: webmock
|
123
|
+
requirement: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '1.20'
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 1.20.4
|
131
|
+
type: :development
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '1.20'
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 1.20.4
|
141
|
+
description: API wrapper for version 5 of NREL PVWatts JSON API.
|
142
|
+
email: shad@greensandstudio.com
|
143
|
+
executables: []
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".rspec"
|
149
|
+
- Gemfile
|
150
|
+
- Gemfile.lock
|
151
|
+
- Guardfile
|
152
|
+
- LICENSE
|
153
|
+
- Rakefile
|
154
|
+
- bin/_guard-core
|
155
|
+
- bin/guard
|
156
|
+
- lib/ruby_pvwatts.rb
|
157
|
+
- lib/ruby_pvwatts/version.rb
|
158
|
+
- ruby_pvwatts.gemspec
|
159
|
+
- spec/ruby_pvwatts_spec.rb
|
160
|
+
- spec/spec_helper.rb
|
161
|
+
- tasks/rspec.rake
|
162
|
+
homepage: http://github.com/discypher/ruby_pvwatts
|
163
|
+
licenses:
|
164
|
+
- MIT
|
165
|
+
metadata: {}
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options: []
|
168
|
+
require_paths:
|
169
|
+
- lib
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: 1.9.3
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 1.3.6
|
180
|
+
requirements: []
|
181
|
+
rubyforge_project: ruby_pvwatts
|
182
|
+
rubygems_version: 2.4.5
|
183
|
+
signing_key:
|
184
|
+
specification_version: 4
|
185
|
+
summary: PVWatts JSON API wrapper
|
186
|
+
test_files: []
|