Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions PVWatts_Tool/PVWatts_API.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
__author__ = "warnuk"
__credits__ = ["warnuk", "NREL", "PVWatts"]
__license__ = "MIT"
__version__ = "1.0.1"
__version__ = "1.0.5"
__maintainer__ = "warnuk"
__email__ = "warnuk@umich.edu"
__status__ = "Development"
datetime_reference = "datetime_defaults.csv"

class PVWatts_Run(object):
def __init__(self, api_key, area, module_type, lat, lon, losses,
array_type, tilt, azimuth, timeframe, ratetype):
array_type, tilt, azimuth, timeframe, ratetype, incentivized):
"""PVWatts_Run object takes location/system attributes to
call PVWatts API and assign output to its output attribute"""
self.api_key = api_key
Expand All @@ -35,6 +35,7 @@ def __init__(self, api_key, area, module_type, lat, lon, losses,
self.azimuth = azimuth
self.timeframe = timeframe
self.ratetype = ratetype
self.incentivized = incentivized

# Use proper efficiency rating for module_type.
if self.module_type == 0:
Expand Down Expand Up @@ -64,6 +65,14 @@ def __init__(self, api_key, area, module_type, lat, lon, losses,

self.energy_value = round(self.ac_annual * self.rate, 2)

# EIA AEO 2017 estimates LCOE of solar pv to be $77.7 / MWh, or $58.8 / MWh with tax credits
if self.incentivized:
self.cost = round(self.ac_annual * (58.8 / 1000), 2)
else:
self.cost = round(self.ac_annual * (77.7 / 1000), 2)

self.savings = round(self.energy_value - self.cost, 2)

self.hourly_data = process_output.populate_df(self.pvwatts_output)

self.daily_data = process_output.kW_per_day(self.hourly_data)
Expand All @@ -88,4 +97,6 @@ def describe(self):
f"\n\nAnnual AC Solar Potential: {self.ac_annual} (kWh)"
f"\nUtility: {self.util_name}"
f"\nRate: ${self.rate}/kWh"
f"\nEnergy Value: ${self.energy_value}")
f"\nEnergy Value: ${self.energy_value}"
f"\nEstimated Cost: ${self.cost}"
f"\nEstimated Savings: ${self.savings}")
59 changes: 36 additions & 23 deletions PVWatts_Tool/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
__author__ = "warnuk"
__credits__ = ["warnuk", "NREL", "PVWatts"]
__license__ = "MIT"
__version__ = "1.0.1"
__version__ = "1.0.5"
__maintainer__ = "warnuk"
__email__ = "warnuk@umich.edu"
__status__ = "Development"
Expand All @@ -28,7 +28,8 @@ def init_ui(self):
output box on the right side of the container."""

self.first_run = True
container = QtWidgets.QHBoxLayout()
container = QtWidgets.QVBoxLayout()
subcontainer = QtWidgets.QHBoxLayout()

left_pane = QtWidgets.QVBoxLayout()
right_pane = QtWidgets.QVBoxLayout()
Expand All @@ -47,6 +48,7 @@ def init_ui(self):
self.tilt_l = QtWidgets.QLabel("Tilt (°)")
self.azimuth_l = QtWidgets.QLabel("Azimuth (°): ")
self.rate_l = QtWidgets.QLabel("Rate Type: ")
self.incentivized_l = QtWidgets.QLabel("LCOE with Tax Credits: ")

param_labels.addWidget(self.api_l)
param_labels.addWidget(self.area_l)
Expand All @@ -58,6 +60,7 @@ def init_ui(self):
param_labels.addWidget(self.tilt_l)
param_labels.addWidget(self.azimuth_l)
param_labels.addWidget(self.rate_l)
param_labels.addWidget(self.incentivized_l)

self.api_le = QtWidgets.QLineEdit()
self.area_le = QtWidgets.QLineEdit("1000")
Expand All @@ -73,6 +76,8 @@ def init_ui(self):
self.azimuth_le = QtWidgets.QLineEdit("180")
self.rate_le = QtWidgets.QComboBox()
self.rate_le.insertItems(0, ["Residential", "Commercial", "Industrial"])
self.incentivized_cb = QtWidgets.QComboBox()
self.incentivized_cb.insertItems(0, ["Yes", "No"])

param_fields.addWidget(self.api_le)
param_fields.addWidget(self.area_le)
Expand All @@ -84,35 +89,34 @@ def init_ui(self):
param_fields.addWidget(self.tilt_le)
param_fields.addWidget(self.azimuth_le)
param_fields.addWidget(self.rate_le)

output_layout = QtWidgets.QHBoxLayout()
self.output_l = QtWidgets.QLabel("Save hourly data to file: ")
self.output_check = QtWidgets.QCheckBox()
self.savefilepath = QtWidgets.QLineEdit()
self.fileselect = QtWidgets.QPushButton("Save as...")

output_layout.addWidget(self.output_check)
output_layout.addWidget(self.output_l)

output_layout.addWidget(self.savefilepath)
output_layout.addWidget(self.fileselect)

self.submit = QtWidgets.QPushButton("Submit")
param_fields.addWidget(self.incentivized_cb)

parameters.addLayout(param_labels)
parameters.addLayout(param_fields)

left_pane.addLayout(parameters)
left_pane.addWidget(self.submit)

self.output_box = QtWidgets.QPlainTextEdit()
self.output_box.setFixedWidth(500)

right_pane.addWidget(self.output_box)
right_pane.addLayout(output_layout)

container.addLayout(left_pane)
container.addLayout(right_pane)
subcontainer.addLayout(left_pane)
subcontainer.addLayout(right_pane)

output_layout = QtWidgets.QHBoxLayout()
self.output_l = QtWidgets.QLabel("Save hourly data to file: ")
self.savefilepath = QtWidgets.QLineEdit()
self.fileselect = QtWidgets.QPushButton("Save as...")
output_layout.addWidget(self.output_l)
output_layout.addWidget(self.savefilepath)
output_layout.addWidget(self.fileselect)

self.submit = QtWidgets.QPushButton("Submit")

container.addLayout(subcontainer)
container.addLayout(output_layout)
container.addWidget(self.submit)

self.fileselect.clicked.connect(self.set_output_file)
self.submit.clicked.connect(self.generate_output)
Expand Down Expand Up @@ -156,6 +160,12 @@ def array_type(self):
arraytype_id = "4"
return (arraytype_id)

def incentivized(self):
if self.incentivized_cb.currentText() == "Yes":
return(True)
else:
return (False)

def generate_output(self):
"""Creates a global scenario object and prints descriptive information to the output box."""

Expand All @@ -170,17 +180,18 @@ def generate_output(self):
tilt=self.tilt_le.text(),
azimuth=self.azimuth_le.text(),
timeframe='hourly',
ratetype=self.rate_le.currentText().lower())
ratetype=self.rate_le.currentText().lower(),
incentivized=self.incentivized())

if self.first_run:
self.output_box.appendPlainText(scenario.describe())
self.first_run = False
else:
self.output_box.appendPlainText('--------------------' + '\n' + scenario.describe())

if self.output_check.isChecked():
if self.savefilepath.text():
scenario.hourly_data.to_csv(self.savefilepath.text())


def run():
"""Make GUI call-able from python interpreter.

Expand All @@ -189,3 +200,5 @@ def run():
app = QtWidgets.QApplication(sys.argv)
current_run = Window()
sys.exit(app.exec())

run()
Binary file not shown.
Binary file added PVWatts_Tool/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added PVWatts_Tool/__pycache__/__main__.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion PVWatts_Tool/dataframe_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
__author__ = "warnuk"
__credits__ = ["warnuk", "NREL", "PVWatts"]
__license__ = "MIT"
__version__ = "1.0.1"
__version__ = "1.0.5"
__maintainer__ = "warnuk"
__email__ = "warnuk@umich.edu"
__status__ = "Development"
Expand Down
2 changes: 1 addition & 1 deletion PVWatts_Tool/nrel_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
__author__ = "warnuk"
__credits__ = ["warnuk", "NREL", "PVWatts"]
__license__ = "MIT"
__version__ = "1.0.1"
__version__ = "1.0.5"
__maintainer__ = "warnuk"
__email__ = "warnuk@umich.edu"
__status__ = "Development"
Expand Down
2 changes: 1 addition & 1 deletion PVWatts_Tool/process_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
__author__ = "warnuk"
__credits__ = ["warnuk", "NREL", "PVWatts"]
__license__ = "MIT"
__version__ = "1.0.1"
__version__ = "1.0.5"
__maintainer__ = "warnuk"
__email__ = "warnuk@umich.edu"
__status__ = "Development"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='PVWatts_Tool',
version='1.0.3',
version='1.0.5',
url='https://github.com/warnuk/PVWatts_Tool',
packages=['PVWatts_Tool'],
license='MIT',
Expand Down