MainCode/adalm1000_logger.py aktualisiert
Alles sollte klappen (D)
This commit is contained in:
parent
c97256395d
commit
a26f6b8fe5
@ -448,6 +448,15 @@ class BatteryTester(QMainWindow):
|
|||||||
self.downsample_factor = 1 # Initial kein Downsampling
|
self.downsample_factor = 1 # Initial kein Downsampling
|
||||||
self.downsample_counter = 0
|
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
|
# Initialize UI and device
|
||||||
self.setup_ui()
|
self.setup_ui()
|
||||||
self.init_device()
|
self.init_device()
|
||||||
@ -1076,17 +1085,12 @@ class BatteryTester(QMainWindow):
|
|||||||
|
|
||||||
def update_status(self):
|
def update_status(self):
|
||||||
"""Update status information periodically"""
|
"""Update status information periodically"""
|
||||||
now = time.time()
|
if self.test_running or hasattr(self, 'record_button') and self.record_button.isChecked():
|
||||||
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.time_data:
|
if self.time_data:
|
||||||
current_time = time.time() - self.start_time
|
current_time = self.time_data[-1] # Verwenden Sie den gespeicherten relativen Zeitstempel
|
||||||
delta_t = current_time - self.last_update_time
|
if len(self.time_data) > 1:
|
||||||
self.last_update_time = current_time
|
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])
|
current_current = abs(self.current_data[-1])
|
||||||
self.capacity_ah += current_current * delta_t / 3600
|
self.capacity_ah += current_current * delta_t / 3600
|
||||||
self.capacity_label.setText(f"{self.capacity_ah:.4f}")
|
self.capacity_label.setText(f"{self.capacity_ah:.4f}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user