简体   繁体   English

为什么我的 Keysight PS 上没有设置电压? 通过 python 中的 SCPI 发送的命令

[英]Why is the voltage not set on my Keysight PS? Commands sended via SCPI in python

I am trying to set and measure the output voltage of a Keysight N6701A power supply using Python and SCPI commands.我正在尝试使用 Python 和 SCPI 命令设置和测量 Keysight N6701A 电源的 output 电压。 In the console, I can see that the commands are sent successfully, but it also tells me that the voltage is still 0.在控制台中,我可以看到命令发送成功,但它也告诉我电压仍然为 0。

The code:编码:

import pyvisa
import visa
import time

rm = visa.ResourceManager()
print(rm.list_resources())
my_instrument = rm.open_resource('USB0::0x0957::0x0C07::MY54005240::INSTR')
#input()
print(my_instrument.query('*IDN?'))
time.sleep(1)
print(my_instrument.write("VOLT:LEV 4, (@1)"))
time.sleep(1)
print(my_instrument.write("VOLT:LEV 4, (@2)"))
time.sleep(1)
for i in range (0, 5):
    print("Channel 1: " + str(my_instrument.query_ascii_values("MEAS:VOLT? (@1)")))
    print("Channel 2: " + str(my_instrument.query_ascii_values("MEAS:VOLT? (@2)")))

Console logs:控制台日志:

PS C:\Users\pfra\Desktop\01_Dev\Keysight_UI_Python> & python c:/Users/pfra/Desktop/01_Dev/Keysight_UI_Python/CalibrationScript.py
('USB0::0x0957::0x0C07::MY54005240::INSTR', 'TCPIP0::A-N6950A-00114.local::inst0::INSTR', 'TCPIP0::A-N6950A-00115.local::inst0::INSTR', 'TCPIP0::A-N6950A-00116.local::inst0::INSTR', 'TCPIP0::A-N6950A-00117.local::inst0::INSTR', 'TCPIP0::smbv100a257607::hislip0::INSTR', 'TCPIP0::smbv100a257607::inst0::INSTR', 'TCPIP0::smbv100a260402::hislip0::INSTR', 'TCPIP0::smbv100a260402::inst0::INSTR', 'ASRL1::INSTR', 'ASRL3::INSTR')
Agilent Technologies,N6701A,MY54005240,D.04.08

(18, <StatusCode.success: 0>)
(18, <StatusCode.success: 0>)
Channel 1: [-0.001918833]
Channel 2: [-0.0004460463]
Channel 1: [-0.001917686]
Channel 2: [-0.000448439]
Channel 1: [-0.001880813]
Channel 2: [-0.0004386235]
Channel 1: [-0.001835363]
Channel 2: [-0.0004804141]
Channel 1: [-0.001857561]
Channel 2: [-0.0004568406]

I checked the forum and consulted the programmers reference guide, but in my opinion it should work the way I am trying it.我查看了论坛并查阅了程序员参考指南,但我认为它应该按照我尝试的方式工作。 Does someone have an idea what could be wrong?有人知道可能出了什么问题吗? Thank you very much and kind regards!非常感谢和亲切的问候!

I figured it out... I did not turn on the output -.-我想通了...我没有打开output -.-

The command should be like:命令应该是这样的:

print(my_instrument.write("OUTPut ON, (@1);VOLT:LEV 4,(@1)"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM