From 38e25b91385a7586ec83eadf340101e17ce9bf07 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:17:10 -0700 Subject: [PATCH 1/6] Improve local dev setup instructions --- AUTHORS.rst | 2 ++ CONTRIBUTING.rst | 3 ++- README.rst | 35 ++++++++++++++++++++--------------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 20e214f9..fb650606 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -2,4 +2,6 @@ Authors ======= +* Koenraad Beckers - https://github.com/kfbeckers +* Malcolm Ross - https://github.com/malcolm-dsider * softwareengineerprogrammer - https://github.com/softwareengineerprogrammer diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 348b2cfc..e4d2961b 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -38,7 +38,8 @@ Development To set up `python-geophires-x` for local development: 1. Fork `python-geophires-x `_ - (look for the "Fork" button). + (look for the "Fork" button). Enable Actions on your fork. + 2. Clone your fork locally:: git clone git@github.com:NREL/python-geophires-x.git diff --git a/README.rst b/README.rst index 455ba741..84925c06 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,9 @@ Overview GEOPHIRES is a free and open-source geothermal techno-economic simulator. GEOPHIRES combines reservoir, wellbore, surface plant, and economic models to estimate the capital and operation and maintenance costs, instantaneous and lifetime energy production, and overall levelized cost of energy of a geothermal plant. Various reservoir conditions (EGS, doublets, etc.) and end-use options (electricity, direct-use heat, cogeneration) can be modeled. Users are encouraged to build upon to the GEOPHIRES framework to implement their own correlations and models. -Ported from https://github.com/malcolm-dsider/GEOPHIRES-X and https://github.com/softwareengineerprogrammer/python-geophires-x using https://github.com/ionelmc/cookiecutter-pylibrary/. +Ported from `malcolm-dsider/GEOPHIRES-X `_ +and `softwareengineerprogrammer/python-geophires-x `_ +using `ionelmc/cookiecutter-pylibrary `_. * Free software: MIT license @@ -58,33 +60,36 @@ Install the in-development version with:: (Eventually package will be published to PyPi, enabling ``pip install geophires-x``) +Documentation +============= -Dev Setup -========= -1. Setup and activate virtualenv (https://virtualenv.pypa.io/en/latest/installation.html#via-pip):: +See `test_geophires_x.py `_ for example usage of the client - python -m venv venv - source venv/bin/activate + pre-commit install -2. Install dependencies in setup.py:: - pip install . -3. Setup pre-commit (https://pre-commit.com/):: +Development +=========== - pre-commit install +Local Setup +----------- +0. Follow fork & clone instructions in `CONTRIBUTING.rst `_ -Documentation -============= +1. Set up and activate `virtualenv `_:: + python -m venv venv + source venv/bin/activate -See https://github.com/NREL/python-geophires-x/blob/main/tests/test_geophires_x.py for example usage +2. Install dependencies in setup.py:: + + pip install -e . + +3. Set up `pre-commit `_:: -Development -=========== To run all the tests run:: From 61eaadb755c335847d60ff57cbb4aa283beac302 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Tue, 10 Oct 2023 11:37:45 -0700 Subject: [PATCH 2/6] Fix rst check failure --- AUTHORS.rst | 2 +- README.rst | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index fb650606..dde3fad1 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -2,6 +2,6 @@ Authors ======= -* Koenraad Beckers - https://github.com/kfbeckers +* Koenraad Beckers - https://github.com/kfbeckers * Malcolm Ross - https://github.com/malcolm-dsider * softwareengineerprogrammer - https://github.com/softwareengineerprogrammer diff --git a/README.rst b/README.rst index 84925c06..b749954a 100644 --- a/README.rst +++ b/README.rst @@ -63,12 +63,10 @@ Install the in-development version with:: Documentation ============= +See the `GEOPHIRES v2 user manual `_ +(A GEOPHIRES-X-specific manual is pending as of 2023-10-10) -See `test_geophires_x.py `_ for example usage of the client - - pre-commit install - - +See `test_geophires_x.py `_ for example usage of the client. Development =========== @@ -76,7 +74,7 @@ Development Local Setup ----------- -0. Follow fork & clone instructions in `CONTRIBUTING.rst `_ +Prerequisite: Follow fork & clone instructions in `CONTRIBUTING.rst `_. Then: 1. Set up and activate `virtualenv `_:: @@ -89,7 +87,7 @@ Local Setup 3. Set up `pre-commit `_:: - + pre-commit install To run all the tests run:: From 46b15b47febdd8536bb0e0fb362dca3577d1e7e9 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Tue, 10 Oct 2023 11:53:08 -0700 Subject: [PATCH 3/6] README/AUTHORS cleanup --- AUTHORS.rst | 3 ++- README.rst | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index dde3fad1..a0d36dd2 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -4,4 +4,5 @@ Authors * Koenraad Beckers - https://github.com/kfbeckers * Malcolm Ross - https://github.com/malcolm-dsider -* softwareengineerprogrammer - https://github.com/softwareengineerprogrammer +* Jonathan Pezzino - https://jonathanpezzino.com +* Kevin McCabe (GEOPHIRES v2.0) - kevin.mccabe@nrel.gov diff --git a/README.rst b/README.rst index b749954a..d6332cc7 100644 --- a/README.rst +++ b/README.rst @@ -4,11 +4,12 @@ Overview GEOPHIRES is a free and open-source geothermal techno-economic simulator. GEOPHIRES combines reservoir, wellbore, surface plant, and economic models to estimate the capital and operation and maintenance costs, instantaneous and lifetime energy production, and overall levelized cost of energy of a geothermal plant. Various reservoir conditions (EGS, doublets, etc.) and end-use options (electricity, direct-use heat, cogeneration) can be modeled. Users are encouraged to build upon to the GEOPHIRES framework to implement their own correlations and models. +GEOPHIRES-X is the successor version to `GEOPHIRES v2.0 `_. Ported from `malcolm-dsider/GEOPHIRES-X `_ and `softwareengineerprogrammer/python-geophires-x `_ using `ionelmc/cookiecutter-pylibrary `_. -* Free software: MIT license +Free software: `MIT license `_ .. start-badges @@ -19,8 +20,9 @@ using `ionelmc/cookiecutter-pylibrary Date: Tue, 10 Oct 2023 12:32:05 -0700 Subject: [PATCH 4/6] Remove obselete readme/license. Move extension manual to root and link from readme --- ...HIRES-X.md => How-to-extend-GEOPHIRES-X.md | 0 README.rst | 4 +- src/geophires_x/LICENSE | 37 ---- src/geophires_x/README.md | 17 -- src/geophires_x/README.rst | 189 ------------------ 5 files changed, 3 insertions(+), 244 deletions(-) rename src/geophires_x/How-to-extend-GEOPHIRES-X.md => How-to-extend-GEOPHIRES-X.md (100%) delete mode 100644 src/geophires_x/LICENSE delete mode 100644 src/geophires_x/README.md delete mode 100644 src/geophires_x/README.rst diff --git a/src/geophires_x/How-to-extend-GEOPHIRES-X.md b/How-to-extend-GEOPHIRES-X.md similarity index 100% rename from src/geophires_x/How-to-extend-GEOPHIRES-X.md rename to How-to-extend-GEOPHIRES-X.md diff --git a/README.rst b/README.rst index d6332cc7..1544f23f 100644 --- a/README.rst +++ b/README.rst @@ -66,10 +66,12 @@ Documentation ============= See the `GEOPHIRES v2 user manual `_ -(A GEOPHIRES-X-specific manual is pending as of 2023-10-10) +(A GEOPHIRES-X-specific manual is pending as of 2023-10-10). See `test_geophires_x.py `_ for example usage of the client. +`How to extend GEOPHIRES-X `_ + Development =========== diff --git a/src/geophires_x/LICENSE b/src/geophires_x/LICENSE deleted file mode 100644 index 63ed6fc0..00000000 --- a/src/geophires_x/LICENSE +++ /dev/null @@ -1,37 +0,0 @@ -Copyright (c) 2005-2018 Fredrik Johansson and mpmath contributors - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - a. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - b. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - c. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - -The tool is written in Python and open-source under the MIT license - see the [license.txt](license.txt) file for more information. - -Copyright 2018 NREL - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/src/geophires_x/README.md b/src/geophires_x/README.md deleted file mode 100644 index aa506b4b..00000000 --- a/src/geophires_x/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# GEOPHIRES - -This repo hosts the geothermal techno-economic simulation tool GEOPHIRES. - -GEOPHIRES combines reservoir, wellbore, surface plant, and economic and cost models and correlations to estimate the capital and operation and maintenance costs, instantaneous and lifetime energy production, and overall levelized cost of energy of a geothermal plant. - -## Version -The latest version is v3.0, updated on July 1st, 2022. - -## Authors -* **Koenraad Beckers** - Heateon (koenraad.beckers@heateon.com) -* **Kevin McCabe** - National Renewable Energy Laboratory (NREL) (kevin.mccabe@nrel.gov) -* **Malcolm Ross** - Rice University (malcolm@rice.edu) - - -## License -The tool is written in Python and open-source under the MIT license - see the [license.txt](license.txt) file for more information. diff --git a/src/geophires_x/README.rst b/src/geophires_x/README.rst deleted file mode 100644 index 725ed018..00000000 --- a/src/geophires_x/README.rst +++ /dev/null @@ -1,189 +0,0 @@ -mpmath -====== - -|pypi version| |Build status| |Code coverage status| |Zenodo Badge| - -.. |pypi version| image:: https://img.shields.io/pypi/v/mpmath.svg - :target: https://pypi.python.org/pypi/mpmath -.. |Build status| image:: https://secure.travis-ci.org/fredrik-johansson/mpmath.svg?branch=master - :target: https://travis-ci.org/fredrik-johansson/mpmath -.. |Code coverage status| image:: https://codecov.io/gh/fredrik-johansson/mpmath/branch/master/graph/badge.svg - :target: https://codecov.io/gh/fredrik-johansson/mpmath -.. |Zenodo Badge| image:: https://zenodo.org/badge/2934512.svg - :target: https://zenodo.org/badge/latestdoi/2934512 - -A Python library for arbitrary-precision floating-point arithmetic. - -Website: http://mpmath.org/ -Main author: Fredrik Johansson - -Mpmath is free software released under the New BSD License (see the -LICENSE file for details) - -0. History and credits ----------------------- - -The following people (among others) have contributed major patches -or new features to mpmath: - -* Pearu Peterson -* Mario Pernici -* Ondrej Certik -* Vinzent Steinberg -* Nimish Telang -* Mike Taschuk -* Case Van Horsen -* Jorn Baayen -* Chris Smith -* Juan Arias de Reyna -* Ioannis Tziakos -* Aaron Meurer -* Stefan Krastanov -* Ken Allen -* Timo Hartmann -* Sergey B Kirpichev -* Kris Kuhlman -* Paul Masson -* Michael Kagalenko -* Jonathan Warner - -Numerous other people have contributed by reporting bugs, -requesting new features, or suggesting improvements to the -documentation. - -For a detailed changelog, including individual contributions, -see the CHANGES file. - -Fredrik's work on mpmath during summer 2008 was sponsored by Google -as part of the Google Summer of Code program. - -Fredrik's work on mpmath during summer 2009 was sponsored by the -American Institute of Mathematics under the support of the National Science -Foundation Grant No. 0757627 (FRG: L-functions and Modular Forms). - -Any opinions, findings, and conclusions or recommendations expressed in this -material are those of the author(s) and do not necessarily reflect the -views of the sponsors. - -Credit also goes to: - -* The authors of the GMP library and the Python wrapper - gmpy, enabling mpmath to become much faster at - high precision -* The authors of MPFR, pari/gp, MPFUN, and other arbitrary- - precision libraries, whose documentation has been helpful - for implementing many of the algorithms in mpmath -* Wikipedia contributors; Abramowitz & Stegun; Gradshteyn & Ryzhik; - Wolfram Research for MathWorld and the Wolfram Functions site. - These are the main references used for special functions - implementations. -* George Brandl for developing the Sphinx documentation tool - used to build mpmath's documentation - -Release history: - -* Version 1.1.0 released on December 11, 2018 -* Version 1.0.0 released on September 27, 2017 -* Version 0.19 released on June 10, 2014 -* Version 0.18 released on December 31, 2013 -* Version 0.17 released on February 1, 2011 -* Version 0.16 released on September 24, 2010 -* Version 0.15 released on June 6, 2010 -* Version 0.14 released on February 5, 2010 -* Version 0.13 released on August 13, 2009 -* Version 0.12 released on June 9, 2009 -* Version 0.11 released on January 26, 2009 -* Version 0.10 released on October 15, 2008 -* Version 0.9 released on August 23, 2008 -* Version 0.8 released on April 20, 2008 -* Version 0.7 released on March 12, 2008 -* Version 0.6 released on January 13, 2008 -* Version 0.5 released on November 24, 2007 -* Version 0.4 released on November 3, 2007 -* Version 0.3 released on October 5, 2007 -* Version 0.2 released on October 2, 2007 -* Version 0.1 released on September 27, 2007 - -1. Download & installation --------------------------- - -Mpmath requires Python 2.7 or 3.4 (or later versions). It has been tested -with CPython 2.7, 3.4 through 3.7 and for PyPy. - -The latest release of mpmath can be downloaded from the mpmath -website and from https://github.com/fredrik-johansson/mpmath/releases - -It should also be available in the Python Package Index at -https://pypi.python.org/pypi/mpmath - -To install latest release of Mpmath with pip, simply run - -``pip install mpmath`` - -Or unpack the mpmath archive and run - -``python setup.py install`` - -Mpmath can also be installed using - -``python -m easy_install mpmath`` - -The latest development code is available from -https://github.com/fredrik-johansson/mpmath - -See the main documentation for more detailed instructions. - -2. Running tests ----------------- - -The unit tests in mpmath/tests/ can be run via the script -runtests.py, but it is recommended to run them with py.test -(http://codespeak.net/py/dist/index.html), especially -to generate more useful reports in case there are failures. - -You may also want to check out the demo scripts in the demo -directory. - -The master branch is automatically tested by Travis CI. - -3. Documentation ----------------- - -Documentation in reStructuredText format is available in the -doc directory included with the source package. These files -are human-readable, but can be compiled to prettier HTML using -the build.py script (requires Sphinx, http://sphinx.pocoo.org/). - -See setup.txt in the documentation for more information. - -The most recent documentation is also available in HTML format: - -http://mpmath.org/doc/current/ - -4. Known problems ------------------ - -Mpmath is a work in progress. Major issues include: - -* Some functions may return incorrect values when given extremely - large arguments or arguments very close to singularities. - -* Directed rounding works for arithmetic operations. It is implemented - heuristically for other operations, and their results may be off by one - or two units in the last place (even if otherwise accurate). - -* Some IEEE 754 features are not available. Inifinities and NaN are - partially supported; denormal rounding is currently not available - at all. - -* The interface for switching precision and rounding is not finalized. - The current method is not threadsafe. - -5. Help and bug reports ------------------------ - -General questions and comments can be sent to the mpmath mailinglist, -mpmath@googlegroups.com - -You can also report bugs and send patches to the mpmath issue tracker, -https://github.com/fredrik-johansson/mpmath/issues From bd50f6ca87a5610d550a6ecaf00415f8f2cadec2 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:36:09 -0700 Subject: [PATCH 5/6] Fix imports in EconomicsS_DAC_GT.py --- src/geophires_x/EconomicsS_DAC_GT.py | 62 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/geophires_x/EconomicsS_DAC_GT.py b/src/geophires_x/EconomicsS_DAC_GT.py index e6d4d411..bc1038df 100644 --- a/src/geophires_x/EconomicsS_DAC_GT.py +++ b/src/geophires_x/EconomicsS_DAC_GT.py @@ -2,12 +2,12 @@ import os import math import numpy as np -from Parameter import floatParameter, OutputParameter, ReadParameter -from Units import * -from OptionList import EndUseOptions -import Model +from .Parameter import floatParameter, OutputParameter, ReadParameter +from .Units import * +from .OptionList import EndUseOptions +import geophires_x.Model as Model import numpy as np -import Economics +import geophires_x.Economics as Economics class EconomicsS_DAC_GT(Economics.Economics): """ @@ -25,7 +25,7 @@ class EconomicsS_DAC_GT(Economics.Economics): def __init__(self, model:Model): """ The __init__ function is the constructor for a class. It is called whenever an instance of the class is created. The __init__ function can take arguments, but self is always the first one. Self refers to the instance of the object that has already been created and it's used to access variables that belong to that object. - + :param self: Reference the class object itself :param model: The container class of the application, giving access to everything else, including the logger @@ -39,7 +39,7 @@ def __init__(self, model:Model): #This also includes all Parameters that are calculated and then published using the Printouts function. #If you choose to sublass this master class, you can do so before or after you create your own parameters. If you do, you can also choose to call this method from you class, which will effectively add and set all these parameters to your class. - #These disctionaries contains a list of all the parameters set in this object, stored as "Parameter" and OutputParameter Objects. This will alow us later to access them in a user interface and get that list, along with unit type, preferred units, etc. + #These disctionaries contains a list of all the parameters set in this object, stored as "Parameter" and OutputParameter Objects. This will alow us later to access them in a user interface and get that list, along with unit type, preferred units, etc. self.ParameterDict = {} self.OutputParameterDict = {} self.wacc = self.ParameterDict[self.wacc.Name] = floatParameter("WACC", value = 10.0, DefaultValue = 10.0, Min=0.1, Max=30.0, UnitType = Units.PERCENT, PreferredUnits = PercentUnit.PERCENT, CurrentUnits = PercentUnit.PERCENT, ErrMessage = "assume default Weighted Average Cost of Capital (10%)", ToolTipText="Weighted Average Cost of Capital (percent)") @@ -95,7 +95,7 @@ def __str__(self): def read_parameters(self, model:Model) -> None: """ The read_parameters function reads in the parameters from a dictionary and stores them in the aparmeters. It also handles special cases that need to be handled after a value has been read in and checked. If you choose to sublass this master class, you can also choose to override this method (or not), and if you do - + :param self: Access variables that belong to a class :param model: The container class of the application, giving access to everything else, including the logger @@ -160,58 +160,58 @@ def range_check(self)->tuple: if not (wacc_min <= self.wacc.value <= wacc_max): error_message = "S-DAC-GT ERROR: WACC should be between {}% and {}%".format(wacc_min, wacc_max) return(True, error_message) - + if not (CAPEX_min <= self.CAPEX.value <= CAPEX_max): error_message = "S-DAC-GT ERROR: CAPEX should be between {} and {}".format(CAPEX_min, CAPEX_max) return(True, error_message) - + if not (OPEX_min <= self.OPEX.value <= OPEX_max): error_message = "S-DAC-GT ERROR: OPEX should be between {} and {}".format(OPEX_min, OPEX_max) return(True, error_message) - + if not (elec_min <= self.elec.value <= elec_max): error_message = "S-DAC-GT ERROR: Electrical Energy should be between {} and {}".format(elec_min, elec_max) return(True, error_message) - + if not (therm_min <= self.therm.value <= therm_max): error_message = "S-DAC-GT ERROR: Thermal Energy should be between {} and {}".format(therm_min, therm_max) return(True, error_message) - + if not (NG_price_min <= self.NG_price.value <= NG_price_max): error_message = "S-DAC-GT ERROR: Natural Gas Price should be between {} and {}".format(NG_price_min, NG_price_max) return(True, error_message) - + if not (power_co2intensity_min <= self.power_co2intensity.value <= power_co2intensity_max): error_message = "S-DAC-GT ERROR: CO2 Intensity of Electricity should be between {} and {}".format(power_co2intensity_min, power_co2intensity_max) return(True, error_message) - + if not (CAPEX_mult_min <= self.CAPEX_mult.value <= CAPEX_mult_max): error_message = "S-DAC-GT ERROR: CAPEX Multiplier should be between {} and {}".format(CAPEX_mult_min, CAPEX_mult_max) return(True, error_message) - + if not (OPEX_mult_min <= self.OPEX_mult.value <= OPEX_mult_max): error_message = "S-DAC-GT ERROR: OPEX Multiplier should be between {} and {}".format(OPEX_mult_min, OPEX_mult_max) return(True, error_message) - + if not (therm_index_min <= self.therm_index.value <= therm_index_max): error_message = "S-DAC-GT ERROR: S-DAC Thermal Energy Multiplier should be between {} and {}".format(therm_index_min, therm_index_max) return(True, error_message) - + if not (transport_min <= self.transport.value <= transport_max): error_message = "S-DAC-GT ERROR: CO2 Transportation Cost should be between {} and {}".format(transport_min, transport_max) return(True, error_message) - + if not (storage_min <= self.storage.value <= storage_max): error_message = "S-DAC-GT ERROR: CO2 Storage Cost should be between {} and {}".format(storage_min, storage_max) return(True, error_message) - + return(False,"") - + def geo_therm_cost(self, power_cost:float, CAPEX_mult:float, OPEX_mult:float, depth:float, Production_temp:float, Injection_temp:float, Flow_rate:float)->tuple: # Calculate Levelized cost of heat and ratio of electric power to heat power # LCOH calculated in USD # Power ratio calculated as kWh_e / kWh_th --> used for calculating CO2 footprint of geothermal energy - # inputs are cost of electricity, regional capex and opex multipliers, + # inputs are cost of electricity, regional capex and opex multipliers, # depth of geothermal reservoir, Average Production Temperature, Injection Temperature, and Flow Rate #recoded by Malcolm Ross when integrated with GEOPHIRES - GEOPHIRES has more information, so fewer assumptions are made # Update NREL 2016 model for 2022 @@ -236,14 +236,14 @@ def geo_therm_cost(self, power_cost:float, CAPEX_mult:float, OPEX_mult:float, de NREL_reinjection = 127130 * Inflation # USD # Normalize for region - CAPEX = NREL_CAPEX * CAPEX_mult + CAPEX = NREL_CAPEX * CAPEX_mult CAPEX_drill = depth * NREL_drill_per_foot / Drilling_efficiency_factor pump_kwh = depth * NREL_pump_per_foot pump_cost = pump_kwh * power_cost inhibitor = NREL_inhibitor * OPEX_mult labor = NREL_labor * OPEX_mult reinjection = NREL_reinjection / NREL_depth * depth * OPEX_mult - + # total costs CAPEX_total = CAPEX + CAPEX_drill OPEX_total = pump_cost + inhibitor + labor + reinjection @@ -252,19 +252,19 @@ def geo_therm_cost(self, power_cost:float, CAPEX_mult:float, OPEX_mult:float, de Thermal_capacity = (Production_temp-Injection_temp)*Flow_rate*H2O_thermal_capacity*60*60 # kW Annual_op_hrs = 365*24*Capacity_factor # hours Therm_total = Thermal_capacity * Annual_op_hrs # kWh - + # Levelized cost of heat (LCOH) LCOH = (CAPEX_total*self.CRF + OPEX_total)/Therm_total # $/kWh_therm - + kWh_e_per_kWh_th = pump_kwh / Therm_total - + return (LCOH, kWh_e_per_kWh_th) def Calculate(self, model:Model)->None: """ The Calculate function is where all the calculations are done. This function can be called multiple times, and will only recalculate what has changed each time it is called. - + :param self: Access variables that belongs to the class :param model: The container class of the application, giving access to everything else, including the logger :return: Nothing, but it does make calculations and set values in the model @@ -298,11 +298,11 @@ def Calculate(self, model:Model)->None: co2_elec_heat = self.therm.value/1000*self.power_co2intensity.value co2_ng = self.therm.value/1000*self.NG_co2intensity.value co2_geothermal = self.therm.value*self.kWh_e_per_kWh_th.value/1000*self.power_co2intensity.value - + self.LCOD_elec.value = CAPEX+self.OPEX.value+power_totalcost+elec_heat_totalcost+self.storage.value+self.transport.value self.LCOD_ng.value = CAPEX+self.OPEX.value+power_totalcost+NG_totalcost+self.storage.value+self.transport.value self.LCOD_geo.value = CAPEX+self.OPEX.value+power_totalcost+geothermal_totalcost+self.storage.value+self.transport.value - + self.CO2total_elec.value = co2_power + co2_elec_heat self.CO2total_ng.value = co2_power + co2_ng self.CO2total_geo.value = co2_power + co2_geothermal @@ -320,7 +320,7 @@ def Calculate(self, model:Model)->None: self.CummCostPerTonne.value = [0.0] * model.surfaceplant.plantlifetime.value self.CarbonExtractedTotal.value = 0.0 - #Figure out how much energy is being produced each year, and the amount of carbon that would have been produced if that energy had been made using the grdi average carbon production. That then gives us the revenue, since we have a carbon price model + #Figure out how much energy is being produced each year, and the amount of carbon that would have been produced if that energy had been made using the grdi average carbon production. That then gives us the revenue, since we have a carbon price model #We can also get annual cash flow from it. for i in range(0,model.surfaceplant.plantlifetime.value,1): self.CarbonExtractedAnnually.value[i] = (self.EnergySplit.value * model.surfaceplant.HeatkWhExtracted.value[i]) / self.tot_heat_energy_consumed_per_tonne.value From 021a5742451278d35a867e9db8a9d26f28519358 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:53:18 -0700 Subject: [PATCH 6/6] Include How-to-extend-GEOPHIRES-X.md in manifest --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 0cf96349..10a512b3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -18,5 +18,6 @@ include CHANGELOG.rst include CONTRIBUTING.rst include LICENSE include README.rst +include How-to-extend-GEOPHIRES-X.md global-exclude *.py[cod] __pycache__/* *.so *.dylib