示例#1
0
    def get_generation_profile(self, start_date=None, end_date=None):
        """
        :param start_date: inclusive that date
        :type start_date: :class:`datetime.datetime`
        :param end_date: exclusive that date
        :type end_date: :class:`datetime.datetime`

        :return: a array with the solar profile in hourly resolution for a standardized meteorological year.
        """
        result = PVWatts.request(system_capacity=self.system_capacity, module_type=self.module_type,
                        format=self.format, losses=self.losses, array_type=self.array_type, tilt=self.tilt,
                        azimuth=self.azimuth, timeframe=self.timeframe, address=self.address)
        data = result.raw
        if start_date is None and end_date is None:
            return data['outputs']['ac']
        elif start_date is None:
            end_day_in_year = end_date.timetuple().tm_yday
            return data['outputs']['ac'][:end_day_in_year * 24]
        elif end_date is None:
            start_day_in_year = start_date.timetuple().tm_yday
            return data['outputs']['ac'][start_day_in_year * 24:]
        else:
            start_day_in_year = start_date.timetuple().tm_yday
            end_day_in_year = end_date.timetuple().tm_yday
            return data['outputs']['ac'][start_day_in_year * 24:end_day_in_year * 24]
示例#2
0
文件: test.py 项目: harmon/pypvwatts
 def test_pypvwatts_instance(self):
     """Test pypvwatts instance based searches"""
     p = PVWatts(api_key='DEMO_KEY')
     results = p.request(system_capacity=4,
                         module_type=1,
                         array_type=1,
                         azimuth=190,
                         tilt=30,
                         dataset='tmy2',
                         losses=0.13,
                         lat=40,
                         lon=-105)
     self.assert_results(results)
示例#3
0
文件: test.py 项目: harmon/pypvwatts
 def test_pypvwatts(self):
     """Test pypvwatts"""
     PVWatts.api_key = 'DEMO_KEY'
     results = PVWatts.request(system_capacity=4,
                               module_type=1,
                               array_type=1,
                               azimuth=190,
                               tilt=30,
                               dataset='tmy2',
                               losses=0.13,
                               lat=40,
                               lon=-105)
     print results.raw
     self.assert_results(results)
def getPVWatts():
    PVWatts.api_key = 'qkk2DRRxcBpTZXA13qOGFlwouL9ZWQaLZxKjZCdd'
    address = input("Enter the HO address: ")
    ratio = float(input("Enter the DC/AC ratio: "))
    estprod = float(
        input("Enter out estimated yearly production for the system: "))

    numArrays = int(input("Enter the number total number of unique arays: "))
    monthly = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    yearly = 0
    for i in range(0, numArrays):
        s_c = float(
            input("Enter the system size in kWh for array {}:".format(i + 1)))
        tilt = int(input("Enter the tilt of array {}:".format(i + 1)))
        azimuth = int(input("Enter the azimuth of array {}:".format(i + 1)))
        result = PVWatts.request(system_capacity=s_c,
                                 module_type=1,
                                 array_type=1,
                                 azimuth=azimuth,
                                 tilt=tilt,
                                 dataset="tmy2",
                                 losses=9,
                                 address=address,
                                 dc_ac_ratio=ratio,
                                 gcr=.4,
                                 inv_eff=99.5)
        yearly += int(result.ac_annual)
        monthly = np.add(monthly, result.ac_monthly)

    eff = float(estprod) / float(yearly)
    adj = monthly * eff
    adj = pd.Series(adj, name='adj-daily-total')
    adj[0] = adj[0] / 31
    adj[1] = adj[1] / 28
    adj[2] = adj[2] / 31
    adj[3] = adj[3] / 30
    adj[4] = adj[4] / 31
    adj[5] = adj[5] / 30
    adj[6] = adj[6] / 31
    adj[7] = adj[7] / 31
    adj[8] = adj[8] / 30
    adj[9] = adj[9] / 31
    adj[10] = adj[10] / 30
    adj[11] = adj[11] / 31
    return adj
示例#5
0
def fetch_data(from_lon, to_lon, from_lat, to_lat, step_size=1):
    my_api_key = ''
    with open(str(Path.home()) + '/pvwatts_api_key.txt', 'r') as file:
        my_api_key = file.readline()
        # Strip newline
        my_api_key = my_api_key[:-1]

    p = PVWatts(api_key=my_api_key)

    results = []

    for longitude in range(from_lon, to_lon, step_size):
        for latitude in range(from_lat, to_lat, step_size):
            try:
                results.append(p.request(
                    format='JSON', system_capacity=4, module_type=1, array_type=1,
                    azimuth=190, tilt=40, dataset='intl', timeframe='hourly',
                    losses=10, lon=longitude, lat=latitude
                ))
            except:
                print("Could not fetch all data")
                return results

    return results
示例#6
0
文件: API.py 项目: wiedld/SunBear
###############################################################
###############################################################

# PV WATTS
#  used python library: https://github.com/mpaolino/pypvwatts
#  output:  Annual and Monthly solar production kWh
#  dataset can = tmy2, tmy3, intl (International station data)
import os
from pypvwatts import PVWatts

PVWatts.api_key = os.environ["PV_WATTS_KEY"]
result = PVWatts.request(system_capacity=4,
                         module_type=1,
                         array_type=1,
                         azimuth=190,
                         tilt=30,
                         dataset='tmy2',
                         losses=0.13,
                         lat=40,
                         lon=-105)

print "example PV WATTS annual output:", result.ac_annual
# (wiedld): this API is wired in and working!!!!

###############################################################

# ZILLOW

### DETAILS PER HOUSE ###
# http://www.zillow.com/howto/api/GetDeepSearchResults.htm
# input:  address and zip
示例#7
0
 def test_pypvwatts_instance(self):
     """Test pypvwatts instance based searches"""
     p = PVWatts(api_key='DEMO_KEY')
     results = p.request(system_size=4, dataset='tmy2', derate=0.77, lat=40,
                        lon=-105)
     self.assert_results(results)
示例#8
0
 def test_pypvwatts(self):
     """Test pypvwatts"""
     PVWatts.api_key = 'DEMO_KEY'
     results = PVWatts.request(system_size=4, dataset='tmy2', derate=0.77,
                         lat=40, lon=-105)
     self.assert_results(results)