Skip to content

972 pf power supplies accounting 2#4089

Open
ym1906 wants to merge 26 commits intomainfrom
972-pf-power-supplies-accounting-2
Open

972 pf power supplies accounting 2#4089
ym1906 wants to merge 26 commits intomainfrom
972-pf-power-supplies-accounting-2

Conversation

@ym1906
Copy link
Collaborator

@ym1906 ym1906 commented Feb 9, 2026

Description

Updates pfpwr equation to account for additional components in pf power management: busbar, power supply and storage system.

  1. We have added separate functions to calculate the power loss for each component.
  2. pfpwr has been adapted to use these new functions to account for the pf power supply - previously they were lumped into one value.
  3. A mild refactor of pfpwr function (modularising it a bit, renaming some variables)

Checklist

I confirm that I have completed the following checks:

  • My changes follow the PROCESS style guide
  • I have justified any large differences in the regression tests caused by this pull request in the comments.
  • I have added new tests where appropriate for the changes I have made.
  • If I have had to change any existing unit or integration tests, I have justified this change in the pull request comments.
  • If I have made documentation changes, I have checked they render correctly.
  • I have added documentation for my change, if appropriate.

@ym1906 ym1906 requested a review from a team as a code owner February 9, 2026 16:07
@ym1906 ym1906 linked an issue Feb 9, 2026 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.64%. Comparing base (9b6c78a) to head (b511fe9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4089      +/-   ##
==========================================
+ Coverage   46.57%   46.64%   +0.07%     
==========================================
  Files         124      124              
  Lines       29042    29082      +40     
==========================================
+ Hits        13526    13566      +40     
  Misses      15516    15516              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ym1906
Copy link
Collaborator Author

ym1906 commented Feb 10, 2026

@j-a-foster I've pushed my changes here for your review

@chris-ashe chris-ashe self-requested a review February 10, 2026 10:31
Copy link
Collaborator

@chris-ashe chris-ashe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticing quite a few large regression changes. Have made some initial minor comments

Unsurprisingly it has changed the PF power profile, though has it changed the PF current profile diagram in plot_proc?

This is the standard inductive energy expression:

$$
E = \frac{1}{2} I^T M I
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the superscript T in this case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It represents the transpose of the vector of currents


$$
ELoss_{ps,n} =
\frac{k_{ps}}{2}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$k_{ps}$ and $k_{s}$ are both defined in this section. I'm assuming $k_{ps}$ is the power supply efficiency?. Make sure one is chosen and that subscript italics are removed if it is non-iterable

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$k_s$ is the energy storage % loss and $k_{ps}$ is the power supply % loss so both are needed.

@timothy-nunn timothy-nunn self-assigned this Feb 10, 2026
@timothy-nunn timothy-nunn requested a review from mkovari February 10, 2026 14:14
@timothy-nunn
Copy link
Collaborator

I'll add @mkovari to review since he made the original issue

@j-a-foster
Copy link
Collaborator

Should've fixed all subscripts in docs now.

Copy link
Collaborator

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly comments on index names

Comment on lines 302 to 304
# pfcoil_variables.n_pf_cs_plasma_circuits : total number of PF coils (including Central Solenoid and plasma)
# plasma is #n_pf_cs_plasma_circuits, and Central Solenoid is #(pfcoil_variables.n_pf_cs_plasma_circuits-1)
# plasma is #n_pf_cs_plasma_circuits, and Central Solenoid is #(pfcoil_variables.n_pf_cs_plasma_circuits-1)
# pfcoil_variables.ind_pf_cs_plasma_mutual(i,j) : mutual inductance between coil i and j
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the dead code while we are making edits here

Copy link
Collaborator

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Graeme. Happy with the code, will approve and merge when the others reviewers are happy.

@timothy-nunn timothy-nunn self-requested a review February 12, 2026 13:35
@mkovari
Copy link
Collaborator

mkovari commented Feb 17, 2026

Hi Graeme @ym1906 . Could you summarise the changes in the regression tests and in the profile of stored energy and power required? Thanks

chris-ashe and others added 9 commits February 17, 2026 16:14
* Add VacuumVessel class and integrate into Caller model

* Add calculate_dshaped_vessel_volumes method to VacuumVessel class

* Add calculate_elliptical_vessel_volumes method to VacuumVessel class

* 🔥 Remove now redundant vacuum calcs from blanket library

* Refactor BlanketLibrary: remove vacuum vessel calculations and update tests for elliptical vessel volumes

* Add tests for DShaped vessel volume calculations in vacuum module

* Add Shield class with calculate_shield_half_height method

* Add calculate_dshaped_shield_volumes method to Shield class

* Add calculate_dshaped_shield_areas method to Shield class

* Add calculate_elliptical_shield_volumes method to Shield class

* Add calculate_elliptical_shield_areas method to Shield class

* Add Shield model integration to Caller and Models classes

* Implement shield area and volume calculations in run method of Shield class

* Refactor BlanketLibrary to remove shield component calculations and streamline component handling

* Add unit test for elliptical shield volumes calculation

* Add unit test for elliptical shield areas calculation

* Add unit test for D-shaped shield volumes calculation

* Add unit test for D-shaped shield areas calculation

* Remove redundant D-shaped component parameters from test cases

* Remove redundant EllipticalComponentParam test cases

* Post rebase changes

* Remove redundant shield surface parameters from ApplyCoverageFactorsParam class

* Requested style changes

* Add vacuum vessel mass calculation to VacuumVessel class

* Add docstring to vacuum vessel volume calculation method

* Add output methods for shield and vacuum vessel areas and volumes
* CI cleanup

* move tf data to json file

* add biome for json formatting and format

* general formatting cleanup

* add plotting option to tests

* add marker to list

* fix python selection

* add parallelism

* move python version to env workflow level

* fix CI
* Rename Fw class to FirstWall and update references throughout the codebase

* Add methods to calculate first wall geometry and areas in FirstWall class

* Add method to calculate elliptical first wall areas in FirstWall class

* Add dz_fw_half variable for first wall half-height in fwbs_variables.py

* Add method to apply first wall coverage factors in FirstWall class

* Refactor first wall geometry calculations into FirstWall class methods

* Requested changes

* Refactor first wall area calculations to use first_wall_variables and add first_wall_variables.py
* Add average neutron flux variable for plasma surface

* Add average neutron flux calculation for plasma surface

* Add average neutron flux display in plasma information plot
* Add PlasmaBeta class and integrate into Physics initialization

* Refactor beta normalization calculations to use PlasmaBeta class methods

* Add static method to PlasmaBeta for calculating normalized beta

* Refactor beta information output to PlasmaBeta class for improved organization

* Move total normalised beta calc to outside of calculate_plasma_current

* Add static method to PlasmaBeta for calculating plasma energy from beta

* Refactor plasma energy calculations to use PlasmaBeta methods for improved clarity and maintainability

* Refactor fast alpha beta calculation into PlasmaBeta class and remove redundant function from physics_functions.py

* Refactor beta limit calculation into PlasmaBeta class and remove redundant function from physics.py

* Refactor poloidal beta calculation to use PlasmaBeta class methods and remove redundant function

* Refactor thermal beta normalization calculation to use PlasmaBeta class method

* Refactor beta norm max calculation to use PlasmaBeta class property for improved maintainability

* Refactor beta norm max calculation to use BetaNormMaxModel Enum method and improve error handling

* Update plasma beta documentation to include function references for Wesson, Original Scaling, Menard, Tholerus, and Stambaugh relations

* Refactor plasma current documentation for clarity and consistency in variable formatting

* Refactor plasma beta calculations into a dedicated run method for improved organization and maintainability

* Refactor normalized beta calculations into PlasmaBeta class for improved organization and maintainability
* Fixed negativity in sqrt in costs.py by np.clip.

* Introduced a local variable sqrt_p_plant_electric_net_mw in the scope of the method coelc to warn in case p_plant_electric_net_mw is negative. Also caught a third place where sqrt_p_plant_electric_net_mw is needed .(missed earlier as it was commented out)

* Update process/costs.py

Clarified what's the purpose of the calculation inside the warning.

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>

* Bug fixes so regression test passes - Undid the comment line change (previously over-corrected)

---------

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
* Add PlasmaInductance class and integrate into physics and stellarator models

* Refactor internal inductance calculations to use PlasmaInductance class methods and remove redundant static methods

* Refactor internal inductance calculation to use IndInternalNormModel and PlasmaInductance class for improved clarity and maintainability

* Refactor output of volt-second information into PlasmaInductance class for improved organization and maintainability

* Update documentation for PlasmaInductance: add method references to Wesson and Menard relations

* Refactor internal inductance calculations: move logic to PlasmaInductance class and streamline execution with run method
* Add method to calculate reduced mass of two particles

* Refactor classical distance of closest approach calculation to use reduced mass and relative velocity

* Add method to calculate average relative velocity and update usage in detailed physics calculations

* ❇️ Add deuteron thermal velocity profile to physics variables

* Add deuteron thermal velocity profile calculations to detailed physics

* Add electron-deuteron Coulomb logarithm profile to physics variables

* Add electron-deuteron Coulomb logarithm calculations and plotting

* Add deuteron Larmor frequency profile to physics variables

* Add deuteron toroidal Larmor frequency profile calculations and plotting

* Add triton thermal velocity profile to physics variables

* Add electron-triton Coulomb logarithm profile to physics variables

* Add triton Larmor frequency profile to physics variables

* Add triton thermal velocity, Larmor frequency, and Coulomb logarithm profiles to physics variables

* Add triton velocity, Larmor frequency, and Coulomb logarithm profiles to plotting functions

* Update vel_relative parameter to be required in distance calculation method
@ym1906
Copy link
Collaborator Author

ym1906 commented Feb 17, 2026

Hi Graeme @ym1906 . Could you summarise the changes in the regression tests and in the profile of stored energy and power required? Thanks

Hi Michael - the main change in terms of the pf coil power accounting are as follows

p_pf_electric_supplies_mw: 1.02 → 3.18 MW (+212%)

The PF power profile variables (p_pf_electric_supplies_profile_mw1–4) scale consistently with this change.

Do you think this seems reasonable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PF power supplies accounting 2

8 participants

Comments