PVLIB_Ruby 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d3ae3a823ad98dd6eaad6afeea6fc3cc3ff5902
4
- data.tar.gz: 9791749f4b811b64481206aec941f5289d1d543c
3
+ metadata.gz: 0c8a795d25b76c8ea888e4fc8d37309149f40c29
4
+ data.tar.gz: 9632097a75102eb30493e4a9a76f38142739f9e4
5
5
  SHA512:
6
- metadata.gz: 8043fbd98a76d68a1deb94449201eb34fca2365d54c5055878637531f62b445d236f810c85245de32b6774a25dd34fe3aa49e02102bc4490df4c35445ee9d0d2
7
- data.tar.gz: d920617b1a837ffd83d763d3b921ab0bee605aa8aa575564eb390a22f63613c5f587d9e7e628fe33636c05895f45e04c0f9eac33a7bf6f1a0f3085b146406c2e
6
+ metadata.gz: 2dae1285d4de04149059586f3f90678f97222564aa4f6d43ee46c43ddf1fcaca7b7604dd7171f98b03c3e1b1c8fee1f1401f0a6102a6a45cdd65be2df363cd73
7
+ data.tar.gz: 728b34860cbbd800c2895a4b1a322917647ecf0f15d71242f25deed8ead59e7f889da1c8ce14298251feb84c1b24baecf877f704c57bbf9bd3ae98034975cba5
@@ -0,0 +1,3 @@
1
+ "latitude","longitude","altitude",
2
+ 35.05,-106.54,1660,
3
+
@@ -19,16 +19,15 @@ time = Time.new(2008, 10, 20, 11, 58, 12, utc_offset)
19
19
  albedo = BigDecimal('0.1500')
20
20
  array_tilt = BigDecimal('35')
21
21
  array_azimuth = BigDecimal('180')
22
- latitude = BigDecimal('35.0500')
23
- longitude = BigDecimal('-106.5400')
24
- altitude = BigDecimal('1660')
25
- location = Location.new(latitude, longitude, altitude)
26
22
  pressure = BigDecimal('62963')
27
23
  reference_solar_irradiance = BigDecimal('1000')
28
24
  wind_speed = BigDecimal('2.8786')
29
25
  air_temperature = BigDecimal('20.7700')
30
26
 
31
- solar_ephemeris = SolarEphemeris.new(time, location, pressure: pressure, temperature: air_temperature)
27
+ sandia_location_data_filepath = File.join(DATA_DIRECTORY, 'sandia_location_example.csv')
28
+ sandia_location = Location.create(sandia_location_data_filepath)
29
+
30
+ solar_ephemeris = SolarEphemeris.new(time, sandia_location, pressure: pressure, temperature: air_temperature)
32
31
 
33
32
  sun_azimuth = solar_ephemeris.sun_azimuth
34
33
  apparent_sun_elevation = solar_ephemeris.apparent_sun_elevation
@@ -114,7 +113,7 @@ sandia_inverter = Inverter.create(sandia_inverter_data_filename)
114
113
 
115
114
  dc_to_ac_conversion = DcToAcConversion.new(sandia_inverter)
116
115
 
117
- puts "--- Inverter DC to AC conversion ---"
116
+ puts "------- Inverter DC to AC conversion ------"
118
117
  puts " AC power [W]: #{dc_to_ac_conversion.ac_power(array_voltage, array_power).round(4).to_s('F')}" # Matches to 1016.3 (with rounding) for 360th row in PVSC40Tutorial_Master
119
- puts "------------------------------------"
118
+ puts "-------------------------------------------"
120
119
  puts ""
@@ -33,7 +33,7 @@ class ActiveCsv
33
33
 
34
34
  if "#{header}=" == "="
35
35
 
36
- unless previous_header.blank?
36
+ if !previous_header.blank? && !data[index].blank?
37
37
 
38
38
  assigned_data_for_previous_header = self.send(previous_header.to_sym)
39
39
 
@@ -1,11 +1,19 @@
1
- class Location
1
+ # This is a model in model-view-controller design pattern.
2
+ # In this case, it is expending ActiveCsv, i.e. it is analogous to ActiveRecord. Hence, it's a placeholder for data from CSV file.
3
+ class Location < ActiveCsv
2
4
 
3
- attr_accessor :latitude, :longitude, :altitude
5
+ attr_writer :latitude, :longitude, :altitude
4
6
 
5
- def initialize(latitude, longitude, altitude)
6
- @latitude = latitude
7
- @longitude = longitude
8
- @altitude = altitude
7
+ def latitude
8
+ BigDecimal(@latitude.to_s)
9
+ end
10
+
11
+ def longitude
12
+ BigDecimal(@longitude.to_s)
13
+ end
14
+
15
+ def altitude
16
+ BigDecimal(@altitude.to_s)
9
17
  end
10
18
 
11
19
  end
@@ -1,3 +1,3 @@
1
1
  module PvlibRuby
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PVLIB_Ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tadatoshi Takahashi
@@ -87,6 +87,7 @@ files:
87
87
  - bin/console
88
88
  - bin/setup
89
89
  - examples/data/sandia_inverter_example.csv
90
+ - examples/data/sandia_location_example.csv
90
91
  - examples/data/sandia_module_example.csv
91
92
  - examples/pv_power_generation_example.rb
92
93
  - lib/PVLIB_Ruby.rb