Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add statistics documentation #873

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

p-glaum
Copy link
Contributor

@p-glaum p-glaum commented Apr 18, 2024

Changes proposed in this Pull Request

With this PR we want to extend the documentation of the statistics module.

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • Newly introduced dependencies are added to environment.yaml, environment_docs.yaml and setup.py (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@FabianHofmann
Copy link
Collaborator

Output from context aware chatgpt, might be helping as a starting point:

#######
Statistics Module
#######

Overview
=======================================

The ``pypsa.Network.statistics`` module provides an accessor to the ``pypsa.Network`` object, enabling users to efficiently calculate key network metrics. This module is designed to simplify the analysis of network data by abstracting complex calculations into more accessible methods. It is particularly useful for users who prefer to avoid manual calculations and directly obtain relevant statistical data about the network.

Available Metrics
=======================================

The module offers a variety of methods to calculate different metrics, which can be crucial for analyzing the performance and configuration of power systems modeled in PyPSA. Below is a list of currently available metrics with brief descriptions:

* ``Installed Capacity``:
  * Computes the total installed capacity of components in the network, measured in Megawatts (MW).

* ``Expanded Capacity``:
  * Calculates the capacity expansion of network components from a given base capacity, providing insights into network growth and scale-up, measured in MW.

* ``Optimal Capacity``:
  * Determines the total optimal capacity that components should ideally have based on model optimization, measured in MW.

* ``Capex (Capital Expenditure)``:
  * Evaluates the total capital investment required for the network components, which includes newly installed and existing assets, measured in the specified currency.

* ``Opex (Operational Expenditure)``:
  * Calculates ongoing operational costs of network components, taking into account various operational parameters and their costs, measured in the specified currency.

* ``Supply``:
  * Measures the total energy supply provided by the components of the network, which can vary depending on the carrier of the bus.

* ``Withdrawal``:
  * Assesses the total energy withdrawn from network components, reflecting consumption or storage activities.

* ``Dispatch``:
  * Quantifies the energy dispatched by various components across the network, crucial for understanding the flow and allocation of energy.

* ``Transmission``:
  * Calculates the energy transmitted between components, often critical for assessing the efficiency and reliability of the network.

* ``Curtailment``:
  * Measures the potential energy not utilized due to system constraints or operational decisions, reflecting the difference between possible and actual generation.

* ``Capacity Factor``:
  * Indicates the ratio of the actual output of a component over a period to its potential output if it had operated at full capacity continuously.

* ``Revenue``:
  * Estimates the revenue generated from the operation of network components, considering both inputs and outputs in the specified currency.

* ``Market Value``:
  * Calculates the market value of energy produced by network components, providing a financial metric that combines energy output with market prices.

Usage
=======================================

To utilize the statistics module, instantiate the accessor from a PyPSA network object as follows:

.. code-block:: python

    net = pypsa.Network()
    stats = net.statistics()

You can then call specific methods from the ``stats`` object to calculate various metrics, such as installed capacity or operational expenditure. For example:

.. code-block:: python

    installed_capacity = stats.installed_capacity()
    opex = stats.opex()

Each method supports various parameters that allow customization of the computations, such as selecting specific components, defining aggregation methods, and more.

Copy link

codecov bot commented Apr 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.81%. Comparing base (467db67) to head (e7c212c).
Report is 38 commits behind head on master.

❗ Current head e7c212c differs from pull request most recent head a1517d0. Consider uploading reports for the commit a1517d0 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #873      +/-   ##
==========================================
- Coverage   66.30%   65.81%   -0.49%     
==========================================
  Files          26       26              
  Lines        7090     7047      -43     
  Branches     1425     1424       -1     
==========================================
- Hits         4701     4638      -63     
- Misses       2105     2122      +17     
- Partials      284      287       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fneum fneum modified the milestone: Release v0.28 May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants