Create modular network fixtures for opts testing
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 148
- Forks
- 55
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
I really like the `base_network()` fixture, but wonder too much is included in it? Carriers that are here, but only used in some constraints (ie. `nuclear`), component interactions that shouldnt happen are included (ie. lines and links both being used for power transfer), attributes that are only used for particular constraints are included globally (ie. `land_area`), ect.
This can be an issue as then we are not isolating each test. For example, (a fictional case could be) if a constraint uses a shared function to check that component names are defined correctly and there is an issue with how a line is defined. All tests would fail cause lines are always included in the base network. However, if running a transport model, these tests should pass as lines are replaced with links. This can make diagnosing the problem harder. (I do concede that is is a fairly extreme edge case 😅)
Would it be better to have like a high level base_network() that has only components that are shared across all network configurations (ie. snapshots, buses, loads)? Then we can have a few "sub" base networks. For example, one that is transport or not transport; one that is electrical only vs sector (where, for example some generators are replaced with links); ect?
Or maybe the base network is literally a 1, 2, or 3 node network that only defines the snapshots and buses. Then each constraint adds in exactly what it needs? ie. for some constraints, we dont even need multi-node networks, or storage units?
Or is this creating too much structure?
Originally posted by @trevorb1 in https://github.com/PyPSA/pypsa-usa/pull/592#discussion_r2069229457
Per @trevorb1 suggestion, I will create multiple modular test network fixtures that can be used to catch edge cases for each set of opts testing. This is to avoid having one or few test networks that are loaded with extra data.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the shared base_network() fixture and the opts tests that use it. Define modular fixtures containing only the components needed by each test group, then verify that the opts tests remain isolated and pass with the narrower networks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100