pypsa-cl 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.
pypsa_cl-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ministry of Energy of Chile
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.
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: pypsa-cl
3
+ Version: 0.1.0
4
+ Summary: Long-term capacity expansion model of the Chilean National Electricity System (SEN), built on PyPSA
5
+ Author: Ministry of Energy of Chile - Unit of Planning and Climate Change
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/paredes-vergara/PyPSA-CL
8
+ Project-URL: Source, https://github.com/paredes-vergara/PyPSA-CL
9
+ Project-URL: Issues, https://github.com/paredes-vergara/PyPSA-CL/issues
10
+ Project-URL: Changelog, https://github.com/paredes-vergara/PyPSA-CL/blob/main/CHANGELOG.md
11
+ Keywords: pypsa,energy,power systems,capacity expansion,energy planning,Chile,PELP
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Natural Language :: English
15
+ Classifier: Natural Language :: Spanish
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pypsa<1.4,>=1.3
24
+ Requires-Dist: linopy<0.10,>=0.9
25
+ Requires-Dist: numpy>=1.24
26
+ Requires-Dist: pandas>=2.0
27
+ Requires-Dist: xarray>=2023.1
28
+ Requires-Dist: openpyxl>=3.1
29
+ Requires-Dist: psutil>=5.9
30
+ Requires-Dist: tkcalendar>=1.6
31
+ Requires-Dist: Pillow>=10.0
32
+ Provides-Extra: gurobi
33
+ Requires-Dist: gurobipy>=11.0; extra == "gurobi"
34
+ Provides-Extra: highs
35
+ Requires-Dist: highspy>=1.7; extra == "highs"
36
+ Dynamic: license-file
37
+
38
+ # PyPSA-CL — Long-Term Capacity Expansion Model of the Chilean National Electricity System
39
+
40
+ A long-term generation, storage and transmission capacity expansion model of
41
+ Chile's National Electricity System (*Sistema Eléctrico Nacional*, SEN, 234
42
+ nodes), built on [PyPSA](https://pypsa.org/). The model was developed for the
43
+ Long-Term Energy Planning process (*Planificación Energética de Largo Plazo*,
44
+ PELP 2028-2032).
45
+
46
+ The optimisation co-optimises investment and hourly operation across multiple
47
+ representative periods, subject to system-level operating constraints (inertia,
48
+ operating reserve), build-rate limits, CO₂ emission caps, unserved-energy limits
49
+ and discrete transmission expansion. A detailed hydraulic network couples hydro
50
+ generation to water balances, inflows and irrigation.
51
+
52
+ ## Repository layout
53
+
54
+ ```
55
+ .
56
+ ├── src/
57
+ │ └── pypsa_cl/ Python package
58
+ │ ├── main.py Entry point and epoch/scenario driver
59
+ │ ├── GUI.py Scenario and epoch configuration interface
60
+ │ ├── tools.py Data loaders, constraints and result exporters
61
+ │ ├── cli.py `pypsa-cl` command
62
+ │ └── assets/ GUI images
63
+ ├── data/ Input workbooks (not tracked; see below)
64
+ ├── outputs/ Model outputs (generated at run time)
65
+ ├── pyproject.toml
66
+ ├── CHANGELOG.md
67
+ ├── LICENSE
68
+ └── README.md
69
+ ```
70
+
71
+ ## Installation
72
+
73
+ The model requires Python 3.10 or newer (with Tk, which the standard Windows
74
+ installer includes) and a mixed-integer linear programming solver supported by
75
+ PyPSA. The open-source [HiGHS](https://highs.dev/) solver is installed
76
+ automatically and is the default; [Gurobi](https://www.gurobi.com/) (licence
77
+ required), CPLEX and CBC can also be selected. The GUI is developed and tested
78
+ on Windows.
79
+
80
+ ### From PyPI
81
+
82
+ ```bash
83
+ python -m venv .venv
84
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
85
+ pip install pypsa-cl # with Gurobi: pip install "pypsa-cl[gurobi]"
86
+ pypsa-cl # downloads the input data on first run, then opens the GUI
87
+ ```
88
+
89
+ ### From source
90
+
91
+ ```bash
92
+ git clone https://github.com/paredes-vergara/PyPSA-CL.git
93
+ cd PyPSA-CL
94
+ pip install -e . # or: pip install -e ".[gurobi]"
95
+ ```
96
+
97
+ ## Working folder
98
+
99
+ The model writes its results to an `outputs/` folder inside a *working folder*.
100
+ The working folder is:
101
+
102
+ 1. the folder given by the `PYPSA_CL_ROOT` environment variable, if set;
103
+ 2. otherwise, the current directory if it contains `data/`;
104
+ 3. otherwise, the repository root when running from a source checkout;
105
+ 4. otherwise, the current directory.
106
+
107
+ ```
108
+ my-pelp-run/
109
+ ├── data/ Optional: your own copy of the input workbooks (see below)
110
+ └── outputs/ Created automatically
111
+ ```
112
+
113
+ ## Input data
114
+
115
+ The model reads the following workbooks:
116
+
117
+ | File | Contents |
118
+ | -------------------------- | --------------------------------------------------- |
119
+ | `Topology.xlsx` | Buses, lines and generator/storage technical data |
120
+ | `Loads.xlsx` | Demand time series by node and scenario |
121
+ | `Profiles.xlsx` | Variable renewable and CSP availability profiles |
122
+ | `Costs.xlsx` | Fuel prices and generation/storage investment costs |
123
+ | `Hydraulic network.xlsx` | Water nodes, links and reservoirs |
124
+ | `Water time series.xlsx` | Inflow and irrigation series |
125
+ | `Policy levers.xlsx` | CO₂ tax, coal phase-out and expansion schedules |
126
+
127
+ These workbooks (about 245 MB) are too large for the PyPI package, so they are
128
+ published separately on Zenodo
129
+ ([doi:10.5281/zenodo.24204230](https://doi.org/10.5281/zenodo.24204230)) and **downloaded automatically the first time
130
+ the model runs**. Each download is checked against its SHA-256 checksum. To
131
+ fetch them without starting the model, run `pypsa-cl --download-data`;
132
+ `pypsa-cl --data-dir` shows where they are stored.
133
+
134
+ The data folder is:
135
+
136
+ 1. the folder given by the `PYPSA_CL_DATA_DIR` environment variable, if set;
137
+ 2. otherwise, the `data/` folder of the working folder, if it exists;
138
+ 3. otherwise, `~/.pypsa-cl/data-v<data version>` (shared by all working folders).
139
+
140
+ Workbooks already present in the data folder are used as they are and never
141
+ overwritten, so you can run the model with your own modified inputs by placing
142
+ all seven workbooks in `data/`. Only missing workbooks are downloaded. The
143
+ download source can be changed with the `PYPSA_CL_DATA_URL` environment variable
144
+ (a base URL under which the files are served by name).
145
+
146
+ The GUI header logo and network map ship with the package; files named
147
+ `logo_PELP.png` or `sen_network.png` placed in `data/` take precedence.
148
+
149
+ Disclaimer: Although the data for CSP and hydro ROR candidate generators is present in the Topology file, these candidates were not implemented in this version due to time constraints. These candidates should be implemented in the Final Report version.
150
+
151
+ ## Usage
152
+
153
+ ### Interactive (GUI)
154
+
155
+ ```bash
156
+ cd my-pelp-run # working folder: results go to my-pelp-run/outputs/
157
+ pypsa-cl # equivalent: python -m pypsa_cl
158
+ ```
159
+
160
+ The interface lets you queue one or more **global scenarios**, each composed of
161
+ one or more **investment epochs**. Preset scenario packages (`E1`-`N3`)
162
+ auto-fill and lock the six component selectors (demand, climate, hydrology, fuel
163
+ price, generation investment cost, storage investment cost); the *Otro* option
164
+ unlocks free configuration. Scenarios can be executed sequentially or in
165
+ parallel (one independent process per scenario, with a configurable RAM limit).
166
+
167
+ ### Headless (single scenario)
168
+
169
+ A single scenario can be run without the GUI by supplying its configuration as
170
+ JSON:
171
+
172
+ ```bash
173
+ pypsa-cl --scenario-json path/to/scenario.json
174
+ ```
175
+
176
+ Output location is controlled by the `PYPSA_CL_OUTPUTS_DIR` environment
177
+ variable; when unset, results are written under `outputs/` in the working folder.
178
+ Run `pypsa-cl --help` for a summary of the command-line options.
179
+
180
+ ## Versioning
181
+
182
+ Releases follow the stages of the PELP 2028-2032 process: `0.1.x` corresponds to
183
+ the Preliminary Report, `0.2.x` to the Final Report and `1.0.0` to the Definitive
184
+ Report. See [CHANGELOG.md](https://github.com/paredes-vergara/PyPSA-CL/blob/main/CHANGELOG.md).
185
+
186
+ ## Outputs
187
+
188
+ Each run writes the following CSV files to the output folder:
189
+
190
+ | File | Contents |
191
+ | ----------------------------- | ---------------------------------------------------- |
192
+ | `generation_results.csv` | Dispatch per asset and snapshot, with reserve, available and curtailment columns |
193
+ | `transmission_results.csv` | Flows per line and snapshot |
194
+ | `generation_expansion.csv` | Generation and storage expansion per epoch |
195
+ | `transmission_expansion.csv` | Transmission expansion per epoch |
196
+ | `installed_capacity.csv` | Installed capacity per epoch |
197
+ | `system_costs.csv` | System cost breakdown |
198
+ | `nodal_marginal_prices.csv` | Nodal marginal prices |
199
+ | `run_metadata_log.csv` | Parameters, solver settings and timings per epoch |
200
+ | `progress.json` | Live run status for monitoring |
201
+
202
+ In multi-scenario runs the outputs are concatenated into the same files, ordered
203
+ by scenario and identified by the `global_scenario` column.
204
+
205
+ ## Acknowledgements
206
+
207
+ Developed by the Unit of Planning and Climate Change (*Unidad de Planificación y
208
+ Cambio Climático*), Division of Strategic Planning and Sustainable Development,
209
+ Ministry of Energy of Chile.
210
+
211
+ ## License
212
+
213
+ Released under the MIT License. See [LICENSE](https://github.com/paredes-vergara/PyPSA-CL/blob/main/LICENSE).
@@ -0,0 +1,176 @@
1
+ # PyPSA-CL — Long-Term Capacity Expansion Model of the Chilean National Electricity System
2
+
3
+ A long-term generation, storage and transmission capacity expansion model of
4
+ Chile's National Electricity System (*Sistema Eléctrico Nacional*, SEN, 234
5
+ nodes), built on [PyPSA](https://pypsa.org/). The model was developed for the
6
+ Long-Term Energy Planning process (*Planificación Energética de Largo Plazo*,
7
+ PELP 2028-2032).
8
+
9
+ The optimisation co-optimises investment and hourly operation across multiple
10
+ representative periods, subject to system-level operating constraints (inertia,
11
+ operating reserve), build-rate limits, CO₂ emission caps, unserved-energy limits
12
+ and discrete transmission expansion. A detailed hydraulic network couples hydro
13
+ generation to water balances, inflows and irrigation.
14
+
15
+ ## Repository layout
16
+
17
+ ```
18
+ .
19
+ ├── src/
20
+ │ └── pypsa_cl/ Python package
21
+ │ ├── main.py Entry point and epoch/scenario driver
22
+ │ ├── GUI.py Scenario and epoch configuration interface
23
+ │ ├── tools.py Data loaders, constraints and result exporters
24
+ │ ├── cli.py `pypsa-cl` command
25
+ │ └── assets/ GUI images
26
+ ├── data/ Input workbooks (not tracked; see below)
27
+ ├── outputs/ Model outputs (generated at run time)
28
+ ├── pyproject.toml
29
+ ├── CHANGELOG.md
30
+ ├── LICENSE
31
+ └── README.md
32
+ ```
33
+
34
+ ## Installation
35
+
36
+ The model requires Python 3.10 or newer (with Tk, which the standard Windows
37
+ installer includes) and a mixed-integer linear programming solver supported by
38
+ PyPSA. The open-source [HiGHS](https://highs.dev/) solver is installed
39
+ automatically and is the default; [Gurobi](https://www.gurobi.com/) (licence
40
+ required), CPLEX and CBC can also be selected. The GUI is developed and tested
41
+ on Windows.
42
+
43
+ ### From PyPI
44
+
45
+ ```bash
46
+ python -m venv .venv
47
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
48
+ pip install pypsa-cl # with Gurobi: pip install "pypsa-cl[gurobi]"
49
+ pypsa-cl # downloads the input data on first run, then opens the GUI
50
+ ```
51
+
52
+ ### From source
53
+
54
+ ```bash
55
+ git clone https://github.com/paredes-vergara/PyPSA-CL.git
56
+ cd PyPSA-CL
57
+ pip install -e . # or: pip install -e ".[gurobi]"
58
+ ```
59
+
60
+ ## Working folder
61
+
62
+ The model writes its results to an `outputs/` folder inside a *working folder*.
63
+ The working folder is:
64
+
65
+ 1. the folder given by the `PYPSA_CL_ROOT` environment variable, if set;
66
+ 2. otherwise, the current directory if it contains `data/`;
67
+ 3. otherwise, the repository root when running from a source checkout;
68
+ 4. otherwise, the current directory.
69
+
70
+ ```
71
+ my-pelp-run/
72
+ ├── data/ Optional: your own copy of the input workbooks (see below)
73
+ └── outputs/ Created automatically
74
+ ```
75
+
76
+ ## Input data
77
+
78
+ The model reads the following workbooks:
79
+
80
+ | File | Contents |
81
+ | -------------------------- | --------------------------------------------------- |
82
+ | `Topology.xlsx` | Buses, lines and generator/storage technical data |
83
+ | `Loads.xlsx` | Demand time series by node and scenario |
84
+ | `Profiles.xlsx` | Variable renewable and CSP availability profiles |
85
+ | `Costs.xlsx` | Fuel prices and generation/storage investment costs |
86
+ | `Hydraulic network.xlsx` | Water nodes, links and reservoirs |
87
+ | `Water time series.xlsx` | Inflow and irrigation series |
88
+ | `Policy levers.xlsx` | CO₂ tax, coal phase-out and expansion schedules |
89
+
90
+ These workbooks (about 245 MB) are too large for the PyPI package, so they are
91
+ published separately on Zenodo
92
+ ([doi:10.5281/zenodo.24204230](https://doi.org/10.5281/zenodo.24204230)) and **downloaded automatically the first time
93
+ the model runs**. Each download is checked against its SHA-256 checksum. To
94
+ fetch them without starting the model, run `pypsa-cl --download-data`;
95
+ `pypsa-cl --data-dir` shows where they are stored.
96
+
97
+ The data folder is:
98
+
99
+ 1. the folder given by the `PYPSA_CL_DATA_DIR` environment variable, if set;
100
+ 2. otherwise, the `data/` folder of the working folder, if it exists;
101
+ 3. otherwise, `~/.pypsa-cl/data-v<data version>` (shared by all working folders).
102
+
103
+ Workbooks already present in the data folder are used as they are and never
104
+ overwritten, so you can run the model with your own modified inputs by placing
105
+ all seven workbooks in `data/`. Only missing workbooks are downloaded. The
106
+ download source can be changed with the `PYPSA_CL_DATA_URL` environment variable
107
+ (a base URL under which the files are served by name).
108
+
109
+ The GUI header logo and network map ship with the package; files named
110
+ `logo_PELP.png` or `sen_network.png` placed in `data/` take precedence.
111
+
112
+ Disclaimer: Although the data for CSP and hydro ROR candidate generators is present in the Topology file, these candidates were not implemented in this version due to time constraints. These candidates should be implemented in the Final Report version.
113
+
114
+ ## Usage
115
+
116
+ ### Interactive (GUI)
117
+
118
+ ```bash
119
+ cd my-pelp-run # working folder: results go to my-pelp-run/outputs/
120
+ pypsa-cl # equivalent: python -m pypsa_cl
121
+ ```
122
+
123
+ The interface lets you queue one or more **global scenarios**, each composed of
124
+ one or more **investment epochs**. Preset scenario packages (`E1`-`N3`)
125
+ auto-fill and lock the six component selectors (demand, climate, hydrology, fuel
126
+ price, generation investment cost, storage investment cost); the *Otro* option
127
+ unlocks free configuration. Scenarios can be executed sequentially or in
128
+ parallel (one independent process per scenario, with a configurable RAM limit).
129
+
130
+ ### Headless (single scenario)
131
+
132
+ A single scenario can be run without the GUI by supplying its configuration as
133
+ JSON:
134
+
135
+ ```bash
136
+ pypsa-cl --scenario-json path/to/scenario.json
137
+ ```
138
+
139
+ Output location is controlled by the `PYPSA_CL_OUTPUTS_DIR` environment
140
+ variable; when unset, results are written under `outputs/` in the working folder.
141
+ Run `pypsa-cl --help` for a summary of the command-line options.
142
+
143
+ ## Versioning
144
+
145
+ Releases follow the stages of the PELP 2028-2032 process: `0.1.x` corresponds to
146
+ the Preliminary Report, `0.2.x` to the Final Report and `1.0.0` to the Definitive
147
+ Report. See [CHANGELOG.md](https://github.com/paredes-vergara/PyPSA-CL/blob/main/CHANGELOG.md).
148
+
149
+ ## Outputs
150
+
151
+ Each run writes the following CSV files to the output folder:
152
+
153
+ | File | Contents |
154
+ | ----------------------------- | ---------------------------------------------------- |
155
+ | `generation_results.csv` | Dispatch per asset and snapshot, with reserve, available and curtailment columns |
156
+ | `transmission_results.csv` | Flows per line and snapshot |
157
+ | `generation_expansion.csv` | Generation and storage expansion per epoch |
158
+ | `transmission_expansion.csv` | Transmission expansion per epoch |
159
+ | `installed_capacity.csv` | Installed capacity per epoch |
160
+ | `system_costs.csv` | System cost breakdown |
161
+ | `nodal_marginal_prices.csv` | Nodal marginal prices |
162
+ | `run_metadata_log.csv` | Parameters, solver settings and timings per epoch |
163
+ | `progress.json` | Live run status for monitoring |
164
+
165
+ In multi-scenario runs the outputs are concatenated into the same files, ordered
166
+ by scenario and identified by the `global_scenario` column.
167
+
168
+ ## Acknowledgements
169
+
170
+ Developed by the Unit of Planning and Climate Change (*Unidad de Planificación y
171
+ Cambio Climático*), Division of Strategic Planning and Sustainable Development,
172
+ Ministry of Energy of Chile.
173
+
174
+ ## License
175
+
176
+ Released under the MIT License. See [LICENSE](https://github.com/paredes-vergara/PyPSA-CL/blob/main/LICENSE).
@@ -0,0 +1,56 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pypsa-cl"
7
+ # 0.1.x = Informe Preliminar PELP 2028-2032 · 0.2.x = Informe Final · 1.0.0 = Informe Definitivo
8
+ version = "0.1.0"
9
+ description = "Long-term capacity expansion model of the Chilean National Electricity System (SEN), built on PyPSA"
10
+ readme = "README.md"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Ministry of Energy of Chile - Unit of Planning and Climate Change" }]
14
+ requires-python = ">=3.10"
15
+ keywords = ["pypsa", "energy", "power systems", "capacity expansion", "energy planning", "Chile", "PELP"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Science/Research",
19
+ "Natural Language :: English",
20
+ "Natural Language :: Spanish",
21
+ "Operating System :: Microsoft :: Windows",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3 :: Only",
24
+ "Topic :: Scientific/Engineering",
25
+ ]
26
+ dependencies = [
27
+ # Rango con que se validó el Informe Preliminar (PyPSA 1.3).
28
+ "pypsa>=1.3,<1.4",
29
+ "linopy>=0.9,<0.10",
30
+ "numpy>=1.24",
31
+ "pandas>=2.0",
32
+ "xarray>=2023.1",
33
+ "openpyxl>=3.1",
34
+ "psutil>=5.9",
35
+ "tkcalendar>=1.6",
36
+ "Pillow>=10.0",
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ gurobi = ["gurobipy>=11.0"] # requiere licencia comercial o académica
41
+ highs = ["highspy>=1.7"] # código abierto; ya viene instalado como dependencia de PyPSA
42
+
43
+ [project.scripts]
44
+ pypsa-cl = "pypsa_cl.cli:main"
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/paredes-vergara/PyPSA-CL"
48
+ Source = "https://github.com/paredes-vergara/PyPSA-CL"
49
+ Issues = "https://github.com/paredes-vergara/PyPSA-CL/issues"
50
+ Changelog = "https://github.com/paredes-vergara/PyPSA-CL/blob/main/CHANGELOG.md"
51
+
52
+ [tool.setuptools.packages.find]
53
+ where = ["src"]
54
+
55
+ [tool.setuptools.package-data]
56
+ pypsa_cl = ["assets/*.png"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+