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

Update for new Demand Model #45

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/ci-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- cron: "0 5 * * TUE"

env:
CACHE_NUMBER: 1 # Change this value to manually reset the environment cache
CACHE_NUMBER: 3 # Change this value to manually reset the environment cache

jobs:
build:
Expand Down Expand Up @@ -60,7 +60,10 @@ jobs:

- name: Update environment due to outdated or unavailable cache
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n pypsa-earth -f pypsa-earth/envs/environment.yaml
run: |
mamba env update -n pypsa-earth -f pypsa-earth/envs/environment.yaml
conda activate pypsa-earth
pip install rampdemand

- name: Conda list
run: |
Expand All @@ -73,9 +76,9 @@ jobs:
cp -rf pypsa-earth/config.tutorial.yaml config.pypsa-earth.yaml
snakemake --cores all solve_network

# - name: Test plotting and summaries
# run: |
# snakemake --cores all plot_all_p_nom
# snakemake --cores all plot_all_summaries
# snakemake --cores all make_all_summaries
# rm -rf resources/*.nc resources/*.geojson resources/*.h5 networks results
# - name: Test plotting and summaries
# run: |
# snakemake --cores all plot_all_p_nom
# snakemake --cores all plot_all_summaries
# snakemake --cores all make_all_summaries
# rm -rf resources/*.nc resources/*.geojson resources/*.h5 networks results
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ test/tmp/
# track resources/powerplants.csv
!resources/powerplants.csv

