d0fus 2.8.3__tar.gz → 2.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_BIB/D0FUS_parameterization.py +14 -4
  2. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_BIB/D0FUS_physical_functions.py +117 -1
  3. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_BIB/D0FUS_radial_build_functions.py +1 -1
  4. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_EXE/D0FUS_run.py +136 -5
  5. {d0fus-2.8.3 → d0fus-2.9.0}/PKG-INFO +1 -1
  6. {d0fus-2.8.3 → d0fus-2.9.0}/d0fus.egg-info/PKG-INFO +1 -1
  7. {d0fus-2.8.3 → d0fus-2.9.0}/pyproject.toml +1 -1
  8. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS.py +0 -0
  9. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_BIB/D0FUS_cost_data.py +0 -0
  10. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_BIB/D0FUS_cost_functions.py +0 -0
  11. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_BIB/D0FUS_figures.py +0 -0
  12. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_BIB/D0FUS_import.py +0 -0
  13. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_BIB/D0FUS_machine_presets.py +0 -0
  14. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_EXE/D0FUS_genetic.py +0 -0
  15. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_EXE/D0FUS_popcon.py +0 -0
  16. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_EXE/D0FUS_scan.py +0 -0
  17. {d0fus-2.8.3 → d0fus-2.9.0}/D0FUS_EXE/D0FUS_uncertainty.py +0 -0
  18. {d0fus-2.8.3 → d0fus-2.9.0}/LICENSE +0 -0
  19. {d0fus-2.8.3 → d0fus-2.9.0}/README.md +0 -0
  20. {d0fus-2.8.3 → d0fus-2.9.0}/d0fus.egg-info/SOURCES.txt +0 -0
  21. {d0fus-2.8.3 → d0fus-2.9.0}/d0fus.egg-info/dependency_links.txt +0 -0
  22. {d0fus-2.8.3 → d0fus-2.9.0}/d0fus.egg-info/entry_points.txt +0 -0
  23. {d0fus-2.8.3 → d0fus-2.9.0}/d0fus.egg-info/requires.txt +0 -0
  24. {d0fus-2.8.3 → d0fus-2.9.0}/d0fus.egg-info/top_level.txt +0 -0
  25. {d0fus-2.8.3 → d0fus-2.9.0}/setup.cfg +0 -0
@@ -329,10 +329,8 @@ class GlobalConfig:
329
329
  n_shape_TF : float = 1.0 # TF conductor shape factor (1 = square, 0 = optimal) [-]
330
330
  c_BP : float = 0.07 # Backplate thickness [m]
331
331
  TF_grading : bool = False # TF WP conductor grading: α(R) varies to saturate Tresca [-]
332
- f_TF_steel_mass : float = 2.0 # Multiplicative factor on total TF steel mass to account
333
- # for geometry approximations, gravitational supports, and
334
- # inter-coil structures [-]. Default = 2.0 (benchmarked
335
- # against ITER TF coil set total steel mass).
332
+ f_TF_steel_mass : float = 1.0 # Multiplicative factor on total TF steel mass to account
333
+ # for geometry approximations [-]
336
334
 
337
335
  # ── 8. Central Solenoid ──────────────────────────────────────────────────
338
336
  Gap : float = 0.10 # CS–TF mechanical clearance [m]
@@ -473,6 +471,18 @@ class GlobalConfig:
473
471
  # Designs exceeding C_invest_max are penalised. Set to 1e6 to disable.
474
472
  C_invest_max : float = 25e3 # Capital cost ceiling [M EUR]
475
473
 
474
+
475
+ # ── Plant electrical balance and pulsed thermal storage ─────────────────
476
+ # Recirculating loads scaled on EU-DEMO reference values: cryogenics on
477
+ # the magnet cold mass, house load on P_fus, BoP on P_th.
478
+ eta_store : float = 0.90 # Thermal storage round-trip efficiency (pulsed) [-]
479
+ P_fus_DEMO_ref : float = 2037.0 # EU-DEMO 2017 fusion power [MW]
480
+ M_cold_DEMO_ref : float = 6.24e6 # EU-DEMO TF + CS cold mass [kg], D0FUS run of
481
+ # run_EUDEMO2017 (f_TF_steel_mass = 1)
482
+ P_cryo_cool_DEMO_ref : float = 103.0 # EU-DEMO refrigeration load at 4.5 K [kW]
483
+ P_cryo_electric_DEMO_ref : float = 29.0 # EU-DEMO cryoplant electrical power [MWe]
484
+ P_house_load_DEMO_ref : float = 46.5 # EU-DEMO house load [MWe]
485
+ f_BoP : float = 0.03 # Balance-of-plant load fraction of P_th [-]
476
486
  # ── 17. Radial build sublayer widths ─────────────────────────────────────
477
487
  # b = total plasma→TF radial gap (drives all existing machinery).
478
488
  # Per-concept layer widths (SOL, FW, breeder, structure, shields, VV, gaps)
@@ -27,6 +27,122 @@ else:
27
27
  from D0FUS_BIB.D0FUS_import import *
28
28
  from D0FUS_BIB.D0FUS_parameterization import *
29
29
 
30
+ # =============================================================================
31
+ # Plant electrical balance and pulsed-operation utilities (M. Fletcher)
32
+ # =============================================================================
33
+ # Simplified recirculating-power model, scaled on EU-DEMO reference values
34
+ # (GlobalConfig.*_DEMO_ref, f_BoP):
35
+ # cryogenic loads proportional to the magnet cold mass (TF + CS),
36
+ # house load proportional to P_fus,
37
+ # BoP load fraction of P_th.
38
+ # ~100 kW equivalent refrigeration at 4.5 K for EU-DEMO: Corato et al.,
39
+ # Fus. Eng. Des. 174 (2022) 112971. Other reference values: to be sourced.
40
+
41
+ def f_coil_power_supply(E_mag_J, t_ramp_up_s):
42
+ """
43
+ Coil power-supply demand to recharge a coil in a given time.
44
+
45
+ P = E_mag / t [MWe]
46
+
47
+ E_mag_J : float Stored magnetic energy [J].
48
+ t_ramp_up_s : float Recharge time [s] (the dwell for the CS).
49
+ Returns 0 if either input is missing or t <= 0.
50
+ """
51
+ if E_mag_J is None or t_ramp_up_s is None or t_ramp_up_s <= 0:
52
+ return 0.0
53
+ return float(E_mag_J) / float(t_ramp_up_s) * 1.0e-6
54
+
55
+
56
+ def f_feeder_current(I_TF_A, I_CS_A, N_TF=1, N_CS=1):
57
+ """Total TF + CS feeder current [MA]: I_TF N_TF + I_CS N_CS."""
58
+ return (float(I_TF_A) * float(N_TF) + float(I_CS_A) * float(N_CS)) / 1.0e6
59
+
60
+
61
+ def f_cryo_cooling_power(M_cold_kg, M_cold_ref_kg=6.24e6, P_ref_kW=103.0):
62
+ """
63
+ Equivalent refrigeration load at 4.5 K [kW], linear in the magnet
64
+ cold mass (static heat loads through supports, radiation and feeders
65
+ scale with the size of the cold structure).
66
+
67
+ M_cold_kg : float TF + CS cold mass [kg].
68
+ M_cold_ref_kg : float Reference cold mass (EU-DEMO) [kg].
69
+ P_ref_kW : float Reference refrigeration load (EU-DEMO) [kW].
70
+ """
71
+ return float(P_ref_kW) * float(M_cold_kg) / float(M_cold_ref_kg)
72
+
73
+
74
+ def f_cryo_electric_power(M_cold_kg, M_cold_ref_kg=6.24e6, P_ref_MWe=29.0):
75
+ """Cryoplant electrical consumption [MWe], linear in the magnet cold mass."""
76
+ return float(P_ref_MWe) * float(M_cold_kg) / float(M_cold_ref_kg)
77
+
78
+
79
+ def f_house_load(P_fus_MW, P_fus_ref_MW=2037.0, P_ref_MWe=46.5):
80
+ """Fixed house load [MWe], linear in P_fus."""
81
+ return float(P_ref_MWe) * float(P_fus_MW) / float(P_fus_ref_MW)
82
+
83
+
84
+ def f_bop_power(P_th_MWth, f_BoP=0.03):
85
+ """Balance-of-plant (pumping) electrical load [MWe] = f_BoP * P_th."""
86
+ return float(f_BoP) * float(P_th_MWth)
87
+
88
+
89
+ def f_pulsed_thermal_quantities(P_th_MWth, t_plateau_s, dwell_factor,
90
+ eta_store=0.90):
91
+ """
92
+ Thermal storage that delivers a constant power over a full pulse cycle.
93
+
94
+ Cycle: flat-top t_p, dwell t_d = t_p (1/D - 1), with D the dwell factor.
95
+ The flat-top surplus (P_th - P_s) t_p is stored and returned with
96
+ efficiency eta_store during the dwell, eta (P_th - P_s) t_p = P_s t_d:
97
+
98
+ P_s = P_th / (1 + t_d / (eta t_p))
99
+ E_store = (P_th - P_s) t_p = P_th t_p / (1 + eta t_p / t_d)
100
+
101
+ Returns (t_dwell [s], E_store_th [MWh_th], P_th_smoothed [MW_th]).
102
+ Without dwell (D >= 1): (0, 0, P_th).
103
+ """
104
+ if dwell_factor is None or float(dwell_factor) >= 1.0:
105
+ return 0.0, 0.0, float(P_th_MWth)
106
+ if dwell_factor <= 0 or t_plateau_s <= 0 or eta_store <= 0:
107
+ raise ValueError("dwell_factor, t_plateau_s and eta_store must be positive")
108
+ t_dwell = float(t_plateau_s) * (1.0 / float(dwell_factor) - 1.0)
109
+ E_store = (float(P_th_MWth) * float(t_plateau_s)
110
+ / (1.0 + float(eta_store) * float(t_plateau_s) / t_dwell))
111
+ P_smoothed = (float(P_th_MWth)
112
+ / (1.0 + (1.0 / float(eta_store)) * t_dwell / float(t_plateau_s)))
113
+ return t_dwell, E_store / 3600.0, P_smoothed
114
+
115
+
116
+ def f_recirculated_power(P_aux_MW, eta_WP, P_coil_CS_MWe, P_cryo_electric_MWe,
117
+ P_BoP_MWe, P_house_load_MWe):
118
+ """
119
+ Recirculated electrical power [MWe].
120
+
121
+ P_var = P_aux / eta_WP + P_coil_CS + P_cryo + P_BoP
122
+ P_fix = P_house_load
123
+
124
+ Returns (P_var, P_fix, P_var + P_fix).
125
+ """
126
+ P_var = (float(P_aux_MW) / float(eta_WP) + float(P_coil_CS_MWe)
127
+ + float(P_cryo_electric_MWe) + float(P_BoP_MWe))
128
+ return P_var, float(P_house_load_MWe), P_var + float(P_house_load_MWe)
129
+
130
+
131
+ def f_recirculated_energy(P_recirc_var_MWe, P_recirc_fix_MWe, CF):
132
+ """Annual recirculated electricity [MWh/yr] = 8760 (P_var CF + P_fix)."""
133
+ return 8760.0 * (float(P_recirc_var_MWe) * float(CF) + float(P_recirc_fix_MWe))
134
+
135
+
136
+ def f_tritium_consumption(P_fus_MW, CF):
137
+ """
138
+ Annual D-T tritium burn [kg/yr] = 56 kg per GW_fus full-power year x CF.
139
+
140
+ 1 GW.yr / 17.59 MeV = 1.12e28 reactions, x 3.016 u = 56.1 kg.
141
+ CF must be the burn-time fraction (Av x Util x Dwell).
142
+ """
143
+ return 56.0 * float(P_fus_MW) / 1000.0 * float(CF)
144
+
145
+
30
146
  if __name__ == "__main__":
31
147
  # ════════════════════════════════════════════════════════════════════
32
148
  # Executable verification suite
@@ -9501,4 +9617,4 @@ if __name__ == "__main__":
9501
9617
  except FileNotFoundError:
9502
9618
  print("-- ITER deck not found: full-device regression skipped")
9503
9619
 
9504
- _bench_summary()
9620
+ _bench_summary()
@@ -6427,7 +6427,7 @@ def f_coil_masses(
6427
6427
  V_steel_TF: float, V_sc_TF: float, V_cu_TF: float, V_In_TF: float,
6428
6428
  V_steel_CS: float, V_sc_CS: float, V_cu_CS: float, V_In_CS: float,
6429
6429
  Chosen_Steel: str, Supra_choice: str,
6430
- f_TF_steel_mass: float = 2.0,
6430
+ f_TF_steel_mass: float = 1.0,
6431
6431
  ) -> tuple:
6432
6432
  """
6433
6433
  Compute the mass of each material component for the TF and CS coil systems.
@@ -1913,6 +1913,9 @@ def run(config: GlobalConfig = None, verbose: int = 0) -> tuple:
1913
1913
  _nan, # V_rb_divertor
1914
1914
  _nan, _nan, _nan, _nan, _nan, _nan, # M_rb_FW, M_rb_BB, M_rb_shield, M_rb_VV, M_rb_divertor, M_rb_total
1915
1915
  {}, # divertor_solution (empty on failure)
1916
+ _nan, _nan, _nan, _nan, _nan, # plant electrical balance (150-164)
1917
+ _nan, _nan, _nan, _nan, _nan,
1918
+ _nan, _nan, _nan, _nan, _nan,
1916
1919
  )
1917
1920
 
1918
1921
  # =========================================================================
@@ -2131,6 +2134,8 @@ def run(config: GlobalConfig = None, verbose: int = 0) -> tuple:
2131
2134
  P_wallplug_solution = P_CD_solution / eta_WP # Wall-plug power consumed by heating/CD [MW]
2132
2135
  P_elec_solution = f_P_elec(P_fus, P_CD_solution, eta_T, M_blanket, eta_WP,
2133
2136
  f_neutron=f_neutron)
2137
+ # P_elec_solution is overwritten by the plant electrical balance at the
2138
+ # end of run(); this value only feeds the magnet-failure early return.
2134
2139
 
2135
2140
  # ── Loop voltage ──────────────────────────────────────────────────────────
2136
2141
  # V_loop is now computed inside Magnetic_flux (returned as 5th element)
@@ -2278,7 +2283,13 @@ def run(config: GlobalConfig = None, verbose: int = 0) -> tuple:
2278
2283
  _nan, # V_rb_divertor
2279
2284
  _nan, _nan, _nan, # M_rb_FW, M_rb_BB, M_rb_shield
2280
2285
  _nan, _nan, _nan, # M_rb_VV, M_rb_divertor, M_rb_total
2281
- divertor_solution) # two-point divertor model (kept)
2286
+ divertor_solution, # two-point divertor model (kept)
2287
+
2288
+ # Plant electrical-balance outputs unavailable because the
2289
+ # magnet build failed before these quantities could be solved.
2290
+ _nan, _nan, _nan, _nan, _nan,
2291
+ _nan, _nan, _nan, _nan, _nan,
2292
+ _nan, _nan, _nan, _nan, _nan)
2282
2293
 
2283
2294
  # ==============================================================================
2284
2295
  # MAGNETIC FLUX REQUIREMENTS (Inductive Scenario)
@@ -2371,6 +2382,7 @@ def run(config: GlobalConfig = None, verbose: int = 0) -> tuple:
2371
2382
  f_In_CS = result_J_CS['f_In_cable']
2372
2383
  else:
2373
2384
  f_sc_CS = f_cu_CS = f_He_pipe_CS = f_void_CS = f_He_CS = f_In_CS = np.nan
2385
+ E_mag_CS_post = np.nan
2374
2386
 
2375
2387
  # ── Density limit, model-selectable ──────────────────────────────────────
2376
2388
  # Evaluated here (after the power balance and exhaust blocks) because the
@@ -2493,6 +2505,49 @@ def run(config: GlobalConfig = None, verbose: int = 0) -> tuple:
2493
2505
  config.dt_rep_bl, config.dt_rep_div,
2494
2506
  config.Util_factor, config.Dwell_factor)
2495
2507
 
2508
+ # ── Plant electrical balance and pulsed thermal storage ──────────────────
2509
+ # Simplified recirculating-power model (M. Fletcher). Loads other than
2510
+ # heating/CD are scaled on EU-DEMO reference values (config.*_DEMO_ref):
2511
+ # cryogenics on the TF + CS cold mass, house load on P_fus, BoP on P_th.
2512
+ # Pulsed operation: a thermal store delivers a constant P_th_smoothed over
2513
+ # the full cycle (flat-top + dwell), so P_elec is a cycle-averaged value.
2514
+ # The dwell is then carried by P_elec, and CF excludes it (CF = Av × Util)
2515
+ # to avoid counting it twice in COE = cost / (8760 CF P_elec). Component
2516
+ # calendar lifetimes and Av above keep the dwell (fluence per year).
2517
+ P_th_solution = (P_fus * (f_neutron * M_blanket + 1.0 - f_neutron)
2518
+ + P_CD_solution) # neutron-only blanket multiplication
2519
+ (t_dwell_solution, E_store_th_solution,
2520
+ P_th_smoothed_solution) = f_pulsed_thermal_quantities(
2521
+ P_th_solution, config.Temps_Plateau_input, config.Dwell_factor,
2522
+ config.eta_store)
2523
+ P_e_gross_solution = eta_T * P_th_smoothed_solution
2524
+ # CS recharge during the dwell (zero without dwell)
2525
+ P_coil_CS_solution = (f_coil_power_supply(E_mag_CS_post, t_dwell_solution)
2526
+ if config.Dwell_factor < 1.0 else 0.0)
2527
+ I_feeders_solution = f_feeder_current(
2528
+ config.I_cond, config.I_cond, N_TF=N_TF, N_CS=config.N_sub_CS)
2529
+ M_cold_solution = M_total_TF + M_total_CS # magnet cold mass [kg]
2530
+ P_cryo_cool_solution = f_cryo_cooling_power(
2531
+ M_cold_solution, config.M_cold_DEMO_ref, config.P_cryo_cool_DEMO_ref)
2532
+ P_cryo_electric_solution = f_cryo_electric_power(
2533
+ M_cold_solution, config.M_cold_DEMO_ref, config.P_cryo_electric_DEMO_ref)
2534
+ P_house_load_solution = f_house_load(
2535
+ P_fus, config.P_fus_DEMO_ref, config.P_house_load_DEMO_ref)
2536
+ P_BoP_solution = f_bop_power(P_th_solution, config.f_BoP)
2537
+ # Heating/CD wall-plug power on P_CD, as in P_wallplug_solution
2538
+ (P_recirc_var_solution, P_recirc_fix_solution,
2539
+ P_recirculated_solution) = f_recirculated_power(
2540
+ P_CD_solution, eta_WP, P_coil_CS_solution, P_cryo_electric_solution,
2541
+ P_BoP_solution, P_house_load_solution)
2542
+ P_elec_solution = P_e_gross_solution - P_recirculated_solution
2543
+
2544
+ CF_solution = Av_solution * config.Util_factor
2545
+ E_recirculated_solution = f_recirculated_energy(
2546
+ P_recirc_var_solution, P_recirc_fix_solution, CF_solution)
2547
+ # Burn time fraction = Av × Util × Dwell. D-D consumes no external tritium.
2548
+ C_tritium_solution = (f_tritium_consumption(
2549
+ P_fus, CF_solution * config.Dwell_factor) if Fuel == 'DT' else 0.0)
2550
+
2496
2551
  return (B0_solution, B_CS, B_pol_solution,
2497
2552
  tauE_solution, W_th_solution,
2498
2553
  Q_solution, Volume_solution, Surface_solution,
@@ -2549,7 +2604,24 @@ def run(config: GlobalConfig = None, verbose: int = 0) -> tuple:
2549
2604
  # ── Radial build component masses (indices 143–148) ──────────────
2550
2605
  M_rb_FW, M_rb_BB, M_rb_shield, # 143, 144, 145
2551
2606
  M_rb_VV, M_rb_divertor, M_rb_total,
2552
- divertor_solution) # 146, 147, 148
2607
+ divertor_solution, # 149
2608
+
2609
+ # ── Plant electrical balance / pulsed-operation outputs (150–164)
2610
+ P_th_solution,
2611
+ P_th_smoothed_solution,
2612
+ E_store_th_solution,
2613
+ P_e_gross_solution,
2614
+ P_coil_CS_solution,
2615
+ I_feeders_solution,
2616
+ P_cryo_cool_solution,
2617
+ P_cryo_electric_solution,
2618
+ P_house_load_solution,
2619
+ P_BoP_solution,
2620
+ P_recirc_var_solution,
2621
+ P_recirc_fix_solution,
2622
+ P_recirculated_solution,
2623
+ E_recirculated_solution,
2624
+ C_tritium_solution)
2553
2625
 
2554
2626
 
2555
2627
  #%% Output writer
@@ -2573,6 +2645,16 @@ def _build_run_dict(config: GlobalConfig, results: tuple) -> dict:
2573
2645
  -------
2574
2646
  dict Ready to pass to plot_run().
2575
2647
  """
2648
+ _plant = {}
2649
+ try:
2650
+ (_plant["P_th"], _plant["P_th_smoothed"], _plant["E_store_th"],
2651
+ _plant["P_e_gross"], _plant["P_coil_CS"], _plant["I_feeders"],
2652
+ _plant["P_cryo_cool"], _plant["P_cryo_electric"], _plant["P_house_load"],
2653
+ _plant["P_BoP"], _plant["P_recirc_var"], _plant["P_recirc_fix"],
2654
+ _plant["P_recirculated"], _plant["E_recirculated"], _plant["C_tritium"]) = results[-15:]
2655
+ except Exception:
2656
+ _plant = {}
2657
+
2576
2658
  # ── Unpack the results tuple (same ordering as run() return statement) ────
2577
2659
  (B0, _B_CS_r, _B_pol_r,
2578
2660
  _tauE, _W_th,
@@ -2859,6 +2941,7 @@ def _build_run_dict(config: GlobalConfig, results: tuple) -> dict:
2859
2941
  "P_fus": config.P_fus,
2860
2942
  "P_aux": config.P_aux_input,
2861
2943
  "Q": _f(Q, float('nan')),
2944
+ **_plant,
2862
2945
  # Impurity seeding
2863
2946
  "f_W": _imp_out["W"],
2864
2947
  "f_Ne": _imp_out["Ne"],
@@ -3375,7 +3458,25 @@ def _write_full_report(config, results, output_path, timestamp, input_file_path=
3375
3458
  row("Capacity factor CF", CF, "-")
3376
3459
  lines.append("")
3377
3460
 
3378
- H("14. OUTPUTS - Techno-economics (Sheffield 2016)")
3461
+ H("14. OUTPUTS - Plant electrical balance & pulsed operation")
3462
+ row("Instantaneous thermal power P_th", rd.get("P_th"), "MWth")
3463
+ row("Smoothed thermal power P_th_smoothed", rd.get("P_th_smoothed"), "MWth")
3464
+ row("Stored thermal energy E_store_th", rd.get("E_store_th"), "MWhth")
3465
+ row("Gross electrical power P_e_gross", rd.get("P_e_gross"), "MWe")
3466
+ row("CS coil power supply P_coil_CS", rd.get("P_coil_CS"), "MWe")
3467
+ row("Total TF + CS feeder current I_feeders", rd.get("I_feeders"), "MA")
3468
+ row("Refrigeration load at 4.5 K P_cryo_cool", rd.get("P_cryo_cool"), "kW")
3469
+ row("Cryogenic electrical consumption P_cryo_electric", rd.get("P_cryo_electric"), "MWe")
3470
+ row("Fixed house load P_house_load", rd.get("P_house_load"), "MWe")
3471
+ row("Balance-of-plant power P_BoP", rd.get("P_BoP"), "MWe")
3472
+ row("Variable recirculating power P_recirc_var", rd.get("P_recirc_var"), "MWe")
3473
+ row("Fixed recirculating power P_recirc_fix", rd.get("P_recirc_fix"), "MWe")
3474
+ row("Total recirculated power P_recirculated", rd.get("P_recirculated"), "MWe")
3475
+ row("Annual recirculated electricity E_recirculated", rd.get("E_recirculated"), "MWh/year")
3476
+ row("Annual tritium consumption C_tritium", rd.get("C_tritium"), "kg/year")
3477
+ lines.append("")
3478
+
3479
+ H("15. OUTPUTS - Techno-economics (Sheffield 2016)")
3379
3480
  row("Geometric cost proxy (V_build / P_fus)", get("cost"), "m^3/MW")
3380
3481
  _cb = rd.get("cost_breakdown") or {}
3381
3482
  if _cb:
@@ -3493,7 +3594,24 @@ def save_run_output(config: GlobalConfig,
3493
3594
  V_rb_divertor,
3494
3595
  M_rb_FW, M_rb_BB, M_rb_shield,
3495
3596
  M_rb_VV, M_rb_divertor, M_rb_total,
3496
- divertor_out) = results
3597
+ divertor_out,
3598
+ *plant_results) = results
3599
+
3600
+ # ── Plant electrical-balance outputs (return indices 150–164) ───────────
3601
+ # The original 150 result positions remain unchanged; the new quantities
3602
+ # are appended after them.
3603
+ if len(plant_results) == 15:
3604
+ (P_th, P_th_smoothed, E_store_th,
3605
+ P_e_gross, P_coil_CS, I_feeders,
3606
+ P_cryo_cool, P_cryo_electric, P_house_load,
3607
+ P_BoP, P_recirc_var, P_recirc_fix,
3608
+ P_recirculated, E_recirculated, C_tritium) = plant_results
3609
+ else:
3610
+ (P_th, P_th_smoothed, E_store_th,
3611
+ P_e_gross, P_coil_CS, I_feeders,
3612
+ P_cryo_cool, P_cryo_electric, P_house_load,
3613
+ P_BoP, P_recirc_var, P_recirc_fix,
3614
+ P_recirculated, E_recirculated, C_tritium) = (np.nan,) * 15
3497
3615
 
3498
3616
  # ── Recompute N_TF for display (not stored in results tuple) ──────────
3499
3617
  try:
@@ -3821,7 +3939,20 @@ def save_run_output(config: GlobalConfig,
3821
3939
  print(f"[O] Q (Energy gain factor) : {Q:.3f}", file=out)
3822
3940
  print(f"[O] P_elec (Net electrical power) : {P_elec:.3f} [MW]", file=out)
3823
3941
  print(f"[O] P_wallplug (Wall-plug heating/CD power) : {P_wallplug:.3f} [MW]", file=out)
3824
- _P_gross = config.eta_T * config.P_fus * (0.8 * config.M_blanket + 0.2)
3942
+ print(f"[O] P_e_gross (Gross electrical power) : {P_e_gross:.3f} [MWe]", file=out)
3943
+ print(f"[O] P_th_smoothed (Smoothed thermal power) : {P_th_smoothed:.3f} [MWth]", file=out)
3944
+ print(f"[O] E_store_th (Stored thermal energy) : {E_store_th:.3f} [MWhth]", file=out)
3945
+ print(f"[O] P_coil_CS (CS power supply) : {P_coil_CS:.3f} [MWe]", file=out)
3946
+ print(f"[O] I_feeders (Total TF + CS feeder current) : {I_feeders:.3f} [MA]", file=out)
3947
+ print(f"[O] P_cryo_cool (Refrigeration load at 4.5 K) : {P_cryo_cool:.3f} [kW]", file=out)
3948
+ print(f"[O] P_cryo_electric : {P_cryo_electric:.3f} [MWe]", file=out)
3949
+ print(f"[O] P_house_load : {P_house_load:.3f} [MWe]", file=out)
3950
+ print(f"[O] P_BoP : {P_BoP:.3f} [MWe]", file=out)
3951
+ print(f"[O] P_recirc_var : {P_recirc_var:.3f} [MWe]", file=out)
3952
+ print(f"[O] P_recirc_fix : {P_recirc_fix:.3f} [MWe]", file=out)
3953
+ print(f"[O] P_recirculated : {P_recirculated:.3f} [MWe]", file=out)
3954
+ print(f"[O] E_recirculated : {E_recirculated:.3f} [MWh/year]", file=out)
3955
+ print(f"[O] C_tritium : {C_tritium:.3f} [kg/year]", file=out)
3825
3956
  print(f"[O] Q_eng (Engineering gain = P_elec / P_wallplug) : {P_elec / P_wallplug:.3f}", file=out)
3826
3957
  print(f"[O] Cost ((V_BB+V_TF+V_CS) / P_fus) : {cost:.3f} [m³/MW]", file=out)
3827
3958
  print("-------------------------------------------------------------------------", file=out)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: d0fus
3
- Version: 2.8.3
3
+ Version: 2.9.0
4
4
  Summary: Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool
5
5
  Author-email: Timothé Auclair <timothe.auclair@gmail.com>
6
6
  Maintainer-email: Timothé Auclair <timothe.auclair@gmail.com>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: d0fus
3
- Version: 2.8.3
3
+ Version: 2.9.0
4
4
  Summary: Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool
5
5
  Author-email: Timothé Auclair <timothe.auclair@gmail.com>
6
6
  Maintainer-email: Timothé Auclair <timothe.auclair@gmail.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "d0fus"
7
- version = "2.8.3"
7
+ version = "2.9.0"
8
8
  description = "Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool"
9
9
  readme = "README.md"
10
10
  license = {text = "CeCILL-C"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes