MainCode/adalm1000_logger.py aktualisiert
Diese Änderungen fügen:
Ein neues Eingabefeld für Testbedingungen/Zellchemie hinzu
Schreiben alle relevanten Testparameter in den Kopf der Logdatei
Fügen eine detaillierte Zusammenfassung am Ende der Logdatei hinzu
Zeigen die Testparameter auch in der Abschlussmeldung an
(D)
This commit is contained in:
parent
20fe83a319
commit
c52779e104
@ -434,6 +434,15 @@ class BatteryTester(QMainWindow):
|
||||
params_layout.addWidget(c_rate_note, 0, 4)
|
||||
|
||||
controls_layout.addWidget(params_frame, 1)
|
||||
|
||||
# Test conditions input
|
||||
self.test_conditions_label = QLabel("Test Conditions/Chemistry:")
|
||||
self.test_conditions_label.setStyleSheet(f"color: {self.fg_color};")
|
||||
params_layout.addWidget(self.test_conditions_label, 4, 0)
|
||||
self.test_conditions_input = QLineEdit("")
|
||||
self.test_conditions_input.setStyleSheet(f"background-color: #3B4252; color: {self.fg_color};")
|
||||
self.test_conditions_input.setFixedWidth(120)
|
||||
params_layout.addWidget(self.test_conditions_input, 4, 1)
|
||||
|
||||
# Button frame
|
||||
button_frame = QFrame()
|
||||
@ -746,6 +755,22 @@ class BatteryTester(QMainWindow):
|
||||
# Open new file
|
||||
try:
|
||||
self.current_cycle_file = open(self.filename, 'w', newline='')
|
||||
|
||||
# Write header with test parameters
|
||||
test_current = self.c_rate * self.capacity
|
||||
test_conditions = self.test_conditions_input.text() if hasattr(self, 'test_conditions_input') else "N/A"
|
||||
|
||||
self.current_cycle_file.write(f"# ADALM1000 Battery Test Log\n")
|
||||
self.current_cycle_file.write(f"# Date: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
|
||||
self.current_cycle_file.write(f"# Battery Capacity: {self.capacity} Ah\n")
|
||||
self.current_cycle_file.write(f"# Test Current: {test_current:.3f} A (C/{1/self.c_rate:.1f})\n")
|
||||
self.current_cycle_file.write(f"# Charge Cutoff: {self.charge_cutoff} V\n")
|
||||
self.current_cycle_file.write(f"# Discharge Cutoff: {self.discharge_cutoff} V\n")
|
||||
self.current_cycle_file.write(f"# Rest Time: {self.rest_time} hours\n")
|
||||
self.current_cycle_file.write(f"# Test Conditions/Chemistry: {test_conditions}\n")
|
||||
self.current_cycle_file.write("#\n")
|
||||
|
||||
# Write data header
|
||||
self.log_writer = csv.writer(self.current_cycle_file)
|
||||
self.log_writer.writerow([
|
||||
"Time(s)", "Voltage(V)", "Current(A)", "Phase",
|
||||
@ -818,6 +843,24 @@ class BatteryTester(QMainWindow):
|
||||
if self.log_buffer:
|
||||
self.log_writer.writerows(self.log_buffer)
|
||||
self.log_buffer.clear()
|
||||
|
||||
# Write test summary
|
||||
test_current = self.c_rate * self.capacity
|
||||
test_conditions = self.test_conditions_input.text() if hasattr(self, 'test_conditions_input') else "N/A"
|
||||
|
||||
self.current_cycle_file.write("\n# TEST SUMMARY\n")
|
||||
self.current_cycle_file.write(f"# Test Parameters:\n")
|
||||
self.current_cycle_file.write(f"# - Battery Capacity: {self.capacity} Ah\n")
|
||||
self.current_cycle_file.write(f"# - Test Current: {test_current:.3f} A (C/{1/self.c_rate:.1f})\n")
|
||||
self.current_cycle_file.write(f"# - Charge Cutoff: {self.charge_cutoff} V\n")
|
||||
self.current_cycle_file.write(f"# - Discharge Cutoff: {self.discharge_cutoff} V\n")
|
||||
self.current_cycle_file.write(f"# - Test Conditions: {test_conditions}\n")
|
||||
self.current_cycle_file.write(f"# Results:\n")
|
||||
self.current_cycle_file.write(f"# - Cycles Completed: {self.cycle_count}\n")
|
||||
self.current_cycle_file.write(f"# - Final Discharge Capacity: {self.capacity_ah:.4f} Ah\n")
|
||||
self.current_cycle_file.write(f"# - Final Charge Capacity: {self.charge_capacity:.4f} Ah\n")
|
||||
self.current_cycle_file.write(f"# - Coulombic Efficiency: {self.coulomb_efficiency:.1f}%\n")
|
||||
|
||||
self.current_cycle_file.close()
|
||||
except Exception as e:
|
||||
print(f"Error closing log file: {e}")
|
||||
@ -839,8 +882,16 @@ class BatteryTester(QMainWindow):
|
||||
self,
|
||||
"Test Completed",
|
||||
f"Test was safely stopped after discharge phase.\n\n"
|
||||
f"Final discharge capacity: {self.capacity_ah:.3f}Ah\n"
|
||||
f"Total cycles completed: {self.cycle_count}"
|
||||
f"Test Parameters:\n"
|
||||
f"- Capacity: {self.capacity} Ah\n"
|
||||
f"- Current: {test_current:.3f} A (C/{1/self.c_rate:.1f})\n"
|
||||
f"- Charge Cutoff: {self.charge_cutoff} V\n"
|
||||
f"- Discharge Cutoff: {self.discharge_cutoff} V\n"
|
||||
f"- Conditions: {test_conditions}\n\n"
|
||||
f"Results:\n"
|
||||
f"- Cycles: {self.cycle_count}\n"
|
||||
f"- Discharge capacity: {self.capacity_ah:.3f}Ah\n"
|
||||
f"- Coulombic efficiency: {self.coulomb_efficiency:.1f}%"
|
||||
)
|
||||
|
||||
def reset_plot(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user