Files
spd3303x-e-control-test/transient_test.py
David Rice 450faaf951 Updated
2025-12-11 10:00:13 +00:00

93 lines
2.4 KiB
Python

#!/user/bin/env python3
"""
WAY 6X Supercap Test App - way_6x_supercap_test_app.py
- ENTRY POINT OF APPLICATION
VERSION: 1.0
AUTHOR: D. RICE 20/06/2024
© 2024 FLOWBIRD TRANSPORT
"""
# Imports
import pyvisa
import time
import sys
# Global variables
setup_del = 0.2 # Setup delay in seconds
meas_del = 0.05 # Measure delay in seconds
psu_on_trigger_flag = False
psu_off_trigger_flag = False
psu_on_trigger_target = 30
psu_off_trigger_target = 10
psu_toggle_flag = False
psu_voltage = 24.0
psu_current = 3.0
VISA_ADDRESS = "TCPIP::192.168.45.3::INSTR"
rm = pyvisa.ResourceManager()
SPD = rm.open_resource(
VISA_ADDRESS,
write_termination='\n',
read_termination='\n'
)
def main():
global SPD
global setup_del
global psu_on_trigger_flag
global psu_off_trigger_flag
global psu_on_trigger_target
global psu_off_trigger_target
global psu_toggle_flag
global psu_voltage
global psu_current
SPD.write('CH1:VOLT ' + str(psu_voltage)) # Send power supply source voltage
SPD.write('CH1:CURR ' + str(psu_current)) # Send power supply current limit
# Enable power supply output source
SPD.write('OUTP CH1,ON') # Enable supply output
print("TEST STARTED:- VOLTAGE: " + str(psu_voltage) + " | CURRENT: " + str(psu_current))
print("WAITING...")
time.sleep(2)
psu_voltage = 0.0
for counter in range (10):
print("RAMP #" + str(counter + 1) + " | VOLTAGE: " + str(psu_voltage))
SPD.write('CH1:VOLT ' + str(psu_voltage)) # Send power supply source voltage
#time.sleep(setup_del)
psu_voltage = 24.0
print("RAMP #" + str(counter + 1) + " | VOLTAGE: " + str(psu_voltage))
SPD.write('CH1:VOLT ' + str(psu_voltage)) # Send power supply source voltage
#time.sleep(setup_del)
psu_voltage = 0.0
print("RAMP #" + str(counter + 1) + " | VOLTAGE: " + str(psu_voltage))
SPD.write('CH1:VOLT ' + str(psu_voltage)) # Send power supply source voltage
time.sleep(0.25)
psu_voltage = 24.0
print("RAMP #" + str(counter + 1) + " | VOLTAGE: " + str(psu_voltage))
SPD.write('CH1:VOLT ' + str(psu_voltage)) # Send power supply source voltage
psu_voltage = 0.0
time.sleep(0.5)
print("TEST FINISHED...")
SPD.close()
# Run main
if __name__ == "__main__":
try:
main()
except (KeyboardInterrupt, SystemExit):
sys.exit()