-
Notifications
You must be signed in to change notification settings - Fork 0
add variable statistic for 'Final Energy [by Sector]|Industry' #16
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
base: main
Are you sure you want to change the base?
Changes from all commits
99bcbf3
8a268d5
40391c3
396edb3
de4d520
bdbf55b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,35 +21,26 @@ def <function_name>(network_collection: pypsa.Network) -> pd.Series: | |
|
|
||
| def Final_Energy_by_Carrier__Electricity( | ||
| n: pypsa.Network, | ||
| ) -> pd.DataFrame: | ||
| """Extract electricity final energy from a PyPSA NetworkCollection. | ||
| ) -> pd.Series: | ||
| """Extract electricity final energy from a PyPSA Network. | ||
|
|
||
| Returns the total electricity consumption (excluding transmission / | ||
| distribution losses) across all networks in *network_collection*. | ||
| distribution losses) | ||
|
|
||
| Parameters | ||
| ---------- | ||
| network_collection : pypsa.NetworkCollection | ||
| Collection of PyPSA networks to process. | ||
| n : pypsa.Network | ||
| PyPSA network to process. | ||
|
|
||
| Returns | ||
| ------- | ||
| pd.DataFrame | ||
| Long-format DataFrame with columns ``variable``, ``unit``, ``year``, | ||
| and ``value``. The ``variable`` column contains | ||
| ``"Final Energy [by Carrier]|Electricity"`` for every row. | ||
| pd.Series | ||
| Pandas Series with Multiindex of ``country`` and ``unit`` | ||
|
|
||
| Notes | ||
| ----- | ||
| The actual extraction of electricity final energy from the network | ||
| collection will be implemented by the user. A typical call would be:: | ||
|
|
||
| network_collection.statistics.energy_balance( | ||
| comps=["Load"], bus_carrier="AC" | ||
| ) | ||
|
|
||
| The current implementation returns a dummy value of ``0.0 MWh`` for the | ||
| year 2020 so that the end-to-end workflow can be tested. | ||
| Extracts all withdrawals from elec network. low_voltage is included in AC withdrawal. | ||
| Remove discharger afterwards, as battery-connecting links have different carrier names. | ||
| """ | ||
| # withdrawal from electricity including low_voltage | ||
| res = n.statistics.energy_balance( | ||
|
|
@@ -66,24 +57,21 @@ def Final_Energy_by_Carrier__Electricity( | |
|
|
||
| def Final_Energy_by_Sector__Transportation( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about EV charger losses here (notspeaking of V2G, but EV batteries)? until now I always considered FED as "whats metered at customer". Charger losses would become metered I guess. |
||
| n: pypsa.Network, | ||
| ) -> pd.DataFrame: | ||
| """Extract transportation-sector final energy from a PyPSA NetworkCollection. | ||
| ) -> pd.Series: | ||
| """Extract transportation-sector final energy from a PyPSA Network. | ||
|
|
||
| Returns the total energy consumed by the transportation sector (excluding | ||
| transmission / distribution losses) across all networks in | ||
| *network_collection*. | ||
| transmission / distribution losses) | ||
|
|
||
| Parameters | ||
| ---------- | ||
| network_collection : pypsa.NetworkCollection | ||
| Collection of PyPSA networks to process. | ||
| n : pypsa.Network | ||
| PyPSA network to process. | ||
|
|
||
| Returns | ||
| ------- | ||
| pd.DataFrame | ||
| Long-format DataFrame with columns ``variable``, ``unit``, ``year``, | ||
| and ``value``. The ``variable`` column contains | ||
| ``"Final Energy [by Sector]|Transportation"`` for every row. | ||
| pd.Series | ||
| Pandas Series with Multiindex of ``country`` and ``unit`` | ||
|
|
||
| Notes | ||
| ----- | ||
|
|
@@ -103,7 +91,54 @@ def Final_Energy_by_Sector__Transportation( | |
| ], | ||
| components="Load", | ||
| groupby=["carrier", "unit", "country"], | ||
| direction="withdrawal", | ||
| direction="withdrawal", # for positive values | ||
| ) | ||
| .groupby(["country", "unit"]) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we want to go NUTS - pun intended - we'd need "location" in the groupby. Lets discuss this. I think Daniel has a module prepared that aggregates NUTS levels |
||
| .sum() | ||
| ) | ||
| return res | ||
|
|
||
|
|
||
| def Final_Energy_by_Sector__Industry( | ||
| n: pypsa.Network, | ||
| ) -> pd.DataFrame: | ||
| """Extract Industry-sector final energy from a PyPSA Network. | ||
|
|
||
| Returns the total energy consumed by the Industry sector (excluding | ||
| transmission / distribution losses) | ||
|
|
||
| Parameters | ||
| ---------- | ||
| n : pypsa.Network | ||
| PyPSA network to process. | ||
|
|
||
| Returns | ||
| ------- | ||
| pd.Series | ||
| Pandas Series with Multiindex of ``country`` and ``unit`` | ||
|
|
||
| Notes | ||
| ----- | ||
| Includes all carriers directly connected to loads in the industry sector. Same Carrier | ||
| names are also attached to some links, so components-grouping is needed! | ||
| Values are exogenously set, so output values are round numbers! | ||
| """ | ||
| carriers = [ | ||
| "coal for industry", | ||
| "industry electricity", | ||
| "gas for industry", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember "gas for industry" being a special case: the --> the captured CO2 is sequestered and not part of the Following the mentioned logic that defines FED as "whats metered" and assuming that consumers need to pay additional gas for CCS, we'd need sum the Bottom line is this: |
||
| "H2 for industry", | ||
| "solid biomass for industry", | ||
| "industry methanol", | ||
| "naphtha for industry", | ||
| "low-temperature heat for industry", | ||
| ] | ||
| res = ( | ||
| n.statistics.energy_balance( | ||
| carrier=carriers, | ||
| groupby=["carrier", "unit", "country"], | ||
| components="Load", | ||
| direction="withdrawal", # for positive values | ||
| ) | ||
| .groupby(["country", "unit"]) | ||
| .sum() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Title case breaks with Pythons convetion to use snake_case for function names. Is there a reason? just wondering