# track data/ramp/
!data/ramp/
!data/ramp/**
!data/ramp/*.xlsx

# Untrack test doc builds
doc/_build

Expand Down
17 changes: 14 additions & 3 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ if config.get("disable_subworkflow", False):


rule ramp_build_demand_profile:
params:
ramp=config["ramp"],
snapshoots=config["snapshots"],
input:
user_description="data/ramp/{user_type}.xlsx",
output:
profile_results="resources/ramp/{user_type}.xlsx",
daily_demand_profiles="resources/ramp/daily_demand_{user_type}.xlsx",
daily_type_demand_profile="resources/ramp/daily_type_demand_{user_type}.xlsx",
log:
"logs/ramp_build_demand_profile_{user_type}.log",
benchmark:
Expand All @@ -98,12 +102,16 @@ rule ramp_build_demand_profile:


rule build_demand:
params:
tier=config["tier"],
build_demand_model=config["build_demand_type"],
input:
**{
f"profile_{user_file.stem}": f"resources/ramp/{user_file.stem}.xlsx"
f"profile_{user_file.stem}": f"resources/ramp/daily_type_demand_{user_file.stem}.xlsx"
for user_file in Path("data/ramp/").glob("[a-zA-Z0-9]*.xlsx")
},
sample_profile=PROFILE,
building_csv="resources/buildings/buildings_type.csv",
create_network="networks/base.nc",
microgrid_shapes="resources/shapes/microgrid_shapes.geojson",
clusters_with_buildings="resources/buildings/cluster_with_buildings.geojson",
Expand Down Expand Up @@ -185,12 +193,15 @@ rule clean_earth_osm_data:


rule cluster_buildings:
params:
crs=config["crs"],
house_area_limit=config["house_area_limit"],
input:
buildings_geojson="resources/buildings/microgrid_building.geojson",
output:
cleaned_buildings_geojson="resources/buildings/cleaned_buildings.geojson",
clusters="resources/buildings/clustered_buildings.geojson",
clusters_with_buildings="resources/buildings/cluster_with_buildings.geojson",
buildings_type="resources/buildings/buildings_type.csv",
log:
"logs/cluster_buildings.log",
benchmark:
Expand Down
64 changes: 42 additions & 22 deletions config.distribution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: CC0-1.0


version: 0.0.1
tutorial: true

Expand All @@ -19,36 +18,58 @@ enable:
retrieve_cost_data: true
download_osm_data: true
download_osm_buildings: false
# If "build_cutout" : true # requires cds API key https://cds.climate.copernicus.eu/api-how-to
# More information https://atlite.readthedocs.io/en/latest/introduction.html#datasets
# If "build_cutout" : true # requires cds API key
# https://cds.climate.copernicus.eu/api-how-to
# More information
# https://atlite.readthedocs.io/en/latest/introduction.html#datasets
build_cutout: false
build_natura_raster: false # If True, then build_natura_raster can be run

scenario:
simpl: ['']
ll: ['copt']
clusters: [55]
opts: [Co2L-3H] #Co2L adds an overall absolute carbon-dioxide emissions limi
#3H resamples the time-resolution by averaging over every 3 snapshots
opts: [Co2L-3H] # Co2L adds an overall absolute carbon-dioxide emissions limit
# 3H resamples the time-resolution by averaging over every 3 snapshots

countries: ["NG"]
# Can be replaced by country ["NG", "BJ"] or user specific region, more at https://pypsa-earth.readthedocs.io/en/latest/configuration.html#top-level-configuration
# Can be replaced by country ["NG", "BJ"] or user specific region, more at
# https://pypsa-earth.readthedocs.io/en/latest/configuration.html#top-level-configuration

year: "2019" #Year setting allows the choice of which data to download (es. Worldpop_data)
year: "2019" # Year setting allows the choice of which data to download (es. Worldpop_data)

snapshots:
start: "2013-01-01"
end: "2014-01-01"
inclusive: "left" # end is not inclusive
inclusive: "left" # end is not inclusive

ramp:
days: 365 # Days allows to select the number of simulated days to ramp

tier:
tier_percent: [0.3, 0.2, 0.2, 0.1, 0.15, 0.05]
# Tier allows selection of the percentage breakdown of the population into
# the different tiers of energy access. Values range from the percentage of
# population belonging to tier 0 to those belonging to tier 5.

house_area_limit:
area_limit: 255 # All buildings without a specified tag, having an area less than house_limit will be considered houses

build_demand_type:
type: 0
# type allows to select the mode by which the microgrid demand profile is generated.
# 1 = a predetermined hourly profile is used
# 2 = an average hourly profile is calculated by exploiting the ramp tool
# 3 = an average hourly profile and its standard deviation is calculated using the ramp tool,
# and both quantities are used to calculate demand.

# definition of the Coordinate Reference Systems
crs:
geo_crs: EPSG:4326 # general geographic projection, not used for metric measures. "EPSG:4326" is the standard used by OSM and google maps
geo_crs: EPSG:4326 # general geographic projection, not used for metric measures.
# "EPSG:4326" is the standard used by OSM and google maps
distance_crs: EPSG:3857 # projection for distance measurements only. Possible recommended values are "EPSG:3857" (used by OSM and Google Maps)
area_crs: ESRI:54009 # projection for area measurements only. Possible recommended values are Global Mollweide "ESRI:54009"


electricity:
voltage: 0.22
line_type: "24-AL1/4-ST1A 0.4"
Expand All @@ -64,13 +85,12 @@ electricity:

renewable_carriers: [solar, onwind]


# TODO: Needs to be adjusted for Africa
costs:
year: 2030
discountrate: 0.07 # From a Lion Hirth paper, also reflects average of Noothout et al 2016
USD2013_to_EUR2013: 0.7532 # [EUR/USD] ECB: https://www.ecb.europa.eu/stats/exchange/eurofxref/html/eurofxref-graph-usd.en.html
marginal_cost: # EUR/MWh
discountrate: 0.07 # From a Lion Hirth paper, also reflects average of Noothout et al 2016
USD2013_to_EUR2013: 0.7532 # [EUR/USD] ECB: https://www.ecb.europa.eu/stats/exchange/eurofxref/html/eurofxref-graph-usd.en.html
marginal_cost: # EUR/MWh
solar: 0.01
onwind: 0.015
offwind: 0.015
Expand All @@ -80,7 +100,7 @@ costs:
fuel cell: 0.
battery: 0.
battery inverter: 0.
emission_prices: # in currency per tonne emission, only used with the option Ep
emission_prices: # in currency per tonne emission, only used with the option Ep
co2: 0.

solving:
Expand All @@ -93,7 +113,7 @@ solving:
clip_p_max_pu: 0.01
skip_iterations: true
track_iterations: false
#nhours: 10
# nhours: 10
solver:
name: glpk

Expand All @@ -103,12 +123,12 @@ tech_modelling:
conv_techs: ["diesel"]
load_carriers: ["AC load"]

microgrids_list: #MICROGRIDS IN NIGERIA
microgrid_1: #WORKING
lon_max: 5.0998
lon_min: 6.1700
lat_min: 8.2356
lat_max: 9.8012
microgrids_list: # MICROGRIDS IN NIGERIA
microgrid_1: # WORKING
lon_max: 7.3914
lon_min: 7.2616
lat_min: 4.6151
lat_max: 4.7208
load:
scaling_factor: 15000

Expand Down
Binary file added data/ramp/Church.xlsx
Binary file not shown.
Binary file added data/ramp/Hospital.xlsx
Binary file not shown.
Binary file added data/ramp/School.xlsx
Binary file not shown.
Binary file added data/ramp/Tier1.xlsx
Binary file not shown.
Binary file added data/ramp/Tier2.xlsx
Binary file not shown.
Binary file added data/ramp/Tier3.xlsx
Binary file not shown.
Binary file added data/ramp/Tier4.xlsx
Binary file not shown.
Binary file added data/ramp/Tier5.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion pypsa-earth
Submodule pypsa-earth updated 56 files
+6 −6 .pre-commit-config.yaml
+24 −15 README.md
+4 −3 Snakefile
+39 −6 config.default.yaml
+39 −6 config.tutorial.yaml
+1 −1 configs/bundle_config.yaml
+214 −0 configs/regions_definition_config.yaml
+9 −0 data/costs.csv
+1 −0 doc/configtables/cluster_options.csv
+15 −0 doc/configtables/csp.csv
+1 −1 doc/configtables/electricity.csv
+1 −1 doc/configtables/hydro.csv
+2 −2 doc/configtables/lines.csv
+5 −5 doc/configtables/load_options.csv
+1 −1 doc/configtables/offwind-ac.csv
+1 −1 doc/configtables/offwind-dc.csv
+1 −1 doc/configtables/onwind.csv
+1 −1 doc/configtables/solar.csv
+14 −1 doc/configuration.rst
+123 −0 doc/customization_basic1.rst
+31 −0 doc/customization_copernicus.rst
+70 −0 doc/customization_run.rst
+21 −0 doc/customization_steps.rst
+59 −0 doc/customization_validation.rst
+42 −0 doc/how_to_contribute.rst
+0 −36 doc/how_to_docs.rst
+10 −3 doc/index.rst
+7 −7 doc/introduction.rst
+25 −4 doc/release_notes.rst
+16 −262 doc/tutorial.rst
+2 −2 envs/environment.yaml
+8 −36 scripts/_helpers.py
+15 −8 scripts/add_electricity.py
+37 −1 scripts/add_extra_components.py
+2 −4 scripts/augmented_line_connections.py
+69 −78 scripts/base_network.py
+28 −36 scripts/build_bus_regions.py
+1 −2 scripts/build_cutout.py
+105 −16 scripts/build_demand_profiles.py
+0 −1 scripts/build_natura_raster.py
+11 −13 scripts/build_osm_network.py
+3 −5 scripts/build_powerplants.py
+1 −2 scripts/build_renewable_profiles.py
+2 −7 scripts/build_shapes.py
+10 −12 scripts/clean_osm_data.py
+5 −6 scripts/cluster_network.py
+13 −14 scripts/download_osm_data.py
+0 −3 scripts/make_statistics.py
+0 −1 scripts/make_summary.py
+1 −2 scripts/monte_carlo.py
+1 −1 scripts/plot_network.py
+0 −1 scripts/plot_summary.py
+12 −7 scripts/prepare_network.py
+148 −7 scripts/simplify_network.py
+2 −1 scripts/solve_network.py
+1 −1 test/config.landlock.yaml
Loading
Loading