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)
|
||||
|
||||
# Ensure plot is properly reset for new test
|
||||
self.reset_plot_data()
|
||||
self.reset_plot()
|
||||
|
||||
# Generate base filename without cycle number
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
@ -521,7 +521,7 @@ class BatteryTester:
|
||||
self.coulomb_efficiency.set(0.0)
|
||||
|
||||
# Reset plot
|
||||
self.reset_plot_data()
|
||||
self.reset_plot()
|
||||
|
||||
# Update UI
|
||||
self.status_var.set("Test stopped - Ready for new test")
|
||||
@ -773,22 +773,31 @@ class BatteryTester:
|
||||
except Exception as e:
|
||||
print(f"GUI update error: {e}")
|
||||
|
||||
def reset_plot_data(self):
|
||||
"""Clear and reset plot data for a new test"""
|
||||
self.line_voltage.set_data([], [])
|
||||
self.line_current.set_data([], [])
|
||||
# Reset to reasonable default ranges
|
||||
voltage_padding = 0.2
|
||||
min_voltage = max(0, self.discharge_cutoff.get() - voltage_padding)
|
||||
max_voltage = self.charge_cutoff.get() + voltage_padding
|
||||
self.ax.set_xlim(0, 10) # Small initial time 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 # Add 50% padding
|
||||
self.ax2.set_ylim(-max_current - current_padding, max_current + current_padding)
|
||||
self.canvas.draw()
|
||||
def reset_plot(self):
|
||||
"""Reset the plot completely for a new test"""
|
||||
# Clear the data lines
|
||||
self.line_voltage.set_data([], [])
|
||||
self.line_current.set_data([], [])
|
||||
|
||||
# Reset the data buffers
|
||||
self.time_data.clear()
|
||||
self.voltage_data.clear()
|
||||
self.current_data.clear()
|
||||
|
||||
# Set reasonable initial axis ranges
|
||||
voltage_padding = 0.2
|
||||
min_voltage = max(0, self.discharge_cutoff.get() - voltage_padding)
|
||||
max_voltage = self.charge_cutoff.get() + voltage_padding
|
||||
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):
|
||||
"""Write cycle summary to the current cycle's log file"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user