完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我们正在用Python编写一个代码来控制DS0X-3024A自动进行电源轨噪声测量,并在USB中保存快照。
主要功能:设置通道参数,如直流耦合,50欧姆输入,等等。正确设置每个通道偏移,因此,电源噪声将显示在前3个分区(满分为8个)中启用FFT并在接下来的2或3中显示FFT 部门启用统计数据统计数据达到500后拍摄快照。 为每个频道执行此操作。 我的程序正在*正常工作以获得更低的统计数据,最多100个*,但当我等待统计数据达到500时,则此错误即将发生... * VisaIOError:VI_ERROR_CONN_LOST(-1073807194):给定会话的连接已被 丢失*。 以上来自于谷歌翻译 以下为原文 Hi, we are writing a code in Python to Control DS0X-3024A to do Power rail noise measurement automatically, and save a snapshot in USB. Main functions: Setting Channel Parameters like DC coupling,50 Ohms Input,..etc Properly setting every channel Offset, so, that Power noise will be shown on Top 3 divisions ( Out of 8) Enabling FFT and displaying FFT in next 2 or 3 divisions Enabling statistics Once statistics reached 500 taking a snapshot. Doing this for every channel. My program is *working properly for lower Statistics counts up to 100,* But when i am waiting up to statistics reach 500, Then this erroris coming... *VisaIOError: VI_ERROR_CONN_LOST(-1073807194): The connection for the given session has been lost*. 附件 |
|
相关推荐
6个回答
|
|
你可以分享我们可以用来重现问题的代码片段吗?
另外,你使用的是什么版本的PyVISA? 您安装了哪个版本的Keysight IO Libraries Suite? 什么版本的NI-VISA(与NI-MAX版本号不同)? 以上来自于谷歌翻译 以下为原文 Can you share a snippet of your code that we can use to reproduce the issue? Also, what version of PyVISA are you using? What version of the Keysight IO Libraries Suite do you have installed? What version of NI-VISA (not the same as the NI-MAX version number)? |
|
|
|
MAX_zuo 发表于 2018-10-25 14:46 这是代码的一部分。 在它之前很少有初始化。 dsoObj是ResourceManager的get_instrument()函数返回的DSO对象。 .................................................. .................................................. ............... for j in range(1,3):if bwlimit == 0:print“Processing with FULL Bandwidth”else:print“Processing with 20Mhz BW”dsoObj.write (“%s:BWLimit%d”%(currChannelStr,bwlimit)); #显示值##显示测量值dsoObj.write(“MEASure:SOURce%s”%currChannelStr)dsoObj.write(“MEASure:CLEar”)dsoObj.write(“MEASure:VPP%s”%currChannelStr)dsoObj.write (“MEASure:VMAX%s”%currChannelStr)dsoObj.write(“MEASure:VAVerage CYCLe,%s”%currChannelStr)#dsoObj.write(“MEASure:FREQuency CHANnel1”)dsoObj.write(“MEASure:XMAX MATH”) dsoObj.write('SYSTem:MENU MEASURE'); dsoObj.write('MEASure:STATistics ON')dsoObj.write(“MEASure:STATistics:DISPlay ON”); dsoObj.write('MEASure:STATistics:RESEt')#dsoObj.write('MEASure:STATistics:DISP 1')dsoObj.write('MEAS:STAT:MCO 1000')#time.sleep(60); dsoObj.write(“MEAS:STAT COUNt”)count1 = dsoObj.ask_for_values(“MEAS:RES?”)count = min(count1); count = 0; print'Present Count Of Statistics',count while(count time.sleep(2); count = min(dsoObj.ask_for_values(“MEAS:RES?”))print“ - ”,count print'Count Exceeded - 500 .. .Proceed to Snapshot';#SAVE:PWD只能直接存在。它不能创建#a目录#SAVE:PWD#:: =引用ASCII字符串#应该用双引号“\ iden1 \ iden2 \ iden3 .... \“dsoObj.write('SAVE:PWD”\ u*** \ 01122014 \“')打印”保存目录“,”\ u*** \ 01122014 \“#:SAVE :IMAGe:FACTors命令控制示波器#因子是否随图像一起输出.dsoObj.write('SAVE:IMAGe:FACTors ON')#Image save format dsoObj.write('SAVE:IMAGe:FORMat BMP24bit')#dsoObj .write('SAVE:IMAGe:INKSaver 1')dsoObj.write('SAVE:IMAGe:PALette COLOR')#1729 - 由于我们无法显示偏移量,我们正在将#Trigger lelve配置为偏移量 显示在右上角newTrigLevel = dsoObj.ask_for_values(“%s:OFFSet?”%currChannelStr)[0]; dsoObj.write('TRIGger:SOURce%s'%curr ChannelStr); dsoObj.write('TRIGger:LEVEl%f'%newTrigLevel); #dsoObj.write(“TRIGger:LEVEl%f,%s”%(newTrigLevel,currChannelStr))time.sleep(2); fileSavename ='pos'+'20MhzBW'+ voltage_name; if bwlimit == 0:fileSavename ='pos'+'fullBW'+ voltage_name; #time.sleep(4); #DSO不会带文件名。 ,它只允许'_'fileSavename = fileSavename.replace('。','_'); dsoObj.write('SAVE:IMAGe“%s”'%fileSavename)time.sleep(2); #更改不同的TimeBases以获得不同的采样率,并为timeBaseReg中的temptimeBase获取多个#Images timeBaseReg = [timeBase / 2,timeBase / 4,timeBase / 8,timeBase / 16,timeBase / 40]:fileSavename = fileSavename +'e'; dsoObj.write(“:TIMebase:SCALe%f”%temptimeBase); time.sleep(4); dsoObj.write('SAVE:IMAGe“%s”'%fileSavename)time.sleep(4); #重置TimeBase为400us / div timeBase = 400 * pow(10,-6); dsoObj.write(“:TIMebase:SCALe%f”%timeBase); time.sleep(3); #Internal for LOOP LIMIT bwlimit + = 1; #启用BWEdited:malli_1729于2014年12月11日下午10:58 以上来自于谷歌翻译 以下为原文 Here is the part of the code. Before it are few initialisations. dsoObj is DSO Object returned by get_instrument() function of ResourceManager. ................................................................................................................... for j in range(1,3): if bwlimit==0: print " Processing with FULL Bandwidth" else: print " Processing with 20Mhz BW" dsoObj.write("%s:BWLimit %d"%(currChannelStr,bwlimit)); # Displaying the values ## Displaying the measurements dsoObj.write("MEASure:SOURce %s"%currChannelStr) dsoObj.write("MEASure:CLEar") dsoObj.write("MEASure:VPP %s"%currChannelStr) dsoObj.write("MEASure:VMAX %s"%currChannelStr) dsoObj.write("MEASure:VAVerage CYCLe,%s"%currChannelStr) #dsoObj.write("MEASure:FREQuency CHANnel1") dsoObj.write("MEASure:XMAX MATH") dsoObj.write('SYSTem:MENU MEASURE'); dsoObj.write('MEASure:STATistics ON') dsoObj.write("MEASure:STATistics:DISPlay ON"); dsoObj.write('MEASure:STATistics:RESEt') # dsoObj.write('MEASure:STATistics:DISP 1') dsoObj.write('MEAS:STAT:MCO 1000') # time.sleep(60); dsoObj.write("MEAS:STAT COUNt") count1 = dsoObj.ask_for_values("MEAS:RES?") count = min(count1); count = 0; print 'Present Count Of Statistics',count while (count<500): time.sleep(2); count = min(dsoObj.ask_for_values("MEAS:RES?")) print "--",count print 'Count Exceeded - 500...Proceed to Snapshot'; # SAVE:PWD only goes to directly which is existing. it can't create # a directory # SAVE:PWD # ::= quoted ASCII string # Should be in double quotes " \iden1\iden2\iden3....\ " dsoObj.write('SAVE:PWD "\u***\01122014\"') print " Saving Directory","\u***\01122014\" # The :SAVE:IMAGe:FACTors command controls whether the oscilloscope # factors are output along with the image. dsoObj.write('SAVE:IMAGe:FACTors ON') # Image save Format dsoObj.write('SAVE:IMAGe:FORMat BMP24bit') #dsoObj.write('SAVE:IMAGe:INKSaver 1') dsoObj.write('SAVE:IMAGe:PALette COLor') # 1729 - As we can't able to display the offset, we are configuring the # Trigger lelve to the offset which is displayed on Upper Right Corner newTrigLevel = dsoObj.ask_for_values("%s:OFFSet?"%currChannelStr)[0]; dsoObj.write('TRIGger:SOURce %s'%currChannelStr); dsoObj.write('TRIGger:LEVEl %f'%newTrigLevel); #dsoObj.write("TRIGger:LEVEl %f, %s"%(newTrigLevel,currChannelStr)) time.sleep(2); fileSavename = 'pos'+'20MhzBW'+voltage_name; if bwlimit==0: fileSavename = 'pos'+'fullBW'+voltage_name; #time.sleep(4); # DSO will not take filenames with . , it only allow '_' fileSavename= fileSavename.replace('.','_'); dsoObj.write('SAVE:IMAGe "%s" '%fileSavename) time.sleep(2); # Change Different TimeBases to get Different Sampling rates and get multiple # Images timeBaseReg = [timeBase/2,timeBase/4, timeBase/8,timeBase/16, timeBase/40] for temptimeBase in timeBaseReg: fileSavename = fileSavename + 'e'; dsoObj.write(":TIMebase:SCALe %f"%temptimeBase); time.sleep(4); dsoObj.write('SAVE:IMAGe "%s" '%fileSavename) time.sleep(4); # Resetting TimeBase for 400us/div timeBase = 400*pow(10,-6); dsoObj.write(":TIMebase:SCALe %f"%timeBase); time.sleep(3); # Inner For LOOP LIMIT bwlimit += 1; # Enabling BW Edited by: malli_1729 on Dec 11, 2014 10:58 PM |
|
|
|
曹志静1314 发表于 2018-10-25 14:57 嗨..有任何线索..........我不认为代码有任何问题。 在“While(计算第二个我从ResourceManager的get_instrument函数获取dsoOBj,如何关闭此会话可以像viClose();? 以上来自于谷歌翻译 以下为原文 hi.. Any clue on this..........I don't think code has any issue. in "While(count<500)" if we keep "while(count<100) this perfectly works....... 2nd i am gettingn dsoOBj from get_instrument function of ResourceManager, How Can this session can be closed like viClose();? |
|
|
|
曹志静1314 发表于 2018-10-25 15:15 任何帮助......? 线索...? 以上来自于谷歌翻译 以下为原文 Any help...? Clue...? |
|
|
|
从PyVISA文档(https://media.readthedocs.org/pdf/pyvisa/latest/pyvisa.pdf):询问与查询历史上,在PyVISA中使用方法ask进行写入然后进行读取。 但在许多其他程序中,此操作称为查询。 因此,我们决定切换名称,保留别名以帮助进行转换。 但是,ask_for_values没有别名为query_values,因为API不同。 ask_for_values仍然使用受限制和破坏的旧格式化API。 我们建议您将所有内容迁移到query_values。遗留API可能存在一些问题。 您是否尝试过使用query_values()而不是ask_for_values()? 以上来自于谷歌翻译 以下为原文 From the PyVISA documentation (https://media.readthedocs.org/pdf/pyvisa/latest/pyvisa.pdf): Ask vs. query Historically, the method ask has been used in PyVISA to do a write followed by a read. But in many other programs this operation is called query. Thereby we have decided to switch the name, keeping an alias to help with the transition. However, ask_for_values has not been aliased to query_values because the API is different. ask_for_values still uses the old formatting API which is limited and broken. We suggest that you migrate everything to query_values Perhaps the legacy API has some issue. Have you tried using query_values() instead of ask_for_values()? |
|
|
|
几个重要的更新.. 1.从PyVISA 1.5到PyVISA1.6超时单位从秒变为毫秒---->我需要将dsoObj.timeout更改为5000而不是5 --->此代码目前运行正常 2.对于PyVISA 1.5也uisng ask和ask_values,当我使用Python IDLE测试代码时,目前没有Connection Lost问题即将来临......但我仍在测试所有可能的场景...... 以上来自于谷歌翻译 以下为原文 Few important updates.. 1. from PyVISA 1.5 to PyVISA1.6 timeout units were changed from seconds to milliseconds ----> i need to change dsoObj.timeout to 5000 instead of 5 ---> with this code is presently running ok 2. for PyVISA 1.5 also uisng ask and ask_values, when i have tested the code using Python IDLE presently no Connection Lost issue is coming...... But still i am testing with all possible scenarios...... |
|
|
|
只有小组成员才能发言,加入小组>>
1226 浏览 0 评论
2348 浏览 1 评论
2159 浏览 1 评论
2024 浏览 5 评论
2905 浏览 3 评论
970浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
703浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
803浏览 0评论
1226浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 05:34 , Processed in 1.558967 second(s), Total 87, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号