完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
在过去,我创建并使用了一个简单的labview VI(后来内置于exe中),它连续采石并在图表上绘制了我用HP66312A电源供电的设备所消耗的电流消耗。
在解决开机故障等问题时,此工具可用于识别问题。附件1是我的Labview程序框图的屏幕截图。 当我运行它时,输出看起来像附加2.我试图将此应用程序转换为纯C#应用程序。 我能够使用安捷伦命令专家来构建我需要的命令并最终得到这个代码:(不是最优雅的代码,但请耐心等待,因为这是写入/读取电源的第一步)private void button1_Click (object sender,EventArgs e){foreach(chart1.Series中的var系列){series.Points.Clear(); 双重IMeasure; int Sample = 0; int Voltage = Convert.ToInt16(NVoltage.Value); int Current = Convert.ToInt16(NCurrent.Value); string GPIO = Convert.ToString(NGPIO.Value); Ag66xx v6612C =新Ag66xx(“GPIB0 ::”+ GPIO +“:: INSTR”); v6612C.SCPI.SOURce.CURRent.LEVel.IMMediate.AMPLitude.Command(Current,“A”); v6612C.SCPI.SOURce.VOLTage.LEVel.IMMediate.AMPLitude.Command(Voltage,“V”); v6612C.SCPI.OUTPut.STATe.Command(真); Ag66xxx v66312A =新Ag66xxx(“GPIB0 :: 1 :: INSTR”); Sample = Convert.ToInt16(NSpan.Value); for(int i = 1; i {v66312A.SCPI.MEASure.SCALar.CURRent.DC.Query(out IMeasure); chart1.Series [“Current”]。Points.AddXY(i,IMeasure);}}它使用了 给定时间由NSpan设置挖掘总线并将其存储在一个数组中然后将结果解析为图形。附件3是我的输出的样子。这很适合记录触发式样分析,但我希望能够做到 这个实时问题。我遇到的问题是我不知道如何使用C#连续采集电流并按照我使用Labview的方式实时绘制图表。每次我尝试使用while或do循环时 阅读当前,我的程序挂起。任何帮助将不胜感激。谢谢,attach2.png17.0 KBattached3.png49.2 KB 以上来自于谷歌翻译 以下为原文 In the past, I have created and used a simple Labview VI (later built in to an exe) that continuously quarry and chart on a graph the current consumption used by devices I power with my HP66312A power supply. This tool is useful in identifying an issue when troubleshooting power-on failures etc. attached1 is a screen shot of the Block diagram of my Labview program. When I run it, the output looks like attached 2. I am trying to convert this application to a pure C# application. I was able to use the Agilent Command Expert to build the commands I needed and ended up with this code: (not the most elegant code, but bear with me since this is a first pass at writing/reading the power supply) private void button1_Click(object sender, EventArgs e) { foreach (var series in chart1.Series) { series.Points.Clear(); } double IMeasure; int Sample = 0; int Voltage = Convert.ToInt16(NVoltage.Value); int Current = Convert.ToInt16(NCurrent.Value); string GPIO = Convert.ToString(NGPIO.Value); Ag66xx v6612C = new Ag66xx("GPIB0::"+ GPIO +"::INSTR"); v6612C.SCPI.SOURce.CURRent.LEVel.IMMediate.AMPLitude.Command(Current, "A"); v6612C.SCPI.SOURce.VOLTage.LEVel.IMMediate.AMPLitude.Command(Voltage, "V"); v6612C.SCPI.OUTPut.STATe.Command(true); Ag66xxx v66312A = new Ag66xxx("GPIB0::1::INSTR"); Sample = Convert.ToInt16(NSpan.Value); for (int i = 1; i < Sample; i++) { v66312A.SCPI.MEASure.SCALar.CURRent.DC.Query(out IMeasure); chart1.Series["Current"].Points.AddXY(i, IMeasure); } } It uses a given time set by NSpan to quarry the bus and store it in an array then it pars the results onto a graph. attached3 is what my output looks like. This works well to record a triggered style analysis, but I want to be able to do this in real time. The problem I have is that I don’t know how to use C# to continuously quarry the current and chart it in real time the way I do using Labview. every time I try to use a while or a do loop to read current, my program hangs. Any help will be much appreciated. Thanks, 附件
|
|
相关推荐
1个回答
|
|
嗨,由于某种原因,我没有看到你的附件。
如果你做一次迭代来做当前的查询(没有循环),你得到一个结果吗? 如果是这样,回读需要多长时间? 以上来自于谷歌翻译 以下为原文 Hi, I do not see your attachments for some reason. If you do a single iteration doing the current query (no looping), do you get a result? If so how long does it take to do the readback? |
|
|
|
只有小组成员才能发言,加入小组>>
1226 浏览 0 评论
2348 浏览 1 评论
2158 浏览 1 评论
2024 浏览 5 评论
2904 浏览 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-23 23:59 , Processed in 1.322187 second(s), Total 77, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号