MainCode/adalm1000_logger.py aktualisiert
Alles sollte klappen (D)
This commit is contained in:
parent
c97256395d
commit
a26f6b8fe5
@ -447,6 +447,15 @@ class BatteryTester(QMainWindow):
|
||||
self.phase_data = deque()
|
||||
self.downsample_factor = 1 # Initial kein Downsampling
|
||||
self.downsample_counter = 0
|
||||
|
||||
# Initialize all measurement variables
|
||||
self.capacity_ah = 0.0
|
||||
self.energy = 0.0
|
||||
self.charge_capacity = 0.0
|
||||
self.coulomb_efficiency = 0.0
|
||||
self.cycle_count = 0
|
||||
self.start_time = time.time()
|
||||
self.last_update_time = self.start_time
|
||||
|
||||
# Initialize UI and device
|
||||
self.setup_ui()
|
||||
@ -1076,20 +1085,15 @@ class BatteryTester(QMainWindow):
|
||||
|
||||
def update_status(self):
|
||||
"""Update status information periodically"""
|
||||
now = time.time()
|
||||
if not hasattr(self, '_last_log_time'):
|
||||
self._last_log_time = now
|
||||
|
||||
if self.test_running or (hasattr(self, 'record_button') and self.record_button.isChecked()):
|
||||
# Update capacity calculations if in test mode
|
||||
if self.test_running or hasattr(self, 'record_button') and self.record_button.isChecked():
|
||||
if self.time_data:
|
||||
current_time = time.time() - self.start_time
|
||||
delta_t = current_time - self.last_update_time
|
||||
self.last_update_time = current_time
|
||||
|
||||
current_current = abs(self.current_data[-1])
|
||||
self.capacity_ah += current_current * delta_t / 3600
|
||||
self.capacity_label.setText(f"{self.capacity_ah:.4f}")
|
||||
current_time = self.time_data[-1] # Verwenden Sie den gespeicherten relativen Zeitstempel
|
||||
if len(self.time_data) > 1:
|
||||
delta_t = self.time_data[-1] - self.time_data[-2] # Korrekte Zeitdifferenz
|
||||
if delta_t > 0: # Nur positive Differenzen berücksichtigen
|
||||
current_current = abs(self.current_data[-1])
|
||||
self.capacity_ah += current_current * delta_t / 3600
|
||||
self.capacity_label.setText(f"{self.capacity_ah:.4f}")
|
||||
|
||||
# Logging (1x per second)
|
||||
if hasattr(self, 'log_writer') and hasattr(self, 'current_cycle_file') and self.current_cycle_file is not None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user