Add PFLocationTypes enum for PF coil locations#4278
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4278 +/- ##
==========================================
+ Coverage 48.83% 48.85% +0.01%
==========================================
Files 151 151
Lines 29127 29138 +11
==========================================
+ Hits 14223 14234 +11
Misses 14904 14904 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
54c9d09 to
e134c9b
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a typed IntEnum for PF coil location modes and updates PF coil logic and initialization to use the enum instead of magic integers. It also includes small refactors to reuse existing derived variables for CS flux/geometry calculations, with corresponding test and documentation updates.
Changes:
- Add
PFLocationTypes(IntEnum)and replacei_pf_location == {1,2,3,4}checks/assignments with enum members. - Refactor CS-related calculations to use existing aggregated variables (
vs_plasma_ramp_required,dz_cs_full,a_cs_poloidal) rather than recomputing equivalent expressions. - Update a PF coil unit test and the PF coil documentation to reflect the new enum/type references.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
process/models/pfcoil.py |
Adds PFLocationTypes and replaces numeric i_pf_location comparisons; refactors CS flux/geometry usage and CS filament current calculation. |
process/core/init.py |
Uses PFLocationTypes when setting/checking PF coil location defaults. |
tests/unit/models/test_pfcoil.py |
Adds test mocking for a_cs_poloidal to match the updated CS filament current calculation. |
documentation/source/eng-models/pf-coil.md |
Updates the “Positioning” section header to reference the enum/type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| init_superconducting_tf_coil_variables, | ||
| ) | ||
| from process.data_structure.tfcoil_variables import init_tfcoil_variables | ||
| from process.models.pfcoil import PFLocationTypes |
e134c9b to
6dbbd9e
Compare
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
Description
Checklist
I confirm that I have completed the following checks: