Skip to content

Commit 8c73dda

Browse files
authored
Small documentation improvements and fix warnings (#812)
* Fix documentation warnings * More fixes * More fixes * More API docs * More fixes * More fixes * Fix one more link * Fix issues with Input Files page * More detail about how to reference each data file
1 parent d657f9c commit 8c73dda

29 files changed

+251
-290
lines changed

docs/api.rst

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ Agents and associated functionalities
7575
-------------------------------------
7676

7777
.. automodule:: muse.agents.factories
78-
:members: agents_factory, create_agent, create_retrofit_agent, create_newcapa_agent,
79-
factory
78+
:members: agents_factory, create_agent, create_retrofit_agent, create_newcapa_agent
8079

8180

8281
.. autoclass:: muse.agents.agent.AbstractAgent
@@ -129,9 +128,11 @@ Constraints:
129128
~~~~~~~~~~~~
130129

131130
.. automodule:: muse.constraints
132-
:members: demand, factory, max_capacity_expansion, max_production, lp_costs,
133-
lp_constraint, lp_constraint_matrix, register_constraints, search_space,
134-
ScipyAdapter
131+
:members: demand, factory, max_capacity_expansion, max_production,
132+
register_constraints, search_space, minimum_service, demand_limiting_capacity
133+
134+
.. automodule:: muse.lp_adapter
135+
:members: lp_costs, lp_constraint, lp_constraint_matrix, ScipyAdapter
135136

136137
Initial and Final Asset Transforms
137138
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -150,9 +151,6 @@ Reading the inputs
150151
.. automodule:: muse.readers.csv
151152
:members:
152153

153-
.. automodule:: muse.decorators
154-
:members:
155-
156154
---------------
157155
Writing Outputs
158156
---------------
@@ -170,6 +168,18 @@ Sectorial Outputs
170168
.. automodule:: muse.outputs.sector
171169
:members:
172170

171+
Global Outputs
172+
~~~~~~~~~~~~~~
173+
174+
.. automodule:: muse.outputs.mca
175+
:members:
176+
177+
Cache
178+
~~~~~
179+
180+
.. automodule:: muse.outputs.cache
181+
:members:
182+
173183

174184
----------
175185
Quantities
@@ -215,6 +225,12 @@ Functionality Registration
215225
.. automodule:: muse.registration
216226
:members:
217227

228+
Costs
229+
~~~~~
230+
231+
.. automodule:: muse.costs
232+
:members:
233+
218234
Utilities
219235
~~~~~~~~~
220236

docs/application-flow.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Application Flow
22
================
33

4-
While not essential to be able to use MUSE, it is useful to know the sequence of events that a run of MUSE will follow in a bit more detail that the brief overview of the :ref:`MUSE Overview` section. Let's start with the big picture.
4+
While not essential to be able to use MUSE, it is useful to know the sequence of events that a run of MUSE will follow in a bit more detail than the brief overview of the :doc:`MUSE Overview <overview>` section. Let's start with the big picture.
55

66
.. note::
77

@@ -245,7 +245,7 @@ The sequence of steps related to the carbon budget control are as follows:
245245
single_year [label="Single year\niteration", fillcolor="lightgrey", style="rounded,filled"]
246246
emissions [label="Calculate emissions\nof carbon comodities"]
247247
comparison [label="Emissions\n> budget\n", shape=diamond, style=""]
248-
new_price [label="Calculate new\ncarbon price", fillcolor="lightgrey", style="rounded,filled"]
248+
new_price_node [label="Calculate new\ncarbon price", fillcolor="lightgrey", style="rounded,filled"]
249249

250250

251251
subgraph cluster_1 {
@@ -255,8 +255,8 @@ The sequence of steps related to the carbon budget control are as follows:
255255

256256
start -> single_year
257257
comparison -> end [label="No", constraint=false]
258-
comparison -> new_price [label="Yes"]
259-
new_price -> end
258+
comparison -> new_price_node [label="Yes"]
259+
new_price_node -> end
260260
}
261261

262262
The **method used to calculate the new carbon price** can be selected by the user. There are currently only two options for this method, ``fitting`` and ``bisection``, however this can be expanded by the user with the ``@register_carbon_budget_method`` hook in ``muse.carbon_budget``.
@@ -440,15 +440,15 @@ The following graph summarises the process.
440440
input_search[label="SearchRule\n(Agents.csv)", fillcolor="#ffb3b3", style="rounded,filled"]
441441
input_objectives[label="Objective\n(Agents.csv)s", fillcolor="#ffb3b3", style="rounded,filled"]
442442
input_decision[label="DecisionMethod\n(Agents.csv)", fillcolor="#ffb3b3", style="rounded,filled"]
443-
input_constrains[label="Constrains\n(settings.toml)", fillcolor="#ffb3b3", style="rounded,filled"]
443+
input_constraints[label="Constraints\n(settings.toml)", fillcolor="#ffb3b3", style="rounded,filled"]
444444
input_solver[label="lpsolver\n(settings.toml)", fillcolor="#ffb3b3", style="rounded,filled"]
445445

446-
start -> demand_share -> search -> objectives -> decision -> constrains -> invest -> end
446+
start -> demand_share -> search -> objectives -> decision -> constraints -> invest -> end
447447
input_demand -> demand_share
448448
input_search -> search
449449
input_objectives -> objectives
450450
input_decision -> decision
451-
input_constrains -> constrains
451+
input_constraints -> constraints
452452
input_solver -> invest
453453
}
454454

