MainCode/adalm1000_logger.py aktualisiert
Got it working, from the push before. (Deepseek)
This commit is contained in:
parent
81ccc8ccd7
commit
12fb82ce80
@ -425,7 +425,7 @@ class BatteryTester:
|
|||||||
self.cycle_count.set(0)
|
self.cycle_count.set(0)
|
||||||
|
|
||||||
# Ensure plot is properly reset for new test
|
# Ensure plot is properly reset for new test
|
||||||
self.reset_plot_data()
|
self.reset_plot()
|
||||||
|
|
||||||
# Generate base filename without cycle number
|
# Generate base filename without cycle number
|
||||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
@ -521,7 +521,7 @@ class BatteryTester:
|
|||||||
self.coulomb_efficiency.set(0.0)
|
self.coulomb_efficiency.set(0.0)
|
||||||
|
|
||||||
# Reset plot
|
# Reset plot
|
||||||
self.reset_plot_data()
|
self.reset_plot()
|
||||||
|
|
||||||
# Update UI
|
# Update UI
|
||||||
self.status_var.set("Test stopped - Ready for new test")
|
self.status_var.set("Test stopped - Ready for new test")
|
||||||
@ -773,22 +773,31 @@ class BatteryTester:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"GUI update error: {e}")
|
print(f"GUI update error: {e}")
|
||||||
|
|
||||||
def reset_plot_data(self):
|
def reset_plot(self):
|
||||||
"""Clear and reset plot data for a new test"""
|
"""Reset the plot completely for a new test"""
|
||||||
self.line_voltage.set_data([], [])
|
# Clear the data lines
|
||||||
self.line_current.set_data([], [])
|
self.line_voltage.set_data([], [])
|
||||||
# Reset to reasonable default ranges
|
self.line_current.set_data([], [])
|
||||||
voltage_padding = 0.2
|
|
||||||
min_voltage = max(0, self.discharge_cutoff.get() - voltage_padding)
|
# Reset the data buffers
|
||||||
max_voltage = self.charge_cutoff.get() + voltage_padding
|
self.time_data.clear()
|
||||||
self.ax.set_xlim(0, 10) # Small initial time range
|
self.voltage_data.clear()
|
||||||
self.ax.set_ylim(min_voltage, max_voltage)
|
self.current_data.clear()
|
||||||
|
|
||||||
current_padding = 0.05
|
# Set reasonable initial axis ranges
|
||||||
test_current = self.c_rate.get() * self.capacity.get()
|
voltage_padding = 0.2
|
||||||
max_current = test_current * 1.5 # Add 50% padding
|
min_voltage = max(0, self.discharge_cutoff.get() - voltage_padding)
|
||||||
self.ax2.set_ylim(-max_current - current_padding, max_current + current_padding)
|
max_voltage = self.charge_cutoff.get() + voltage_padding
|
||||||
self.canvas.draw()
|
self.ax.set_xlim(0, 10) # 10s initial range
|
||||||
|
self.ax.set_ylim(min_voltage, max_voltage)
|
||||||
|
|
||||||
|
current_padding = 0.05
|
||||||
|
test_current = self.c_rate.get() * self.capacity.get()
|
||||||
|
max_current = test_current * 1.5 # 50% padding
|
||||||
|
self.ax2.set_ylim(-max_current - current_padding, max_current + current_padding)
|
||||||
|
|
||||||
|
# Force redraw
|
||||||
|
self.canvas.draw()
|
||||||
|
|
||||||
def write_cycle_summary(self):
|
def write_cycle_summary(self):
|
||||||
"""Write cycle summary to the current cycle's log file"""
|
"""Write cycle summary to the current cycle's log file"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user