eeco 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. eeco-0.1.0/CONTRIBUTING.rst +47 -0
  2. eeco-0.1.0/LICENSE +21 -0
  3. eeco-0.1.0/MANIFEST.in +10 -0
  4. eeco-0.1.0/PKG-INFO +249 -0
  5. eeco-0.1.0/README.rst +172 -0
  6. eeco-0.1.0/docs/CONTRIBUTING.rst +5 -0
  7. eeco-0.1.0/docs/LICENSE.rst +8 -0
  8. eeco-0.1.0/docs/Makefile +20 -0
  9. eeco-0.1.0/docs/_static/img/categorize-tariff.png +0 -0
  10. eeco-0.1.0/docs/_static/img/cvx-carbon-intensity.png +0 -0
  11. eeco-0.1.0/docs/_static/img/cvx-cost-battery-soc.png +0 -0
  12. eeco-0.1.0/docs/_static/img/cvx-cost-model-out.png +0 -0
  13. eeco-0.1.0/docs/_static/img/cvx-emit-battery-soc.png +0 -0
  14. eeco-0.1.0/docs/_static/img/cvx-emit-model-out.png +0 -0
  15. eeco-0.1.0/docs/_static/img/cvx-tariff-structure.png +0 -0
  16. eeco-0.1.0/docs/_static/img/pyo-carbon-intensity.png +0 -0
  17. eeco-0.1.0/docs/_static/img/pyo-cost-battery-soc.png +0 -0
  18. eeco-0.1.0/docs/_static/img/pyo-cost-model-out.png +0 -0
  19. eeco-0.1.0/docs/_static/img/pyo-emit-battery-soc.png +0 -0
  20. eeco-0.1.0/docs/_static/img/pyo-emit-model-out.png +0 -0
  21. eeco-0.1.0/docs/_static/img/pyo-tariff-structure.png +0 -0
  22. eeco-0.1.0/docs/complexities.rst +78 -0
  23. eeco-0.1.0/docs/conf.py +220 -0
  24. eeco-0.1.0/docs/cooptimize.rst +373 -0
  25. eeco-0.1.0/docs/costs.rst +12 -0
  26. eeco-0.1.0/docs/data_format.rst +123 -0
  27. eeco-0.1.0/docs/emissions.rst +12 -0
  28. eeco-0.1.0/docs/hello.rst +51 -0
  29. eeco-0.1.0/docs/how_to_advanced.rst +207 -0
  30. eeco-0.1.0/docs/how_to_cost.rst +217 -0
  31. eeco-0.1.0/docs/how_to_emit.rst +147 -0
  32. eeco-0.1.0/docs/how_to_metrics.rst +13 -0
  33. eeco-0.1.0/docs/index.rst +53 -0
  34. eeco-0.1.0/docs/metrics.rst +12 -0
  35. eeco-0.1.0/docs/optimize_cost.rst +513 -0
  36. eeco-0.1.0/docs/optimize_emit.rst +402 -0
  37. eeco-0.1.0/docs/purpose.rst +27 -0
  38. eeco-0.1.0/docs/tutorial_metrics.rst +12 -0
  39. eeco-0.1.0/docs/units.rst +12 -0
  40. eeco-0.1.0/docs/utils.rst +12 -0
  41. eeco-0.1.0/docs/why_advanced.rst +78 -0
  42. eeco-0.1.0/docs/why_metrics.rst +25 -0
  43. eeco-0.1.0/docs/why_neutral.rst +29 -0
  44. eeco-0.1.0/eeco/__init__.py +12 -0
  45. eeco-0.1.0/eeco/costs.py +1988 -0
  46. eeco-0.1.0/eeco/data/consumption.csv +2881 -0
  47. eeco-0.1.0/eeco/data/emissions.csv +289 -0
  48. eeco-0.1.0/eeco/data/tariff.csv +23 -0
  49. eeco-0.1.0/eeco/emissions.py +341 -0
  50. eeco-0.1.0/eeco/metrics.py +315 -0
  51. eeco-0.1.0/eeco/units.py +24 -0
  52. eeco-0.1.0/eeco/utils.py +543 -0
  53. eeco-0.1.0/eeco.egg-info/PKG-INFO +249 -0
  54. eeco-0.1.0/eeco.egg-info/SOURCES.txt +60 -0
  55. eeco-0.1.0/eeco.egg-info/dependency_links.txt +1 -0
  56. eeco-0.1.0/eeco.egg-info/not-zip-safe +1 -0
  57. eeco-0.1.0/eeco.egg-info/requires.txt +48 -0
  58. eeco-0.1.0/eeco.egg-info/top_level.txt +1 -0
  59. eeco-0.1.0/pyproject.toml +2 -0
  60. eeco-0.1.0/setup.cfg +35 -0
  61. eeco-0.1.0/setup.py +78 -0
