### Foresight Configuration Example Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md YAML syntax for configuring foresight settings. Ensure planning horizon is set for myopic or perfect foresight. ```yaml {{ yaml_section("foresight") }} ``` -------------------------------- ### Configuration Example for Biomass Share Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/supply_demand.md This YAML snippet shows a configuration example related to the share of unsustainable biomass use that is retained. Adjust this to control how unsustainable biomass is handled in the model. ```yaml {{ yaml_section("biomass.share_unsustainable_use_retained") }} ``` -------------------------------- ### Scenario Configuration Example Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md YAML syntax for configuring top-level scenario settings. This section is linked to wildcards for running multiple scenarios. ```yaml {{ yaml_section("scenario") }} ``` -------------------------------- ### Select Solver Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md Pick a solver for the optimization problem. This example specifies the HiGHS solver. ```yaml {{ yaml_section("solving.solver", source="test/config.electricity.yaml") }} ``` -------------------------------- ### OETC Usage Log Example Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/oetc.md An example log output demonstrating the OETC integration process during model optimization. It shows steps like signing in, fetching credentials, submitting jobs, and job completion status. ```log INFO:linopy.oetc:OETC - Signing in... INFO:linopy.oetc:OETC - Signed in INFO:linopy.oetc:OETC - Fetching user GCP credentials... INFO:linopy.oetc:OETC - Fetched user GCP credentials INFO:linopy.oetc:OETC - Submitting compute job... INFO:linopy.oetc:OETC - Compute job 992616b6-0f24-4ab5-8675-ba8098d795fa started INFO:linopy.oetc:OETC - Waiting for job 992616b6-0f24-4ab5-8675-ba8098d795fa to complete... INFO:linopy.oetc:OETC - Job 992616b6-0f24-4ab5-8675-ba8098d795fa status: PENDING, checking again in 30 seconds... INFO:linopy.oetc:OETC - Job 992616b6-0f24-4ab5-8675-ba8098d795fa status: PENDING, checking again in 45 seconds... INFO:linopy.oetc:OETC - Job 992616b6-0f24-4ab5-8675-ba8098d795fa completed successfully! INFO:linopy.oetc:OETC - Model solved successfully. Status: ok INFO:linopy.oetc:OETC - Objective value: 3.11e+07 ``` -------------------------------- ### Example Generated Default Config YAML Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/validation_dev.md Illustrates the structure of the default configuration YAML file after regeneration, reflecting added options and sections. ```yaml logging: level: INFO format: "% (levelname)s:% (name)s:% (message)s" new_option: 0.5 file: enabled: false path: logs/pypsa.log format: null ``` -------------------------------- ### Snakemake Job Execution Log Example Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md This console output shows the status and details of jobs being executed by Snakemake. It lists the job name, input/output files, logs, and resource allocation for a specific rule. ```console rule build_powerplants: input: resources/test/networks/base_s_6.nc, data/custom_powerplants.csv output: resources/test/powerplants_s_6.csv log: logs/test/build_powerplants_s_6.log jobid: 43 benchmark: benchmarks/test/build_powerplants_s_6 reason: Missing output files: resources/test/powerplants_s_6.csv; Input files updated by another job: resources/test/networks/base_s_6.nc wildcards: clusters=6 resources: tmpdir=, mem_mb=7000, mem_mib=6676 ``` -------------------------------- ### Select Weather Data Source for Renewables Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md Choose the weather data source for calculating potentials and capacity factor time-series for renewable carriers. This example selects ERA-5 for solar. ```yaml {{ yaml_section("renewable.solar.cutout") }} ``` -------------------------------- ### Install Gurobi Solver with Conda Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/installation.md Installs the Gurobi solver version 12.0.1 into the active conda environment. Ensure you have a Gurobi license separately. ```bash conda activate pypsa-eur conda install -c gurobi gurobi"=12.0.1" ``` -------------------------------- ### Run PyPSA-Eur Tutorial Workflow Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md Execute the snakemake workflow for the PyPSA-Eur tutorial with a specific configuration file. This command initiates the process of building and solving the simplified power system model. ```bash snakemake -call results/test-elec/networks/base_s_6_elec_.nc --configfile config/test/config.electricity.yaml ``` -------------------------------- ### Activate Conda Environment Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/installation.md Activate the 'pypsa-eur' conda environment to access its installed packages. ```bash $ conda activate pypsa-eur ``` -------------------------------- ### Configure Tutorial Data Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md Enable or disable the retrieval of the tutorial data set. Defaults to false. ```yaml tutorial: false ``` -------------------------------- ### Configure Selected Countries Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md Limit the spatial scope of the model to specific countries. This example shows how to include only Belgium. ```yaml {{ yaml_section("countries", source="test/config.electricity.yaml") }} ``` -------------------------------- ### Clean Repository and Run All Collection Rule Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial_sector.md Execute these commands to clean the repository and then run the 'all' collection rule for larger-scale analyses. Ensure 'config/config.yaml' is modified beforehand. ```console snakemake -call purge snakemake -call all ``` -------------------------------- ### Electricity Configuration Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md Configuration settings specifically for the electricity sector. This section allows for detailed setup of electricity-related parameters. ```yaml {{ yaml_section("electricity") }} ``` -------------------------------- ### Configure Version Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md Set the version of PyPSA-Eur. This is a descriptive setting. ```yaml version: v2026.02.0 ``` -------------------------------- ### Read buses.csv in R Source: https://github.com/pypsa/pypsa-eur/blob/master/data/entsoegridkit/README.md Example of reading the buses.csv file using R's read.csv function. Assumes the file is in the current directory. ```R buses <- read.csv("buses.csv", header=TRUE, quote="'") ``` -------------------------------- ### Configure Logging Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md Set up top-level logging configurations for the application. ```yaml logging: level: INFO format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" ``` -------------------------------- ### Configure Run Scenarios Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md Define settings for running and storing scenarios with different configurations within the same directory. ```yaml run: output_dir: "/path/to/results" scenarios: - name: "scenario_a" config: { "resolution": "hourly" } - name: "scenario_b" config: { "resolution": "daily" } ``` -------------------------------- ### YAML Configuration for Solar PV Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md YAML configuration for solar photovoltaic (PV) installations. Use this to set parameters specific to solar energy generation. ```yaml renewable: solar: # Configuration for solar PV # Example parameters would go here ``` -------------------------------- ### Load PyPSA Network for Analysis Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md Load a solved PyPSA network from a file for subsequent analysis in Python. ```python import pypsa n = pypsa.Network("results/test-elec/networks/base_s_6_elec_.nc") ``` -------------------------------- ### Run PyPSA-EUR Network Combinations Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md Execute Snakemake to run all combinations of wildcard values defined in the configuration file for electricity networks. ```console snakemake -call resources/test/networks/base.nc --configfile config/test/config.electricity.yaml ``` ```console snakemake -call resources/test/networks/base_s.nc --configfile config/test/config.electricity.yaml ``` ```console snakemake -call resources/test/networks/base_s_6.nc --configfile config/test/config.electricity.yaml ``` ```console snakemake -call resources/test/networks/base_s_6_elec_.nc --configfile config/test/config.electricity.yaml ``` -------------------------------- ### YAML Configuration for Offshore Wind (AC) Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md Specific YAML configuration for offshore wind farms using AC connections. This is useful for defining parameters relevant to AC-linked offshore installations. ```yaml renewable: offwind-ac: # Configuration for offshore wind (AC) # Example parameters would go here ``` -------------------------------- ### Add New Config Option with Pydantic Field Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/validation_dev.md Demonstrates adding a new float option with default value, range constraints, and examples using Pydantic's Field function. ```python from typing import Literal from pydantic import Field from scripts.lib.validation.config._base import ConfigModel class LoggingConfig(ConfigModel): """Configuration for top level `logging` settings.""" # ... existing fields ... # An option with default 0.5, float type and between 0 and 1. If anything else is passed, # the validation will fail new_option: float = Field( 0.5, # default value description="Threshold for the new feature.", # shown in docs and IDE ge=0, # greater than or equal le=1, # less than or equal examples=[0.3, 0.7], # example values for docs ) ``` -------------------------------- ### Configure Atlite Settings Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md Adapt the required range of coordinates for weather data to match the selected countries for accurate renewable energy modeling. ```yaml {{ yaml_section("atlite", source="test/config.electricity.yaml") }} ``` -------------------------------- ### Solving Configuration Settings Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/configuration.md Configure the settings related to the solving process of the energy system model. This includes parameters that affect optimization and simulation performance. ```yaml solving: # Configuration for solving settings # Example: # some_solving_setting: value ``` -------------------------------- ### Configure Perfect Foresight Scenario Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/foresight.md Adjust config/config.perfect.yaml to enable perfect foresight scenarios. This is an experimental feature. ```yaml foresight: perfect ``` -------------------------------- ### Read buses.csv in Python Source: https://github.com/pypsa/pypsa-eur/blob/master/data/entsoegridkit/README.md Example of reading the buses.csv file using Python's csv module. It customizes the dialect to use single quotes for string quoting and handles file opening in binary mode. ```Python import io, csv class dialect(csv.excel): quotechar = "'" with io.open('buses.csv', 'rb') as handle: buses = list(csv.DictReader(handle, dialect)) ``` -------------------------------- ### Clean and Run PyPSA-EUR Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md Purge previous results and then run the 'solve_elec_networks' collection rule for larger scale simulations. ```console snakemake -call purge snakemake -call solve_elec_networks ``` -------------------------------- ### Configure Xpress Solver (Default) Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/installation.md Sets the default Xpress solver for PyPSA-EUR. Requires the 'xpress' Python package and environment variables XPRESSDIR and XPAUTH_PATH to be set. ```yaml solving: solver: name: xpress options: xpress-default ``` -------------------------------- ### Run Snakemake with Specific Configuration Source: https://github.com/pypsa/pypsa-eur/blob/master/doc/tutorial.md Execute a Snakemake rule to solve a simplified network model. This command specifies the output file and the configuration file to use for the run. ```console $ snakemake -call results/test-elec/networks/base_s_6_elec_.nc --configfile config/test/config.electricity.yaml ```