@@ -463,7 +463,7 @@ For those selected replacement technologies, an objective function is computed.
463463

464464
Then, a decision is computed. Decision methods reduce multiple objectives into a single scalar objective per replacement technology. The decision method to use is selected in the ``Agents.csv`` file. They allow combining several objectives into a single metric through which replacement technologies can be ranked. See :py:mod:`muse.decisions`.
465465

466-
The final step of preparing the investment process is to compute the constrains, e.g. factors that will determine how much a technology could be invested in and include things like matching the demand, the search rules calculated above, the maximum production of a technology for a given capacity or the maximum capacity expansion for a given time period. Available constrains are set in the subsector section of the ``settings.toml`` file and described in :py:mod:`muse.constrains`. By default, all of them are applied. Note that these constrains might result in unfeasible situations if they do not allow the production to grow enough to match the demand. This is one of the common reasons for a MUSE simulation not converging.
466+
The final step of preparing the investment process is to compute the constraints, e.g. factors that will determine how much a technology could be invested in and include things like matching the demand, the search rules calculated above, the maximum production of a technology for a given capacity or the maximum capacity expansion for a given time period. Available constraints are set in the subsector section of the ``settings.toml`` file and described in :py:mod:`muse.constraints`. By default, all of them are applied. Note that these constraints might result in unfeasible situations if they do not allow the production to grow enough to match the demand. This is one of the common reasons for a MUSE simulation not converging.
467467

468468
With all this information, the investment process can proceed. This is done per sector using the method described by the ``lpsolver`` in the ``settings.toml`` file. Available solvers are described in :py:mod:`muse.investments`
469469

docs/conf.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@
5050
add_module_names = False
5151
nbsphinx_allow_errors = True
5252
autosectionlabel_prefix_document = True
53+
nitpicky = True
54+
55+
# Suppress warnings for documents not included in any toctree (e.g. release notes)
56+
suppress_warnings = ["toc.not_included"]
5357

5458
intersphinx_mapping = {
5559
"python": ("https://docs.python.org/3", None),
5660
"numpy": ("http://docs.scipy.org/doc/numpy/", None),
57-
"pandas": ("http://pandas.pydata.org/pandas-docs/dev", None),
58-
"xarray": ("http://xarray.pydata.org/en/stable/", None),
61+
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
62+
"xarray": ("https://xarray.pydata.org/en/stable/", None),
5963
}
6064

65+
6166
bibtex_bibfiles: list[str] = []
6267

6368
# -- GraphViz configuration ----------------------------------

docs/inputs/agents.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ Agents
77
Agents are defined using a CSV file, with
88
one agent per row, using a format meant specifically for retrofit and new-capacity agent pairs.
99

10-
For instance, we have the following CSV table:
10+
Each sector should have an agents file, which should follow the structure
11+
reported in the table below, and be referenced from the TOML settings file using the
12+
``agents`` key.
13+
14+
This is an example of what an agents file could look like:
1115

1216
.. csv-table::
1317
:header: name, type, agent_share, region, objective1, search_rule, decision_method, ...

docs/inputs/commodities.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Global Commodities
66

77
MUSE handles a configurable number and type of commodities which are primarily used to
88
represent energy, services, pollutants/emissions. The commodities for the simulation as
9-
a whole are defined in a csv file with the following structure.
9+
a whole are defined in a csv file with the following structure, which is referenced from
10+
the TOML settings file using the ``global_commodities`` key.
1011

1112
.. csv-table:: Global commodities
1213
:header: commodity, description, commodity_type, unit

docs/inputs/commodities_io.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _inputs-iocomms:
22

3-
=================
3+
=========================
44
Commodity Inputs/Outputs
5-
=================
5+
=========================
66

77
**Input**
88

@@ -37,8 +37,10 @@ to cover space heating and water heating energy service demands.
3737
:alt: Electric boilers input output commodities
3838

3939

40-
Below it is shown the generic structure of the input commodity file for the electric
41-
heater.
40+
Each sector in MUSE should have two separate CSV files for commodity inputs and outputs,
41+
each of which should follow the structure reported in the table below. These should be
42+
referenced from the TOML settings file using the ``commodities_in`` and ``commodities_out`` keys
43+
respectively.
4244

4345
.. csv-table:: Commodities used as consumables - Input commodities
4446
:header: technology, region, year, level, electricity

docs/inputs/correlation_files.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _correlation-files:
2+
13
Correlation Demand Files
24
========================
35

@@ -11,7 +13,9 @@ To do this, a minimum of three files are required:
1113

1214
#. A file which dictates how the demand per benchmark year is split across the timeslices.
1315

14-
We will go into the details of each of these files below.
16+
These files (explained in more detail below) should be referenced from the TOML settings
17+
file using the ``macrodrivers_path``, ``regression_path``, and ``timeslice_shares_path``
18+
keys respectively.
1519

1620
Macrodrivers
1721
------------

docs/inputs/existing_capacity.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
Existing Capacity
55
==========================
66

7-
For each technology, the decommissioning profile should be given to MUSE.
8-
9-
The csv file which provides the installed capacity in base year and the decommissioning
10-
profile in the future periods for each technology in a sector, in each region, should
11-
follow the structure reported in the table.
7+
This file provides the installed capacity in base year and the decommissioning
8+
profile in the future periods for each technology in a sector, in each region.
129

10+
Each sector should have an existing capacity file, which should follow the structure
11+
reported in the table below, and be referenced from the TOML settings file using the
12+
``existing_capacity`` key.
1313

1414
.. csv-table:: Existing capacity of technologies: the residential boiler example
1515
:header: technology, region, 2010, 2020, 2030, 2040, 2050
1616

1717
resBoilerElectric, region1, 5, 0.5, 0, 0, 0
1818
resBoilerElectric, region2, 39, 3.5, 1, 0.3, 0
1919

20-
2120
``technology``
2221
represents the technology ID and needs to be consistent across all the data inputs.
2322

docs/inputs/index.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,30 @@
44
Input Files
55
===========
66

7-
In this section we detail each of the files required to run MUSE. We include information based on how these files should be used, as well as the data that populates them.
7+
In this section we detail each of the files required to run MUSE.
8+
We include information based on how these files should be used, as well as the data that populates them.
9+
10+
All MUSE simulations require a settings file in TOML format (see :ref:`toml-primer` and :ref:`simulation-settings`), as well as a set of CSV files that provide the simulation data.
11+
12+
Whilst file names and paths are fully flexible and can be configured via the settings TOML,
13+
a typical minimal file layout might look something like this:
14+
15+
model_name/
16+
- :ref:`settings.toml <simulation-settings>`
17+
- :ref:`GlobalCommodities.csv <inputs-commodities>`
18+
- :ref:`Projections.csv <inputs-projection>`
19+
- sector1/
20+
- :ref:`Technodata.csv <inputs-technodata>`
21+
- :ref:`CommoditiesIn.csv <inputs-iocomms>`
22+
- :ref:`CommoditiesOut.csv <inputs-iocomms>`
23+
- :ref:`ExistingCapacity.csv <inputs-existing-capacity>`
24+
- :ref:`Agents.csv <inputs-agents>`
25+
- presets/
26+
- :ref:`Consumption2020.csv <preset-consumption-file>`
27+
- etc.
28+
29+
Note, however, that this is just a convention for simple models, and more complex models may benefit from or require a different file structure.
30+
See full documentation below for more details on the settings TOML and all the different types of data file.
831

932
.. toctree::
1033
:maxdepth: 2

docs/inputs/inputs_csv.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Simulation Data Files
33
=====================
44

5+
.. _inputs_csv:
6+
57
This section details the CSV files that are used to populate the simulation data.
68

79
.. toctree::
@@ -15,4 +17,5 @@ This section details the CSV files that are used to populate the simulation data
1517
commodities_io
1618
existing_capacity
1719
agents
20+
preset_commodity_demands
1821
correlation_files

0 commit comments

Comments
 (0)