Ce code a été créé pour rendre l'alimentation programmable utilisable dans les tâches d'automatisation. Siglent fournit des logiciels natifs, mais il a beaucoup de dépendances et est lourd à utiliser. Le code Python permet également de contrôler l'instrument à partir d'ordinateurs à carte unique comme Raspberry Pi!
Lien du fabricant

Il s'agit d'un fichier API principal pour interagir avec l'instrument d'alimentation Siglent. Testé avec SPD3303X . Il fournit un moyen pythoniste simple de faire fonctionner à distance l'instrument et d'automatiser certaines mesures.
Malgré le fait que Siglent fabrique des instruments abordables, il y a certains problèmes. Je ne peux pas parler d'autres alimentations, mais SPD3303X a des défauts énumérés ci-dessous:
Ce code démontre la simplicité d'utilisation.
import siglent_psu_api as siglent
s = siglent.SIGLENT_PSU("192.168.0.22")
# read instrument identification string
i = s.identify()
print(i)
# read instrument status
sys = s.system()
print(sys)
# Set output mode
#s.track(siglent.TRACK.INDEPENDENT)
# switch on CH1
s.output(siglent.CHANNEL.CH1, siglent.STATE.ON)
# set CH1 voltage to 2V
s.set(siglent.CHANNEL.CH1, siglent.PARAMETER.VOLTAGE, 2.0)
# read voltage
r = s.measure(ch = siglent.CHANNEL.CH1, parameter = siglent.PARAMETER.VOLTAGE)
print(r)
Résultats
{'manufacturer': 'Siglent Technologies', 'model': 'SPD3303X', 'sn': 'SPD3XHBX2R****', 'firmware_ver': '1.01.01.02.05', 'hadrware_ver': 'V3.0'}
{'ch1_mode': <MODE.CC: 2>, 'ch2_mode': <MODE.CC: 2>, 'mode': <TRACK.INDEPENDENT: 0>, 'ch1': <STATE.ON: 1>, 'ch2': <STATE.OFF: 0>}
2.001
import siglent_psu_api as siglent
import numpy as np
s = siglent.SIGLENT_PSU("192.168.0.22")
# read instrument identification string
i = s.identify()
print(i)
# read instrument status
sys = s.system()
print(sys)
# switch on CH1
s.output(siglent.CHANNEL.CH1, siglent.STATE.ON)
# sweep specified range
range_min = 1
range_max = 5
range_step = 0.1
ra = np.arange(range_min, range_max, range_step)
for i in ra:
s.set(siglent.CHANNEL.CH1, siglent.PARAMETER.VOLTAGE, i)
r = s.measure(ch = siglent.CHANNEL.CH1, parameter = siglent.PARAMETER.POWER)
print(r)
Résultats
{'manufacturer': 'Siglent Technologies', 'model': 'SPD3303X', 'sn': 'SPD3XHBX2R****', 'firmware_ver': '1.01.01.02.05', 'hadrware_ver': 'V3.0'}
{'ch1_mode': <MODE.CC: 2>, 'ch2_mode': <MODE.CC: 2>, 'mode': <TRACK.INDEPENDENT: 0>, 'ch1': <STATE.ON: 1>, 'ch2': <STATE.OFF: 0>}
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.672
0.698
0.652
0.632
0.527
0.629
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0