Skip to content

Commit feff995

Browse files
committed
Apply suggested changes from Alex
1 parent c4861f4 commit feff995

10 files changed

Lines changed: 73 additions & 67 deletions

docs/advanced-guide/extending-muse.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@
669669
"name": "python",
670670
"nbconvert_exporter": "python",
671671
"pygments_lexer": "ipython3",
672-
"version": "3.9.18"
672+
"version": "3.12.3"
673673
},
674674
"vscode": {
675675
"interpreter": {

docs/running-muse-example.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
" )\n",
201201
" ax.set_ylabel(\"Capacity (PJ)\")\n",
202202
" ax.set_xlabel(\"Year\")\n",
203-
" ax.set_title(\"{} Sector:\".format(sector_name.capitalize()), fontsize=10)\n",
203+
" ax.set_title(f\"{sector_name.capitalize()} Sector:\", fontsize=10)\n",
204204
" ax.legend(title=None, prop={\"size\": 8})\n",
205205
" ax.tick_params(axis=\"both\", labelsize=8)\n",
206206
"\n",

docs/user-guide/add-agent.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"cell_type": "markdown",
6262
"metadata": {},
6363
"source": [
64-
"We will now save this file and run the new simulation model using the following command-line prompt:\n",
64+
"We will now save this file and run the new simulation model using the following command:\n",
6565
"\n",
6666
" python -m muse settings.toml\n",
6767
"\n",
@@ -120,7 +120,7 @@
120120
" )\n",
121121
" g.add_legend()\n",
122122
" g.set_ylabels(\"Capacity (PJ)\")\n",
123-
" g.figure.suptitle(\"{} Sector:\".format(sector_name.capitalize()))\n",
123+
" g.figure.suptitle(f\"{sector_name.capitalize()} Sector:\")\n",
124124
" g.figure.subplots_adjust(top=0.8)"
125125
]
126126
},
@@ -155,7 +155,7 @@
155155
"\n",
156156
"We will then re-run the simulation. You may find that the simulation fails to complete due to insufficient capacity limits in the `residential` sector. In this case, try doubling `MaxCapacityGrowth` for `gasboiler` and `heatpump` in the `technodata/residential/Technodata.csv` file to 0.04 and running the simulation again.\n",
157157
"\n",
158-
"Once the model has run to completion, we can visualise the results like before:"
158+
"Once the model has run to completion, we can visualise the results as before:"
159159
]
160160
},
161161
{
@@ -180,17 +180,17 @@
180180
" )\n",
181181
" g.add_legend()\n",
182182
" g.set_ylabels(\"Capacity (PJ)\")\n",
183-
" g.figure.suptitle(\"{} Sector:\".format(sector_name.capitalize()))\n",
183+
" g.figure.suptitle(f\"{sector_name.capitalize()} Sector:\")\n",
184184
" g.figure.subplots_adjust(top=0.8)"
185185
]
186186
},
187187
{
188188
"cell_type": "markdown",
189189
"metadata": {},
190190
"source": [
191-
"In this scenario we can see two divergent strategies. Both agents invests heavily in `windturbine` early on, and relatively little in `gasCCGT`. The share of `solarPV` increases in later years as the price falls (as set in the previous tutorial), but this increase is more dramatic for agent `A2`.\n",
191+
"In this scenario we can see two divergent strategies. Both agents invest heavily in `windturbine` early on, and relatively little in `gasCCGT`. The share of `solarPV` increases in later years as the price falls (as set in the previous tutorial), but this increase is more dramatic for agent `A2`.\n",
192192
"\n",
193-
"From this small scenario, the difference between investment strategies between agents is evident. This is one of the key benefits of agent-based models when compared to optimisation based models.\n",
193+
"From this small scenario, the difference between investment strategies between agents is evident. This is one of the key benefits of agent-based models when compared to optimisation-based models.\n",
194194
"\n",
195195
"Have a play around with the files to see if you can come up with different scenarios!"
196196
]
@@ -231,7 +231,7 @@
231231
"name": "python",
232232
"nbconvert_exporter": "python",
233233
"pygments_lexer": "ipython3",
234-
"version": "3.9.18"
234+
"version": "3.12.3"
235235
}
236236
},
237237
"nbformat": 4,

