Merge branch 'master' into prepare-release-v0.12.0

This commit is contained in:
Fabian Neumann 2024-08-30 18:07:38 +02:00
commit e8353ec031
5 changed files with 140 additions and 9 deletions

92
.github/workflows/codeql.yml vendored Normal file
View File

@ -0,0 +1,92 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
schedule:
- cron: '23 18 * * 5'
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

View File

@ -798,6 +798,7 @@ industry:
MWh_MeOH_per_tMeOH: 5.528
hotmaps_locate_missing: false
reference_year: 2019
oil_refining_emissions: 0.013
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#costs
@ -1078,6 +1079,8 @@ plotting:
gas pipeline new: '#a87c62'
# oil
oil: '#c9c9c9'
oil primary: '#d2d2d2'
oil refining: '#e6e6e6'
imported oil: '#a3a3a3'
oil boiler: '#adadad'
residential rural oil boiler: '#a9a9a9'

View File

@ -35,3 +35,4 @@ MWh_CH4_per_tMeOH,MWhCH4/tMeOH,float,"The energy amount of methane needed to pro
MWh_MeOH_per_tMeOH,LHV,float,"The energy amount per ton of methanol. From `DECHEMA (2017) <https://dechema.de/dechema_media/Downloads/Positionspapiere/Technology_study_Low_carbon_energy_and_feedstock_for_the_European_chemical_industry-p-20002750.pdf>`_, page 74."
hotmaps_locate_missing,--,"{true,false}",Locate industrial sites without valid locations based on city and countries.
reference_year,year,YYYY,The year used as the baseline for industrial energy demand and production. Data extracted from `JRC-IDEES 2015 <https://data.jrc.ec.europa.eu/dataset/jrc-10110-10001>`_
oil_refining_emissions,tCO2/MWh,float,"The emissions from oil fuel processing (e.g. oil in petrochemical refinieries). The default value of 0.013 tCO2/MWh is based on DE statistics for 2019; the EU value is very similar."

1 Unit Values Description
35 MWh_MeOH_per_tMeOH LHV float The energy amount per ton of methanol. From `DECHEMA (2017) <https://dechema.de/dechema_media/Downloads/Positionspapiere/Technology_study_Low_carbon_energy_and_feedstock_for_the_European_chemical_industry-p-20002750.pdf>`_, page 74.
36 hotmaps_locate_missing -- {true,false} Locate industrial sites without valid locations based on city and countries.
37 reference_year year YYYY The year used as the baseline for industrial energy demand and production. Data extracted from `JRC-IDEES 2015 <https://data.jrc.ec.europa.eu/dataset/jrc-10110-10001>`_
38 oil_refining_emissions tCO2/MWh float The emissions from oil fuel processing (e.g. oil in petrochemical refinieries). The default value of 0.013 tCO2/MWh is based on DE statistics for 2019; the EU value is very similar.

View File

@ -11,7 +11,6 @@ Release Notes
.. Upcoming Release
.. ================
PyPSA-Eur 0.11.0 (25th May 2024)
================================
@ -141,6 +140,9 @@ PyPSA-Eur 0.11.0 (25th May 2024)
heat that can be used in district heating. The default was changed from 100%
to 25%. (https://github.com/PyPSA/pypsa-eur/pull/1141)
* Added option to specify emissions fuel processing (e.g. oil in petrochemical
refinieries) with setting ``industry: oil_refining_emissions:``.
* Added Enhanced Geothermal Systems for generation of electricity and district heat.
Cost and available capacity assumptions based on `Aghahosseini et al. (2020)
<https://www.sciencedirect.com/science/article/pii/S0306261920312551>`__.

View File

@ -573,14 +573,47 @@ def add_carrier_buses(n, carrier, nodes=None):
fossils = ["coal", "gas", "oil", "lignite"]
if options.get("fossil_fuels", True) and carrier in fossils:
n.madd(
"Generator",
nodes,
bus=nodes,
p_nom_extendable=True,
carrier=carrier,
marginal_cost=costs.at[carrier, "fuel"],
)
suffix = ""
if carrier == "oil" and cf_industry["oil_refining_emissions"] > 0:
n.madd(
"Bus",
nodes + " primary",
location=location,
carrier=carrier + " primary",
unit=unit,
)
n.madd(
"Link",
nodes + " refining",
bus0=nodes + " primary",
bus1=nodes,
bus2="co2 atmosphere",
location=location,
carrier=carrier + " refining",
p_nom=1e6,
efficiency=1
- (
cf_industry["oil_refining_emissions"]
/ costs.at[carrier, "CO2 intensity"]
),
efficiency2=cf_industry["oil_refining_emissions"],
)
suffix = " primary"
else:
n.madd(
"Generator",
nodes + suffix,
bus=nodes + suffix,
p_nom_extendable=True,
carrier=carrier + suffix,
marginal_cost=costs.at[carrier, "fuel"],
)
# TODO: PyPSA-Eur merge issue