@@ -0,0 +1,47 @@
1
+ ************
2
+ Contributing
3
+ ************
4
+
5
+ Contribution Agreement
6
+ ======================
7
+ This section describes the terms under which you may make “Contributions” —
8
+ which may include without limitation, software additions, revisions, bug fixes, configuration changes, documentation, or any other materials —
9
+ to any of the projects owned or managed by the WE3Lab.
10
+ If you have questions about these terms, please contact Professor Mauter at mauter@stanford.edu.
11
+
12
+ You certify that:
13
+
14
+ - Your Contributions are either:
15
+
16
+ 1. Created in whole or in part by you and you have the right to submit them under the designated license (described below); or
17
+ 2. Based upon previous work that, to the best of your knowledge,
18
+ is covered under an appropriate open source license and you have the right under that license to submit that work with modifications,
19
+ whether created in whole or in part by you, under the designated license; or
20
+ 3. Provided directly to you by some other person who certified (1) or (2) and you have not modified them.
21
+ - You are granting your Contributions to the WE3Lab under the terms of the MIT license (the “designated license”).
22
+ - You understand and agree that the WE3Lab projects and your Contributions are public and that a record of the Contributions
23
+ (including all metadata and personal information you submit with them) is maintained indefinitely
24
+ and may be redistributed consistent with the WE3Lab's mission and the MIT license.
25
+
26
+ .. _CONTRIBUTING_Deploying:
27
+
28
+ Deploying
29
+ =========
30
+
31
+ A reminder for the maintainers on how to deploy.
32
+ Make sure all your changes are committed.
33
+ Then run:
34
+
35
+ .. code-block:: bash
36
+
37
+ git checkout main
38
+ git pull
39
+ bumpversion [part]
40
+ git push
41
+ git branch -D stable
42
+ git checkout -b stable
43
+ git push --set-upstream origin stable -f
44
+ git push --tags
45
+
46
+ Where ``[part]`` is ``major``, ``minor``, or ``patch``.
47
+ This will release a new package version on Git + GitHub and publish to PyPI.
eeco-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 we3lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
eeco-0.1.0/MANIFEST.in ADDED
@@ -0,0 +1,10 @@
1
+ include CONTRIBUTING.rst
2
+ include LICENSE
3
+ include README.rst
4
+
5
+ recursive-include tests *
6
+ recursive-exclude * __pycache__
7
+ recursive-exclude * *.py[co]
8
+
9
+ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
10
+ graft eeco/data
eeco-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,249 @@
1
+ Metadata-Version: 2.4
2
+ Name: eeco
3
+ Version: 0.1.0
4
+ Summary: Calculate electricity-related emissions and costs.
5
+ Home-page: https://github.com/we3lab/eeco
6
+ Author: WE3Lab
7
+ Author-email: fchapin@stanford.edu
8
+ Keywords: eeco
9
+ Classifier: Development Status :: 2 - Pre-Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: Free for non-commercial use
12
+ Classifier: Natural Language :: English
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/x-rst
20
+ License-File: LICENSE
21
+ Requires-Dist: pandas>=2.2.1
22
+ Requires-Dist: numpy>=1.26.4
23
+ Requires-Dist: cvxpy>=1.3.0
24
+ Requires-Dist: pyomo>=6.7
25
+ Requires-Dist: gurobipy>=11.0
26
+ Requires-Dist: pint>=0.19.2
27
+ Provides-Extra: setup
28
+ Provides-Extra: test
29
+ Requires-Dist: black>=22.3.0; extra == "test"
30
+ Requires-Dist: flake8>=4.0.0; extra == "test"
31
+ Requires-Dist: codecov>=2.1.4; extra == "test"
32
+ Requires-Dist: pytest>=8.1.1; extra == "test"
33
+ Requires-Dist: pytest-cov>=3.0.0; extra == "test"
34
+ Requires-Dist: pytest-html>=3.1.1; extra == "test"
35
+ Provides-Extra: dev
36
+ Requires-Dist: black>=22.3.0; extra == "dev"
37
+ Requires-Dist: flake8>=4.0.0; extra == "dev"
38
+ Requires-Dist: codecov>=2.1.4; extra == "dev"
39
+ Requires-Dist: pytest>=8.1.1; extra == "dev"
40
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
41
+ Requires-Dist: pytest-html>=3.1.1; extra == "dev"
42
+ Requires-Dist: Sphinx==7.0.1; extra == "dev"
43
+ Requires-Dist: sphinx-rtd-theme==2.0.0; extra == "dev"
44
+ Requires-Dist: tox>=3.24.5; extra == "dev"
45
+ Requires-Dist: matplotlib>=3.8.4; extra == "dev"
46
+ Requires-Dist: ipykernel; extra == "dev"
47
+ Provides-Extra: all
48
+ Requires-Dist: pandas>=2.2.1; extra == "all"
49
+ Requires-Dist: numpy>=1.26.4; extra == "all"
50
+ Requires-Dist: cvxpy>=1.3.0; extra == "all"
51
+ Requires-Dist: pyomo>=6.7; extra == "all"
52
+ Requires-Dist: gurobipy>=11.0; extra == "all"
53
+ Requires-Dist: pint>=0.19.2; extra == "all"
54
+ Requires-Dist: black>=22.3.0; extra == "all"
55
+ Requires-Dist: flake8>=4.0.0; extra == "all"
56
+ Requires-Dist: codecov>=2.1.4; extra == "all"
57
+ Requires-Dist: pytest>=8.1.1; extra == "all"
58
+ Requires-Dist: pytest-cov>=3.0.0; extra == "all"
59
+ Requires-Dist: pytest-html>=3.1.1; extra == "all"
60
+ Requires-Dist: Sphinx==7.0.1; extra == "all"
61
+ Requires-Dist: sphinx-rtd-theme==2.0.0; extra == "all"
62
+ Requires-Dist: tox>=3.24.5; extra == "all"
63
+ Requires-Dist: matplotlib>=3.8.4; extra == "all"
64
+ Requires-Dist: ipykernel; extra == "all"
65
+ Dynamic: author
66
+ Dynamic: author-email
67
+ Dynamic: classifier
68
+ Dynamic: description
69
+ Dynamic: description-content-type
70
+ Dynamic: home-page
71
+ Dynamic: keywords
72
+ Dynamic: license-file
73
+ Dynamic: provides-extra
74
+ Dynamic: requires-dist
75
+ Dynamic: requires-python
76
+ Dynamic: summary
77
+
78
+ ******************************************
79
+ Electric Emissions & Cost Optimizer (EECO)
80
+ ******************************************
81
+
82
+ .. image::
83
+ https://github.com/we3lab/eeco/workflows/Build%20Main/badge.svg
84
+ :height: 30
85
+ :target: https://github.com/we3lab/eeco/actions
86
+ :alt: Build Status
87
+
88
+ .. image::
89
+ https://github.com/we3lab/eeco/workflows/Documentation/badge.svg
90
+ :height: 30
91
+ :target: https://we3lab.github.io/eeco
92
+ :alt: Documentation
93
+
94
+ .. image::
95
+ https://codecov.io/gh/we3lab/eeco/branch/main/graph/badge.svg
96
+ :height: 30
97
+ :target: https://codecov.io/gh/we3lab/eeco
98
+ :alt: Code Coverage
99
+
100
+ A package for calculating electricity-related emissions and costs for optimization problem formulation and other computational analyses.
101
+
102
+ Useful Commands
103
+ ===============
104
+
105
+ 1. ``pip install -e .``
106
+
107
+ This will install your package in editable mode.
108
+
109
+ 2. ``pytest eeco/tests --cov=eeco --cov-report=html``
110
+
111
+ Produces an HTML test coverage report for the entire project which can
112
+ be found at ``htmlcov/index.html``.
113
+
114
+ 3. ``docs/make html``
115
+
116
+ This will generate an HTML version of the documentation which can be found
117
+ at ``_build/html/index.html``.
118
+
119
+ 4. ``flake8 eeco --count --verbose --show-source --statistics``
120
+
121
+ This will lint the code and share all the style errors it finds.
122
+
123
+ 5. ``black eeco``
124
+
125
+ This will reformat the code according to strict style guidelines.
126
+
127
+ Documentation
128
+ ==============
129
+
130
+ The documentation for this package is hosted on `GitHub Pages <https://we3lab.github.io/eeco>`_.
131
+
132
+ Legal Documents
133
+ ===============
134
+
135
+ This work was supported by the following grants and programs:
136
+
137
+ - `National Alliance for Water Innovation (NAWI) <https://www.nawihub.org/>`_ (grant number UBJQH - MSM)
138
+ - `Department of Energy, the Office of Energy Efficiency and Renewable Energy, Advanced Manufacturing Office <https://www.energy.gov/eere/ammto/advanced-materials-and-manufacturing-technologies-office>`_ (grant number DE-EE0009499)
139
+ - `California Energy Commission (CEC) <https://www.energy.ca.gov/>`_ (grant number GFO-23-316)
140
+ - `Equitable, Affordable & Resilient Nationwide Energy System Transition (EARNEST) Consortium <https://earnest.stanford.edu/>`_
141
+ - `Stanford University Bits & Watts Initiative <https://bitsandwatts.stanford.edu/>`_
142
+ - `Stanford Woods Institute Realizing Environmental Innovation Program (REIP) <https://woods.stanford.edu/research/funding-opportunities/realizing-environmental-innovation-program>`_
143
+ - `Stanford Woods Institute Mentoring Undergraduate in Interdisciplinary Research (MUIR) Program <https://woods.stanford.edu/educating-leaders/education-leadership-programs/mentoring-undergraduates-interdisciplinary-research>`_
144
+ - `Stanford University Sustainability Undergraduate Research in Geoscience and Engineering (SURGE) Program <https://sustainability.stanford.edu/our-community/access-belonging-community/surge>`_
145
+
146
+ The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof. Neither the United States Government nor any agency thereof, nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights.
147
+
148
+ - `LICENSE <https://github.com/we3lab/eeco/blob/main/LICENSE/>`_
149
+ - `CONTRIBUTING <https://github.com/we3lab/eeco/blob/main/CONTRIBUTING.rst/>`_
150
+
151
+ Attribution
152
+ ===========
153
+
154
+ If you found this package useful, we encourage you to cite the following papers depending on which portion of the code you use:
155
+
156
+ Citing `costs.py`
157
+ *****************
158
+
159
+ The development of `costs.py` was the culmination of two papers from the WE3Lab.
160
+
161
+ The convex formulation of tariff costs for optimizing flexible loads was originally developed for a case study of flexible wastewater treatment plant operation published in Environmental Science & Technology:
162
+
163
+ Bolorinos, J., Mauter, M. S., & Rajagopal, R. Integrated energy flexibility management at wastewater treatment facilities. *Environ. Sci. Technol.* **57**, 18362-18371. (2023). DOI: `10.1021/acs.est.3c00365 <https://doi.org/10.1021/acs.est.3c00365>`_
164
+
165
+ In `BibTeX` format:
166
+
167
+ .. code-block::
168
+
169
+ @article{bolorinos2023integrated,
170
+ title={Integrated energy flexibility management at wastewater treatment facilities},
171
+ author={Bolorinos, Jose and Mauter, Meagan S and Rajagopal, Ram},
172
+ journal={Environmental Science \& Technology},
173
+ volume={57},
174
+ number={46},
175
+ pages={18362--18371},
176
+ year={2023},
177
+ publisher={ACS Publications},
178
+ url={https://doi.org/10.1021/acs.est.3c00365}
179
+ }
180
+
181
+
182
+ The tariff data format was published in the following data descriptor in Nature Scientific Data:
183
+
184
+ Chapin, F.T., Bolorinos, J. & Mauter, M.S. Electricity and natural gas tariffs at United States wastewater treatment plants. *Sci Data* **11**, 113 (2024). DOI: `10.1038/s41597-023-02886-6 <https://doi.org/10.1038/s41597-023-02886-6>`_
185
+
186
+ In `BibTeX` format:
187
+
188
+ .. code-block::
189
+
190
+ @Article{Chapin2024,
191
+ author={Chapin, Fletcher T and Bolorinos, Jose and Mauter, Meagan S.},
192
+ title={Electricity and natural gas tariffs at United States wastewater treatment plants},
193
+ journal={Scientific Data},
194
+ year={2024},
195
+ month={Jan},
196
+ day={23},
197
+ volume={11},
198
+ number={1},
199
+ pages={113},
200
+ issn={2052-4463},
201
+ doi={10.1038/s41597-023-02886-6},
202
+ url={https://doi.org/10.1038/s41597-023-02886-6}
203
+ }
204
+
205
+ Citing `emissions.py`
206
+ *********************
207
+
208
+ The emissions optimization code was originally developed for co-optimizing costs and emissions at a wastewater treatment plant and published in Environmental Science & Technology:
209
+
210
+ Chapin, F.T., Wettermark, D., Bolorinos, J. & Mauter, M.S. Load-shifting strategies for cost-effective emission reductions at wastewater facilities *Environ. Sci. Technol.* **59**, 2285-2294 (2025). DOI: `10.1021/acs.est.4c09773 <https://doi.org/10.1021/acs.est.4c09773>`_
211
+
212
+ In `BibTeX` format:
213
+
214
+ .. code-block::
215
+
216
+ @article{chapin2025load,
217
+ title={Load-Shifting Strategies for Cost-Effective Emission Reductions at Wastewater Facilities},
218
+ author={Chapin, Fletcher T and Wettermark, Daly and Bolorinos, Jose and Mauter, Meagan S},
219
+ journal={Environmental Science \& Technology},
220
+ volume={59},
221
+ number={4},
222
+ pages={2285--2294},
223
+ year={2025},
224
+ publisher={ACS Publications},
225
+ url={https://pubs.acs.org/doi/10.1021/acs.est.4c09773}
226
+ }
227
+
228
+ Citing `metrics.py`
229
+ *******************
230
+
231
+ The flexibility metrics come from the following Nature Water paper:
232
+
233
+ Rao, A. K., Bolorinos, J., Musabandesu, E., Chapin, F. T., & Mauter, M. S. Valuing energy flexibility from water systems. *Nat. Water* **2**, 1028-1037 (2024). DOI: `10.1038/s44221-024-00316-4 <https://doi.org/10.1038/s44221-024-00316-4>`_
234
+
235
+ In `BibTeX` format:
236
+
237
+ .. code-block::
238
+
239
+ @article{rao2024valuing,
240
+ title={Valuing energy flexibility from water systems},
241
+ author={Rao, Akshay K and Bolorinos, Jose and Musabandesu, Erin and Chapin, Fletcher T and Mauter, Meagan S},
242
+ journal={Nature Water},
243
+ volume={2},
244
+ number={10},
245
+ pages={1028--1037},
246
+ year={2024},
247
+ publisher={Nature Publishing Group UK London},
248
+ url={https://doi.org/10.1038/s44221-024-00316-4}
249
+ }
eeco-0.1.0/README.rst ADDED
@@ -0,0 +1,172 @@
1
+ ******************************************
2
+ Electric Emissions & Cost Optimizer (EECO)
3
+ ******************************************
4
+
5
+ .. image::
6
+ https://github.com/we3lab/eeco/workflows/Build%20Main/badge.svg
7
+ :height: 30
8
+ :target: https://github.com/we3lab/eeco/actions
9
+ :alt: Build Status
10
+
11
+ .. image::
12
+ https://github.com/we3lab/eeco/workflows/Documentation/badge.svg
13
+ :height: 30
14
+ :target: https://we3lab.github.io/eeco
15
+ :alt: Documentation
16
+
17
+ .. image::
18
+ https://codecov.io/gh/we3lab/eeco/branch/main/graph/badge.svg
19
+ :height: 30
20
+ :target: https://codecov.io/gh/we3lab/eeco
21
+ :alt: Code Coverage
22
+
23
+ A package for calculating electricity-related emissions and costs for optimization problem formulation and other computational analyses.
24
+
25
+ Useful Commands
26
+ ===============
27
+
28
+ 1. ``pip install -e .``
29
+
30
+ This will install your package in editable mode.
31
+
32
+ 2. ``pytest eeco/tests --cov=eeco --cov-report=html``
33
+
34
+ Produces an HTML test coverage report for the entire project which can
35
+ be found at ``htmlcov/index.html``.
36
+
37
+ 3. ``docs/make html``
38
+
39
+ This will generate an HTML version of the documentation which can be found
40
+ at ``_build/html/index.html``.
41
+
42
+ 4. ``flake8 eeco --count --verbose --show-source --statistics``
43
+
44
+ This will lint the code and share all the style errors it finds.
45
+
46
+ 5. ``black eeco``
47
+
48
+ This will reformat the code according to strict style guidelines.
49
+
50
+ Documentation
51
+ ==============
52
+
53
+ The documentation for this package is hosted on `GitHub Pages <https://we3lab.github.io/eeco>`_.
54
+
55
+ Legal Documents
56
+ ===============
57
+
58
+ This work was supported by the following grants and programs:
59
+
60
+ - `National Alliance for Water Innovation (NAWI) <https://www.nawihub.org/>`_ (grant number UBJQH - MSM)
61
+ - `Department of Energy, the Office of Energy Efficiency and Renewable Energy, Advanced Manufacturing Office <https://www.energy.gov/eere/ammto/advanced-materials-and-manufacturing-technologies-office>`_ (grant number DE-EE0009499)
62
+ - `California Energy Commission (CEC) <https://www.energy.ca.gov/>`_ (grant number GFO-23-316)
63
+ - `Equitable, Affordable & Resilient Nationwide Energy System Transition (EARNEST) Consortium <https://earnest.stanford.edu/>`_
64
+ - `Stanford University Bits & Watts Initiative <https://bitsandwatts.stanford.edu/>`_
65
+ - `Stanford Woods Institute Realizing Environmental Innovation Program (REIP) <https://woods.stanford.edu/research/funding-opportunities/realizing-environmental-innovation-program>`_
66
+ - `Stanford Woods Institute Mentoring Undergraduate in Interdisciplinary Research (MUIR) Program <https://woods.stanford.edu/educating-leaders/education-leadership-programs/mentoring-undergraduates-interdisciplinary-research>`_
67
+ - `Stanford University Sustainability Undergraduate Research in Geoscience and Engineering (SURGE) Program <https://sustainability.stanford.edu/our-community/access-belonging-community/surge>`_
68
+
69
+ The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof. Neither the United States Government nor any agency thereof, nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights.
70
+
71
+ - `LICENSE <https://github.com/we3lab/eeco/blob/main/LICENSE/>`_
72
+ - `CONTRIBUTING <https://github.com/we3lab/eeco/blob/main/CONTRIBUTING.rst/>`_
73
+
74
+ Attribution
75
+ ===========
76
+
77
+ If you found this package useful, we encourage you to cite the following papers depending on which portion of the code you use:
78
+
79
+ Citing `costs.py`
80
+ *****************
81
+
82
+ The development of `costs.py` was the culmination of two papers from the WE3Lab.
83
+
84
+ The convex formulation of tariff costs for optimizing flexible loads was originally developed for a case study of flexible wastewater treatment plant operation published in Environmental Science & Technology:
85
+
86
+ Bolorinos, J., Mauter, M. S., & Rajagopal, R. Integrated energy flexibility management at wastewater treatment facilities. *Environ. Sci. Technol.* **57**, 18362-18371. (2023). DOI: `10.1021/acs.est.3c00365 <https://doi.org/10.1021/acs.est.3c00365>`_
87
+
88
+ In `BibTeX` format:
89
+
90
+ .. code-block::
91
+
92
+ @article{bolorinos2023integrated,
93
+ title={Integrated energy flexibility management at wastewater treatment facilities},
94
+ author={Bolorinos, Jose and Mauter, Meagan S and Rajagopal, Ram},
95
+ journal={Environmental Science \& Technology},
96
+ volume={57},
97
+ number={46},
98
+ pages={18362--18371},
99
+ year={2023},
100
+ publisher={ACS Publications},
101
+ url={https://doi.org/10.1021/acs.est.3c00365}
102
+ }
103
+
104
+
105
+ The tariff data format was published in the following data descriptor in Nature Scientific Data:
106
+
107
+ Chapin, F.T., Bolorinos, J. & Mauter, M.S. Electricity and natural gas tariffs at United States wastewater treatment plants. *Sci Data* **11**, 113 (2024). DOI: `10.1038/s41597-023-02886-6 <https://doi.org/10.1038/s41597-023-02886-6>`_
108
+
109
+ In `BibTeX` format:
110
+
111
+ .. code-block::
112
+
113
+ @Article{Chapin2024,
114
+ author={Chapin, Fletcher T and Bolorinos, Jose and Mauter, Meagan S.},
115
+ title={Electricity and natural gas tariffs at United States wastewater treatment plants},
116
+ journal={Scientific Data},
117
+ year={2024},
118
+ month={Jan},
119
+ day={23},
120
+ volume={11},
121
+ number={1},
122
+ pages={113},
123
+ issn={2052-4463},
124
+ doi={10.1038/s41597-023-02886-6},
125
+ url={https://doi.org/10.1038/s41597-023-02886-6}
126
+ }
127
+
128
+ Citing `emissions.py`
129
+ *********************
130
+
131
+ The emissions optimization code was originally developed for co-optimizing costs and emissions at a wastewater treatment plant and published in Environmental Science & Technology:
132
+
133
+ Chapin, F.T., Wettermark, D., Bolorinos, J. & Mauter, M.S. Load-shifting strategies for cost-effective emission reductions at wastewater facilities *Environ. Sci. Technol.* **59**, 2285-2294 (2025). DOI: `10.1021/acs.est.4c09773 <https://doi.org/10.1021/acs.est.4c09773>`_
134
+
135
+ In `BibTeX` format:
136
+
137
+ .. code-block::
138
+
139
+ @article{chapin2025load,
140
+ title={Load-Shifting Strategies for Cost-Effective Emission Reductions at Wastewater Facilities},
141
+ author={Chapin, Fletcher T and Wettermark, Daly and Bolorinos, Jose and Mauter, Meagan S},
142
+ journal={Environmental Science \& Technology},
143
+ volume={59},
144
+ number={4},
145
+ pages={2285--2294},
146
+ year={2025},
147
+ publisher={ACS Publications},
148
+ url={https://pubs.acs.org/doi/10.1021/acs.est.4c09773}
149
+ }
150
+
151
+ Citing `metrics.py`
152
+ *******************
153
+
154
+ The flexibility metrics come from the following Nature Water paper:
155
+
156
+ Rao, A. K., Bolorinos, J., Musabandesu, E., Chapin, F. T., & Mauter, M. S. Valuing energy flexibility from water systems. *Nat. Water* **2**, 1028-1037 (2024). DOI: `10.1038/s44221-024-00316-4 <https://doi.org/10.1038/s44221-024-00316-4>`_
157
+
158
+ In `BibTeX` format:
159
+
160
+ .. code-block::
161
+
162
+ @article{rao2024valuing,
163
+ title={Valuing energy flexibility from water systems},
164
+ author={Rao, Akshay K and Bolorinos, Jose and Musabandesu, Erin and Chapin, Fletcher T and Mauter, Meagan S},
165
+ journal={Nature Water},
166
+ volume={2},
167
+ number={10},
168
+ pages={1028--1037},
169
+ year={2024},
170
+ publisher={Nature Publishing Group UK London},
171
+ url={https://doi.org/10.1038/s44221-024-00316-4}
172
+ }
@@ -0,0 +1,5 @@
1
+ .. contents::
2
+
3
+ .. _CONTRIBUTING:
4
+
5
+ .. include:: ../CONTRIBUTING.rst
@@ -0,0 +1,8 @@
1
+ .. contents::
2
+
3
+ .. _LICENSE:
4
+
5
+ MIT License
6
+ ===========
7
+
8
+ .. include:: ../LICENSE
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line.
5
+ SPHINXOPTS =
6
+ SPHINXBUILD = python3 -msphinx
7
+ SPHINXPROJ = eeco
8
+ SOURCEDIR = .
9
+ BUILDDIR = _build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,78 @@
1
+ .. contents::
2
+
3
+ .. _complexities:
4
+
5
+ ******************************************
6
+ What Makes Electricity Tariffs so Complex?
7
+ ******************************************
8
+
9
+ To quote our paper, "Electricity and natural gas tariffs at United States wastewater treatment plants" [`Chapin 𝑁𝑎𝑡. 𝑆𝑐𝑖. 𝐷𝑎𝑡𝑎 (2024) <https://doi.org/10.1038/s41597-023-02886-6>`_]:
10
+
11
+ Tariffs typically have three components:
12
+ (1) customer charges, or monthly minimum payments regardless of quantity of energy delivered,
13
+ which vary by type of customer (e.g., residential, commercial);
14
+ (2) energy charges billed by energy consumption in kWh or therms for electricity and natural gas, respectively; and
15
+ (3) demand charges billed by monthly maximum electricity or natural gas usage in kW and therms/hr, respectively, and averaged over 5-15 minute increments.
16
+ A therm is defined as 105.5 MJ, or the heat content of 100 cubic feet of methane at standard temperature and pressure.
17
+ More complex tariffs may also have tiered energy and demand charges based on cumulative monthly demand, seasonal (i.e., monthly) and
18
+ time-of-use (i.e., daily and/or hourly) variation in marginal energy and demand charges, and bundled or decoupled generation and delivery charges.
19
+
20
+ Within each component of the tariff, there is tremendous variability across both the underlying tariff structure
21
+ and the charge per unit of energy delivered. As alluded to above,
22
+ some utilities establish tariffs with flat rate energy and demand charges,
23
+ where the price of energy is constant throughout the day.
24
+ Other utilities establish tariffs with a time-of-use (TOU) component,
25
+ where a peak hour surcharge is applied to each kWh (or therm) of energy delivered and kW (or therm/hr) of demand.
26
+ TOU periods can vary from weekend to weekday in addition to hour-to-hour.
27
+ Prices may also change seasonally (i.e., month-to-month) based on climate,
28
+ with the highest prices depending on whether heating or air conditioning drive the maximum load on the grid.
29
+ Finally, prices often vary based on total monthly consumption.
30
+ For example, Con Edison charges almost $33/therm for the first 3 therms delivered and less than $1/therm thereafter.
31
+
32
+ Demand charges are particularly problematic for optimization problems since taking a maximum is not a matrix operation.
33
+ Tiered charges provide another challenge since assumptions will have to be made about what tier a customer will fall into before the optimization problem is solved,
34
+ but that assumption could be influenced by the results of the optimization problem (:ref:`why-consumption-est`).
35
+
36
+ We standardized a machine-readable format for storing tariff data that addresses the complexities of tariff structure found across the United States (:ref:`data-format`).
37
+
38
+ .. _categorize-tariffs:
39
+
40
+ Categorizing Electricity Tariffs
41
+ ================================
42
+
43
+ We also developed a categorization for the wide range of tariff structures present nationwide.
44
+ To summarize their attributes, we descriptively categorized tariffs on two dimensions:
45
+
46
+ 1. the hourly, daily, and monthly variability of energy and demand charges (“temporality”), and
47
+ 2. whether electric power generation and delivery charges are bundled (“bundling”).
48
+
49
+ Temporality
50
+ ***********
51
+
52
+ We categorize monthly electricity energy and demand charges into Flat, Seasonal-TOU, Nonseasonal-TOU, or Seasonal-NonTOU charges:
53
+
54
+ - **Flat Charges**: Charges are constant throughout the year.
55
+ - **Seasonal-TOU Charges**: Charges vary monthly (Seasonal) and daily and/or hourly (TOU).
56
+ - **Nonseasonal-TOU Charges**: Charges are consistent from month to month, but vary daily and/or hourly.
57
+ - **Seasonal-NonTOU Charges**: Charges vary monthly, but are constant from day to day and hour to hour.
58
+
59
+ .. figure:: _static/img/categorize-tariff.png
60
+
61
+ Representative flat, time-of-use (TOU), and seasonal price profiles.
62
+ (a) Winter prices and (b) summer prices representing Flat, Seasonal-TOU, Nonseasonal-TOU, and Seasonal-NonTOU tariffs.
63
+ Cost would be calculated in $/kW, $/(therm/hr), $/kWh, or $/therm for electricity demand charges, natural gas demand charges, electricity energy charges, and natural gas energy charges, respectively.
64
+ A therm is defined as 105.5 MJ, or approximately the heat content of 100 cubic feet of natural gas.
65
+
66
+ Bundling
67
+ ********
68
+ In the United States, generation, transmission, and distribution charges are commonly bundled into a single electricity energy charge.
69
+ However, in some cases, facilities pay separate generation (or supply) and delivery (or transmission and distribution) charges to a single provider or to generation and delivery providers separately.
70
+ For example, in much of the Texas interconnection, delivery and generation service providers are distinct.
71
+
72
+ We developed a second categorization scheme for electricity tariffs based on the extent to which generation and delivery charges are bundled:
73
+
74
+ - Class 1: Fully bundled generation (supply) and delivery (transmission and distribution) charges.
75
+ - Class 2: Bundled generation and delivery charges with fuel cost adjustment based on the market price of fossil fuels.
76
+ - Class 3: Generation and delivery service from the same provider with pre-defined charges.
77
+ - Class 4: Generation and delivery service from the same provider with pre-defined delivery charges and variable generation charges that reflect real-time or day-ahead electricity prices set by the live market.
78
+ - Class 5: Generation and delivery service providers are legally required to be separate, and delivery charges are directly negotiated between customers and utilities. As a result, delivery charges are not published in tariff books, but can be obtained through public information requests.