Show summed process time and total energy in the status bar
Elapsed is just Sud's own tick-counted total (every step's time, WAIT_USER dwell included, already adds up sequentially with no gaps). Energy has no equivalent single running counter server-side (it's banked per step, not accumulated as one grand total - see tasks/ sud.py's SudTask) - summed here instead from every finished step's own Wh total plus the active step's running one, then converted to kWh. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019qvu5giu7gvRCyEWzf2Vpx
This commit is contained in:
@@ -1116,12 +1116,14 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
if not self.forecast_history and self.plot_temp_ist and msg['Elapsed'] < FRESH_RUN_ELAPSED_THRESHOLD_S:
|
||||
self.forecast_history.append((msg['Elapsed'] / 60.0, self.plot_temp_ist))
|
||||
self._update_step_plates()
|
||||
self.update_status_step_label()
|
||||
elif "Forecast" in key:
|
||||
self.on_sud_forecast_received(msg['Forecast'])
|
||||
elif "Energy" in key:
|
||||
self.sud_energy_by_step = dict(msg['Energy']['StepEnergy'])
|
||||
self.sud_energy_current = msg['Energy']['Current']
|
||||
self._update_step_plates()
|
||||
self.update_status_step_label()
|
||||
elif "Error" in key:
|
||||
# The server clears this back to None right after sending
|
||||
# it (see tasks/sud.py's recv()) so it doesn't linger in
|
||||
@@ -1182,6 +1184,19 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
mass_text = "Pot: {:.2f} kg, Water: {:.2f} kg, Grain {:.2f} kg, total {:.2f} kg".format(
|
||||
pot, water, grain, pot + water + grain)
|
||||
text = text + " " + mass_text if text else mass_text
|
||||
# Sums, not just the active step's own figures: total process time
|
||||
# is just self.sud_elapsed_seconds (Sud's own tick-counted total -
|
||||
# every step's time, including any WAIT_USER dwell, already adds
|
||||
# up into it sequentially with no gaps); total energy has no such
|
||||
# single running counter server-side (see tasks/sud.py's SudTask -
|
||||
# energy is banked per step, not accumulated as one grand total),
|
||||
# so it's summed here from every finished step's own Wh total
|
||||
# plus whatever the currently active one has used so far.
|
||||
elapsed_text = "Elapsed {}".format(
|
||||
_format_duration(self.sud_elapsed_seconds) if self.sud_elapsed_seconds is not None else "--:--")
|
||||
total_energy_kwh = (sum(self.sud_energy_by_step.values()) + self.sud_energy_current) / 1000.0
|
||||
energy_text = "Energy {:.2f} kWh".format(total_energy_kwh)
|
||||
text = "{} {} {}".format(text, elapsed_text, energy_text)
|
||||
self.statusBar().showMessage(text)
|
||||
|
||||
def update_sud_forecast(self, doc):
|
||||
|
||||
Reference in New Issue
Block a user