docs/user-guide/add-gdp-correlation-demand.ipynb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@
3030
"source": [
3131
"For this work, we will use the `default` example from the MUSE repository, and will not build on the previous examples. This is done to simplify the model at this point.\n",
3232
"\n",
33-
"To get the default model and be able to edit the files use:\n",
33+
"You can copy the files for the default model in order to edit them like so:\n",
3434
"\n",
3535
"```bash\n",
3636
"python -m muse --model default --copy PATH/TO/COPY/THE/MODEL/TO\n",
3737
"```\n",
3838
"\n",
39-
"Similarly to before, we must amend the `technodata/preset` folder for this. However, we no longer require the `Residential2020Consumption.csv` and `Residential2050Consumption.csv` files. These files set the exogenous service demand for the residential sector.\n",
40-
"\n",
41-
"We must replace these files, with the following files:\n",
39+
"Similarly to before, we must amend the `technodata/preset` folder for this. As we are no longer explicitly specifying demand, we can delete the `Residential2020Consumption.csv` and `Residential2050Consumption.csv` files. Instead, we must replace these files with the following:\n",
4240
"\n",
4341
"- A macrodrivers file. This contains the drivers of the service demand that we want to model. For this example, these will include GDP based on purchasing power parity (GDP PPP) and the population that we expect from 2010 to 2110.\n",
4442
"\n",
@@ -76,7 +74,7 @@
7674
"\n",
7775
"In the second bottom section of the toml file, you will see the following section: \n",
7876
"\n",
79-
"```\n",
77+
"```toml\n",
8078
"[sectors.residential_presets]\n",
8179
"type = 'presets'\n",
8280
"priority = 0\n",
@@ -85,7 +83,7 @@
8583
"\n",
8684
"This enables us to run the model in exogenous mode, but now we would like to run the model from the files previously mentioned. This can be done by linking new variables to the new files, as follows:\n",
8785
"\n",
88-
"```\n",
86+
"```toml\n",
8987
"[sectors.residential_presets]\n",
9088
"type = 'presets'\n",
9189
"priority = 0\n",
@@ -149,7 +147,7 @@
149147
" )\n",
150148
" ax.set_ylabel(\"Capacity (PJ)\")\n",
151149
" ax.set_xlabel(\"Year\")\n",
152-
" ax.set_title(\"{} Sector:\".format(sector_name.capitalize()), fontsize=10)\n",
150+
" ax.set_title(f\"{sector_name.capitalize()} Sector:\", fontsize=10)\n",
153151
" ax.legend(title=None, prop={\"size\": 8})\n",
154152
" ax.tick_params(axis=\"both\", labelsize=8)\n",
155153
"\n",

docs/user-guide/add-region.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"source": [
1414
"The next step is to add a region which we will call `R2`, however, this could equally be called `USA` or `India`. This requires us to undertake a similar process as before of modifying the input simulation data.\n",
1515
"\n",
16-
"<!-- These regions do not have any energy trade. -->\n",
17-
"\n",
1816
"This tutorial will follow on from the model in tutorial 1 (including the price change in 2040, but before adding the second agent in tutorial 2). To begin, copy your files from tutorial 1 to a new location.\n",
1917
"\n",
2018
"To add a new region, we begin by modifying the ```settings.toml``` file. We just have to add our new region to the ```regions``` variable, in the 4th line of the file, like so:\n",
2119
"\n",
22-
" regions = [\"R1\", \"R2\"]\n",
20+
"```toml\n",
21+
"regions = [\"R1\", \"R2\"]\n",
22+
"```\n",
2323
"\n",
2424
"The process to change the input files, however, takes a bit more time. To achieve this, there must be data for each of the sectors for the new region. This, therefore, requires the modification of every [input file](../inputs/index.rst).\n",
2525
"\n",
@@ -32,8 +32,6 @@
3232
"source": [
3333
"Effectively, for this example, we will copy and paste the results for each of the input files from region `R1`, and change the name of the region for the new rows to `R2`. \n",
3434
"\n",
35-
"<!-- However, as we are increasing the demand by adding a region, as well as modifying the costs of technologies, it may be the case that a higher growth in technology is required. For example, there may be no possible solution to meet demand without increasing the ```windturbine``` maximum allowed limit. We will therefore increase the allowed limits for ```windturbine``` in region `R2`. -->\n",
36-
"\n",
3735
"We have placed two examples as to how to edit the residential sector below. Again, the edited data are highlighted in **bold**, with the original data in normal text. \n",
3836
"\n",
3937
"For the sake of brevity, we have omitted the entries for 2040 for the `CommIn.csv` file, however, just make sure to copy and paste the values for 2020 to 2040 here. The full file can be seen [here](https://github.com/SGIModel/MUSE_OS/blob/main/docs/tutorial-code/3-add-region/1-new-region/technodata/residential/CommIn.csv). \n",
@@ -58,7 +56,7 @@
5856
"|**gasboiler**|**R2**|**PJ/y**|**10**|**5**|**0**|**0**|**0**|**0**|**0**|\n",
5957
"|**heatpump**|**R2**|**PJ/y**|**0**|**0**|**0**|**0**|**0**|**0**|**0**|\n",
6058
"\n",
61-
"We will follow a similar process in the ```/technodata/power/Technodata.csv``` file, copying the lines from `R1` to create `R2`. In this tutorial we will test the scenario where `windturbine` in `R2` has increase capacity limits compared to `R1`, which is highlighted below in bold. The rest of the elements are the same for `R1` as they are for `R2`.\n",
59+
"We will follow a similar process in the ```/technodata/power/Technodata.csv``` file, copying the lines from `R1` to create `R2`. In this tutorial we will test the scenario where `windturbine` in `R2` has increased capacity limits compared to `R1`, which is highlighted below in bold. The rest of the elements are the same for `R1` as they are for `R2`.\n",
6260
"\n",
6361
"Again, we don't show the entries for 2040, apart from the edited windturbine row, for the sake of brevity.\n",
6462
"\n",
@@ -74,7 +72,9 @@
7472
"|solarPV|R2|2020|…|2|1|60|…|1|\n",
7573
"|...|...|...|...|...|...|...|...|...|\n",
7674
"\n",
77-
"Now, go ahead and amend all of the other input files for each of the sectors by copying and pasting the rows from `R1` and replacing the `RegionName` to `R2` for the new rows. All of the edited input files can be seen [here](https://github.com/SGIModel/MUSE_OS/tree/main/docs/tutorial-code/3-add-region/1-new-region)."
75+
"Now, go ahead and amend all of the other input files for each of the sectors by copying and pasting the rows from `R1` and replacing the `RegionName` to `R2` for the new rows. You must also modify the `BaseYearExport.csv`, `BaseYearImport.csv` and `Projections.csv` files in the `input` folder in a similar way. In this example we won't include any trade between regions, so all values in `BaseYearExport.csv` and `BaseYearImport.csv` should be left as zero.\n",
76+
"\n",
77+
"All of the edited input files can be seen [here](https://github.com/SGIModel/MUSE_OS/tree/main/docs/tutorial-code/3-add-region/1-new-region)."
7878
]
7979
},
8080
{
@@ -117,7 +117,7 @@
117117
" )\n",
118118
" g.add_legend()\n",
119119
" g.set_ylabels(\"Capacity (PJ)\")\n",
120-
" g.figure.suptitle(\"{} Sector:\".format(sector_name.capitalize()))\n",
120+
" g.figure.suptitle(f\"{sector_name.capitalize()} Sector:\")\n",
121121
" g.figure.subplots_adjust(top=0.8)"
122122
]
123123
},

docs/user-guide/add-solar.ipynb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,10 @@
265265
"metadata": {},
266266
"source": [
267267
"Finally, we must make a small change to the `settings.toml` file. As `solar` is a renewable resource that isn't produced by any process defined in the model, we must add it to `excluded_commodities` in `settings.toml`, like so:\n",
268-
" \n",
269-
" excluded_commodities = [\"wind\", \"solar\"]\n",
268+
"\n",
269+
"```toml \n",
270+
"excluded_commodities = [\"wind\", \"solar\"]\n",
271+
"```\n",
270272
"\n",
271273
"This will ensure MUSE excludes `solar` from its internal supply-fulfillment checks."
272274
]
@@ -335,7 +337,7 @@
335337
"cell_type": "markdown",
336338
"metadata": {},
337339
"source": [
338-
"We will then visualise the results:"
340+
"We will now visualise the results:"
339341
]
340342
},
341343
{
@@ -352,7 +354,7 @@
352354
" )\n",
353355
" ax.set_ylabel(\"Capacity (PJ)\")\n",
354356
" ax.set_xlabel(\"Year\")\n",
355-
" ax.set_title(\"{} Sector:\".format(sector_name.capitalize()), fontsize=10)\n",
357+
" ax.set_title(f\"{sector_name.capitalize()} Sector:\", fontsize=10)\n",
356358
" ax.legend(title=None, prop={\"size\": 8})\n",
357359
" ax.tick_params(axis=\"both\", labelsize=8)\n",
358360
"\n",
@@ -364,9 +366,9 @@
364366
"cell_type": "markdown",
365367
"metadata": {},
366368
"source": [
367-
"We can now see that there is solarPV in the power sector in addition to windturbine and gasCCGT, when compared to the example [here](../running-muse-example.ipynb)! That's great and means it worked! \n",
369+
"We can now see that there is `solarPV` in the power sector in addition to `windturbine` and `gasCCGT`, when compared to the example [here](../running-muse-example.ipynb)! That's great and means it worked! \n",
368370
"\n",
369-
"The difference in uptake of `solarPV` compared to `windturbine` is due to the fact that ```solarPV``` has a lower ```cap_par``` cost of 30, compared to the ```windturbine```. Meaning that ```solarPV``` outcompetes both ```windturbine``` and ```gasCCGT``` in the electricity market."
371+
"The difference in uptake of `solarPV` compared to `windturbine` is due to the fact that `solarPV` has a lower `cap_par` cost of 30, compared to the `windturbine`. Meaning that `solarPV` outcompetes both `windturbine` and `gasCCGT` in the electricity market."
370372
]
371373
},
372374
{
@@ -451,7 +453,7 @@
451453
" )\n",
452454
" ax.set_ylabel(\"Capacity (PJ)\")\n",
453455
" ax.set_xlabel(\"Year\")\n",
454-
" ax.set_title(\"{} Sector:\".format(sector_name.capitalize()), fontsize=10)\n",
456+
" ax.set_title(f\"{sector_name.capitalize()} Sector:\", fontsize=10)\n",
455457
" ax.legend(title=None, prop={\"size\": 8})\n",
456458
" ax.tick_params(axis=\"both\", labelsize=8)\n",
457459
"\n",

docs/user-guide/addition-service-demand.ipynb renamed to docs/user-guide/additional-service-demand.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"cell_type": "markdown",
2929
"metadata": {},
3030
"source": [
31-
"The model in this tutorial will build directly on the model from the previous tutorial (with the additional timeslices, but before modifying the time horizon)\n",
31+
"The model in this tutorial will build directly on the model from the previous tutorial (with the additional timeslices, but before modifying the time horizon).\n",
3232
"\n",
3333
"Firstly, we must add the demand section. In this example, we will add a cooking preset demand. To achieve this, we will now edit the `Residential2020Consumption.csv` and `Residential2050Consumption.csv` files, found within the `technodata/preset/` directory.\n",
3434
"\n",
@@ -67,7 +67,7 @@
6767
"source": [
6868
"As can be seen, we only need to add a `cook` column in the file, as well as the demand level for each timeslice and each region. This can be seen through the addition of a positive number in the `cook` column.\n",
6969
"\n",
70-
"The process is very similar for the `Residential2050Consumption.csv` file, again copying the values over from the `heat` column. For the complete file see the link [here](https://github.com/SGIModel/MUSE_OS/blob/main/docs/tutorial-code/5-add-service-demand/1-exogenous-demand/technodata/preset/Residential2050Consumption.csv)."
70+
"The process is very similar for the `Residential2050Consumption.csv` file: again we copy the values over from the `heat` column. For the complete file see the link [here](https://github.com/SGIModel/MUSE_OS/blob/main/docs/tutorial-code/5-add-service-demand/1-exogenous-demand/technodata/preset/Residential2050Consumption.csv)."
7171
]
7272
},
7373
{
@@ -146,7 +146,7 @@
146146
"\n",
147147
"For this example, we will add two competing technologies to service the cooking demand: `electric_stove` and `gas_stove` to the `Technodata.csv` file in `/technodata/residential/Technodata.csv`.\n",
148148
"\n",
149-
"Again for the interests of space, we have omitted the existing `gasboiler` and `heatpump` technologies. But we copy the `heatpump` row for `R1` and paste it for the new `electric_stove` for both `R1` and `R2`. For `gas_stove` we copy and paste the data for `gasboiler` from region `R1` for both `R1` and `R2`. \n",
149+
"Again, in the interests of space, we have omitted the existing `gasboiler` and `heatpump` technologies. But we copy the `heatpump` row for `R1` and paste it for the new `electric_stove` for both `R1` and `R2`. For `gas_stove` we copy and paste the data for `gasboiler` from region `R1` for both `R1` and `R2`. \n",
150150
"\n",
151151
"An important modification, however, is specifying the end-use for these new technologies to be `cook` and not `heat`.\n",
152152
"\n",
@@ -246,7 +246,7 @@
246246
" )\n",
247247
" g.add_legend()\n",
248248
" g.set_ylabels(\"Capacity (PJ)\")\n",
249-
" g.figure.suptitle(\"{} Sector:\".format(sector_name.capitalize()))\n",
249+
" g.figure.suptitle(f\"{sector_name.capitalize()} Sector:\")\n",
250250
" g.figure.subplots_adjust(top=0.8)"
251251
]
252252
},

docs/user-guide/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ We recommend following the tutorials step by step, as the files build on the pre
1616
add-agent
1717
add-region
1818
modify-timing-data
19-
addition-service-demand
19+
additional-service-demand
2020
add-gdp-correlation-demand
2121
min-max-timeslice-constraints
2222

docs/user-guide/min-max-timeslice-constraints.ipynb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"\n",
2525
"In this tutorial we will be amending the `default_timeslice` example.\n",
2626
"\n",
27-
"To get this model and be able to edit the files use:\n",
27+
"Copy this model so you can edit the files:\n",
2828
"\n",
2929
"```bash\n",
3030
"python -m muse --model default_timeslice --copy PATH/TO/COPY/THE/MODEL/TO\n",
@@ -60,14 +60,16 @@
6060
"source": [
6161
"Looking at `settings.toml` file, you should see that the file has already been linked to the appropriate sector:\n",
6262
"\n",
63-
" [sectors.power]\n",
64-
" type = 'default'\n",
65-
" priority = 2\n",
66-
" dispatch_production = 'costed'\n",
67-
" technodata = '{path}/technodata/power/Technodata.csv'\n",
68-
" commodities_in = '{path}/technodata/power/CommIn.csv'\n",
69-
" commodities_out = '{path}/technodata/power/CommOut.csv'\n",
70-
" technodata_timeslices = '{path}/technodata/power/TechnodataTimeslices.csv'\n",
63+
"```toml\n",
64+
"[sectors.power]\n",
65+
"type = 'default'\n",
66+
"priority = 2\n",
67+
"dispatch_production = 'costed'\n",
68+
"technodata = '{path}/technodata/power/Technodata.csv'\n",
69+
"commodities_in = '{path}/technodata/power/CommIn.csv'\n",
70+
"commodities_out = '{path}/technodata/power/CommOut.csv'\n",
71+
"technodata_timeslices = '{path}/technodata/power/TechnodataTimeslices.csv'\n",
72+
"```\n",
7173
" \n",
7274
"Notice the `technodata_timeslices` path in the bottom row of the code above."
7375
]

0 commit comments

Comments
 (0)