🔌 Power plot over time#3940
Conversation
a7d0d96 to
a6ba4f9
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3940 +/- ##
==========================================
+ Coverage 46.01% 46.04% +0.03%
==========================================
Files 123 123
Lines 28723 28865 +142
==========================================
+ Hits 13217 13292 +75
- Misses 15506 15573 +67 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…tric power calculations and improve line styling for better visualization.
…ric power profiles
…iles_over_time assignment
…nit_power_variables` function
…riables for kWh and MJ
e4d9d4d to
379a00b
Compare
| for i in range(len(power_variables.p_plant_electric_base_total_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric base load at time point {i}", | ||
| f"p_plant_electric_base_total_profile_mw{i}", | ||
| power_variables.p_plant_electric_base_total_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.p_plant_electric_gross_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric gross at time point {i}", | ||
| f"p_plant_electric_gross_profile_mw{i}", | ||
| power_variables.p_plant_electric_gross_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.p_plant_electric_net_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric net at time point {i}", | ||
| f"p_plant_electric_net_profile_mw{i}", | ||
| power_variables.p_plant_electric_net_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.p_hcd_electric_total_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric HCD at time point {i}", | ||
| f"p_hcd_electric_total_profile_mw{i}", | ||
| power_variables.p_hcd_electric_total_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.p_coolant_pump_elec_total_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric coolant pump at time point {i}", | ||
| f"p_coolant_pump_elec_total_profile_mw{i}", | ||
| power_variables.p_coolant_pump_elec_total_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.p_tf_electric_supplies_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric TF supplies at time point {i}", | ||
| f"p_tf_electric_supplies_profile_mw{i}", | ||
| power_variables.p_tf_electric_supplies_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.p_pf_electric_supplies_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric PF supplies at time point {i}", | ||
| f"p_pf_electric_supplies_profile_mw{i}", | ||
| power_variables.p_pf_electric_supplies_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.vachtmw_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric vacuum pump power at time point {i}", | ||
| f"vachtmw_profile_mw{i}", | ||
| power_variables.vachtmw_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.p_tritium_plant_electric_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric tritium plant power at time point {i}", | ||
| f"p_tritium_plant_electric_profile_mw{i}", | ||
| power_variables.p_tritium_plant_electric_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.p_cryo_plant_electric_profile_mw)): | ||
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric cryo plant power at time point {i}", | ||
| f"p_cryo_plant_electric_profile_mw{i}", | ||
| power_variables.p_cryo_plant_electric_profile_mw[i], | ||
| ) | ||
| for i in range(len(power_variables.p_fusion_total_profile_mw)): |
There was a problem hiding this comment.
Can these loops be re-written with enumerate.
E.g.
for index, profile_value in enumerate(power_variables.p_plant_electric_base_total_profile_mw):| return ( | ||
| energy_made_kwh, | ||
| energy_made_mj, | ||
| power_profiles["p_plant_electric_base_total_mw"], | ||
| power_profiles["p_plant_electric_gross_mw"], | ||
| power_profiles["p_plant_electric_net_mw"], | ||
| power_profiles["p_hcd_electric_total_mw"], | ||
| power_profiles["p_coolant_pump_elec_total_mw"], | ||
| power_profiles["p_tf_electric_supplies_mw"], | ||
| power_profiles["p_pf_electric_supplies_mw"], | ||
| power_profiles["vachtmw"], | ||
| power_profiles["p_tritium_plant_electric_mw"], | ||
| power_profiles["p_cryo_plant_electric_mw"], | ||
| power_profiles["p_fusion_total_mw"], | ||
| ) |
There was a problem hiding this comment.
I'm not sure I understand why we are making a dictionary above just to pass out all of its elements
| ( | ||
| power_variables.e_plant_net_electric_pulse_kwh, | ||
| power_variables.e_plant_net_electric_pulse_mj, | ||
| power_variables.p_plant_electric_base_total_profile_mw, | ||
| power_variables.p_plant_electric_gross_profile_mw, | ||
| power_variables.p_plant_electric_net_profile_mw, | ||
| power_variables.p_hcd_electric_total_profile_mw, | ||
| power_variables.p_coolant_pump_elec_total_profile_mw, | ||
| power_variables.p_tf_electric_supplies_profile_mw, | ||
| power_variables.p_pf_electric_supplies_profile_mw, | ||
| power_variables.vachtmw_profile_mw, | ||
| power_variables.p_tritium_plant_electric_profile_mw, | ||
| power_variables.p_cryo_plant_electric_profile_mw, | ||
| power_variables.p_fusion_total_profile_mw, | ||
| ) = self.power_profiles_over_time( |
There was a problem hiding this comment.
Do we even need to store these as variables globally, or can these calculations be done locally and immediately output (would change during PROCESS output format refactor)
| def secs_to_hms(s): | ||
| """Convert seconds to 'Hh Mm Ss' string.""" | ||
| s = float(s) | ||
| return f"{int(s // 3600)}h {int((s % 3600) // 60)}m {int(s % 60)}s" |
There was a problem hiding this comment.
Can this function be made not local?
0d6a960 to
fd225e6
Compare
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric base load at time point {i}", | ||
| f"p_plant_electric_base_total_profile_mw{i}", |
There was a problem hiding this comment.
| f"p_plant_electric_base_total_profile_mw{i}", | |
| f"(p_plant_electric_base_total_profile_mw{i})", |
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric gross at time point {i}", | ||
| f"p_plant_electric_gross_profile_mw{i}", |
There was a problem hiding this comment.
| f"p_plant_electric_gross_profile_mw{i}", | |
| f"(p_plant_electric_gross_profile_mw{i})", |
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric net at time point {i}", | ||
| f"p_plant_electric_net_profile_mw{i}", |
There was a problem hiding this comment.
| f"p_plant_electric_net_profile_mw{i}", | |
| f"(p_plant_electric_net_profile_mw{i})", |
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric HCD at time point {i}", | ||
| f"p_hcd_electric_total_profile_mw{i}", |
There was a problem hiding this comment.
| f"p_hcd_electric_total_profile_mw{i}", | |
| f"(p_hcd_electric_total_profile_mw{i})", |
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric coolant pump at time point {i}", | ||
| f"p_coolant_pump_elec_total_profile_mw{i}", |
There was a problem hiding this comment.
| f"p_coolant_pump_elec_total_profile_mw{i}", | |
| f"(p_coolant_pump_elec_total_profile_mw{i})", |
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric PF supplies at time point {i}", | ||
| f"p_pf_electric_supplies_profile_mw{i}", |
There was a problem hiding this comment.
| f"p_pf_electric_supplies_profile_mw{i}", | |
| f"(p_pf_electric_supplies_profile_mw{i})", |
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric vacuum pump power at time point {i}", | ||
| f"vachtmw_profile_mw{i}", |
There was a problem hiding this comment.
| f"vachtmw_profile_mw{i}", | |
| f"(vachtmw_profile_mw{i})", |
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric tritium plant power at time point {i}", | ||
| f"p_tritium_plant_electric_profile_mw{i}", |
There was a problem hiding this comment.
| f"p_tritium_plant_electric_profile_mw{i}", | |
| f"(p_tritium_plant_electric_profile_mw{i})", |
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric cryo plant power at time point {i}", | ||
| f"p_cryo_plant_electric_profile_mw{i}", |
There was a problem hiding this comment.
| f"p_cryo_plant_electric_profile_mw{i}", | |
| f"(p_cryo_plant_electric_profile_mw{i})", |
| po.ovarre( | ||
| self.mfile, | ||
| f"Plant total electric fusion plant power at time point {i}", | ||
| f"p_fusion_total_profile_mw{i}", |
There was a problem hiding this comment.
| f"p_fusion_total_profile_mw{i}", | |
| f"(p_fusion_total_profile_mw{i})", |
fd225e6 to
ca93576
Compare
This pull request adds comprehensive support for tracking, calculating, and visualizing time-dependent power profiles and net electric energy output for various plant systems over a pulse. The changes include new variables to store power profiles, updated calculations and output routines, and a new plotting function to visualize these profiles, with integration into the main plotting workflow.
Power profile and energy output tracking:
power_variables.pyto store net electric energy output per pulse (in MJ and kWh) and detailed power profiles for key plant subsystems (e.g., coils, pumps, tritium, cryo, fusion, gross/net electric power) over the pulse.init_power_variables()to initialize these new variables and profiles.Calculation and output enhancements:
Power.plant_electric_production()to compute all new energy outputs and power profiles over time, assigning them to the new variables.Power.output_plant_electric_powers()andoutput.pyto write the new net electric energy outputs to the output file.Visualization and plotting integration:
plot_system_power_profiles_over_time()inplot_proc.pyto visualize the time evolution of all tracked power profiles and annotate energy production and pulse timings.Internal API and data flow updates:
Powerclass to track the output file and MFile for improved data flow.Checklist
I confirm that I have completed the following checks: