diff --git a/PVWatts_Tool/PVWatts_API.py b/PVWatts_Tool/PVWatts_API.py index 3d557ca..c3c5d3b 100644 --- a/PVWatts_Tool/PVWatts_API.py +++ b/PVWatts_Tool/PVWatts_API.py @@ -13,7 +13,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" @@ -21,7 +21,7 @@ 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 @@ -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: @@ -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) @@ -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}") diff --git a/PVWatts_Tool/__main__.py b/PVWatts_Tool/__main__.py index d4792ec..06f8b24 100644 --- a/PVWatts_Tool/__main__.py +++ b/PVWatts_Tool/__main__.py @@ -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" @@ -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() @@ -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) @@ -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") @@ -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) @@ -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) @@ -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.""" @@ -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. @@ -189,3 +200,5 @@ def run(): app = QtWidgets.QApplication(sys.argv) current_run = Window() sys.exit(app.exec()) + +run() \ No newline at end of file diff --git a/PVWatts_Tool/__pycache__/PVWatts_API.cpython-36.pyc b/PVWatts_Tool/__pycache__/PVWatts_API.cpython-36.pyc new file mode 100644 index 0000000..00a47bf Binary files /dev/null and b/PVWatts_Tool/__pycache__/PVWatts_API.cpython-36.pyc differ diff --git a/PVWatts_Tool/__pycache__/__init__.cpython-36.pyc b/PVWatts_Tool/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..8c3ee4f Binary files /dev/null and b/PVWatts_Tool/__pycache__/__init__.cpython-36.pyc differ diff --git a/PVWatts_Tool/__pycache__/__main__.cpython-36.pyc b/PVWatts_Tool/__pycache__/__main__.cpython-36.pyc new file mode 100644 index 0000000..38ab3f6 Binary files /dev/null and b/PVWatts_Tool/__pycache__/__main__.cpython-36.pyc differ diff --git a/PVWatts_Tool/__pycache__/dataframe_template.cpython-36.pyc b/PVWatts_Tool/__pycache__/dataframe_template.cpython-36.pyc new file mode 100644 index 0000000..8bdc541 Binary files /dev/null and b/PVWatts_Tool/__pycache__/dataframe_template.cpython-36.pyc differ diff --git a/PVWatts_Tool/__pycache__/nrel_requests.cpython-36.pyc b/PVWatts_Tool/__pycache__/nrel_requests.cpython-36.pyc new file mode 100644 index 0000000..b13ae43 Binary files /dev/null and b/PVWatts_Tool/__pycache__/nrel_requests.cpython-36.pyc differ diff --git a/PVWatts_Tool/__pycache__/process_output.cpython-36.pyc b/PVWatts_Tool/__pycache__/process_output.cpython-36.pyc new file mode 100644 index 0000000..bcb30fd Binary files /dev/null and b/PVWatts_Tool/__pycache__/process_output.cpython-36.pyc differ diff --git a/PVWatts_Tool/dataframe_template.py b/PVWatts_Tool/dataframe_template.py index 5a2d5c0..e32870c 100644 --- a/PVWatts_Tool/dataframe_template.py +++ b/PVWatts_Tool/dataframe_template.py @@ -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" diff --git a/PVWatts_Tool/nrel_requests.py b/PVWatts_Tool/nrel_requests.py index 5b6fd9e..7f3e198 100644 --- a/PVWatts_Tool/nrel_requests.py +++ b/PVWatts_Tool/nrel_requests.py @@ -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" diff --git a/PVWatts_Tool/process_output.py b/PVWatts_Tool/process_output.py index c5b0701..a8c0c3f 100644 --- a/PVWatts_Tool/process_output.py +++ b/PVWatts_Tool/process_output.py @@ -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" diff --git a/setup.py b/setup.py index d2e4e00..b8ecb53 100644 --- a/setup.py +++ b/setup.py @@ -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',