TroubleshootingΒΆ
Setup debuggerΒΆ
To test the workflow using Snakemake rules, a configuration file launch.json with the following content is required:
Debugger configurations
{
"version": "0.2.0",
"configurations": [
{
"name": "mock snakemake",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false,
"cwd": "${cwd}${pathSeparator}scripts"
}
]
}
Once this file is set up, you can easily run any Python file in the scripts folder under debugger mode for testing.
Infeasibility issuesΒΆ
If your model is infeasible or unbounded, it often means that your input settings are leading to a situation where PyPSA canβt solve one or more objective functions. Common causes are:
- Insufficient generator capacity at a bus to meet the load across all snapshots.
- Must-run generators (
p_min_pu) produce more power than the load at certain snapshots, causing excess power (i.e., power dumping). - Negative values assigned to capacity parameters.
- Maximum capacity (
p_nom_max) is smaller than minimum capacity (p_nom_min). - Storage units has inflow and cyclic charging (
cyclic_state_of_charge = True) but no discharging capability.
Tips for diagnosing the problemΒΆ
Try the following steps to identify and fix the issue:
- Run
pypsa.network.consistency_check()to check if any warnings appear. - Temporarily disable custom features or user extensions to isolate the cause.
- Ensure load-shedding generators are added to every bus.
- Check
pypsa.network.generators.p_min_puto identify any must-run generators. Then verify if their generation exceeds the corresponding load inpypsa.network.loads_t.p_set. - Compare the
p_nom_maxandp_nom_minvalues for each component to ensure they make sense (i.e., max β₯ min). - Try disabling cyclic charging for storage units:
pypsa.network.storage_units.cyclic_state_of_charge = False. - Double-check for any negative values in:
pypsa.network.{component}.p_nompypsa.network.{component}.p_nom_maxpypsa.network.{component}.p_nom_min
More detailed informationΒΆ
PyPSA also provides official guidance on solving infeasiblity issues. You can also explore the link to seek for a good solution.