是德科技
直播中

田晴

8年用户 169经验值
私信 关注
[问答]

怎么从Vector NA hp8722D远程获取数据

嗨!
我写了一个matlab程序来远程从VNA获取S参数。
是否可以从网络分析仪获取数据为。* S2P格式?
是否有任何命令列表进行此类编程?
谢谢。

以上来自于谷歌翻译


     以下为原文

  Hi!

I wrote a matlab Programm to remotely get the S-Parameter from the VNA. is it possible to get the Data as .*S2P format from the network analyzer?
  
is there any command List to make such programming?

Thank you.  

回帖(9)

李青

2019-4-24 14:15:05
> {quote:title = hfler写道:} {quote}>嗨!
>>我写了一个matlab程序来远程从VNA获取S参数。
是否可以从网络分析仪获取数据为。* S2P格式?
没有。是否有任何命令列表进行这样的编程?
有一个8722D的编程手册,您可以从安捷伦网站下载该手册。
没有命令直接从8722D获取touchstone文件。
由于您已经拥有了获取S参数的代码,因此将其转换为touchstone文件非常简单。
如果你看一下.s2p文件的Touchstone规范http://www.eda.org/pub/ibis/connector/touchstone_spec11.pdf,它非常简单。
我向你指出1.1草案规范。
有一个2.0已经达成一致,但我认为草案格式比更新格式更多。
看看下面这个。
这是我为8720D(2022版本的8722D)编写的Touchstone文件的开头。
以感叹号开头的每一行都是注释,因此不需要。
我把它们放在一起,因为我觉得它们对我有用 - 不是因为它们是必要的。
您需要的唯一线路是以****开头的线路。
#MHz S DB R 50和9列数据,由空格隔开。
事实上,从****开始的行可以简化。
默认情况下假定为“R 50”。
(这个论坛似乎不支持****字符,除非它被转义,所以我已经这样做了。为了避免任何混淆,我附上了我创建的文件。如果你想要* C *代码我曾经
得到这些数据我可以给你。但我写的从8720D获取数据的整个代码都是为Unix系统编写的,并假设是National Instruments GPIB板。我没有使用MATLAB,Labview或类似的但只是写了
在阅读编程手册的基础上编写自己的C代码。如果你只看一下HP编程手册,你就不会感到困惑了。我用粗体添加了我用来获得前9行的GPIB命令,但正如我所说,
这不是实际需要的。!这是一个试金石格式文件。!它应该以.s2p扩展名保存!HEWLETT PACKARD,8720D,0,7.74 * IDN?*!日期= 2013年1月22日* READDATE *!时间= 20
:43:52 * READTIME *!启动频率= 0.050000000 GHz * START?*!停止频率= 6.000000000 GHz * STOP?*!IF带宽= 300 Hz * IFBW?*!Averaging = ON * AVER
哦?*!
平均因子= 4 * AVERFACT?*!
端口扩展= OFF * PORE?*!
端口扩展1 = 0.000000 ps!
端口扩展2 = 0.000000 ps!
积分= 1601!
校准套件=用户自定义!
校准=全2端口!
freq magS11 angS11 magS21 angS21 magS12 angS12 magS22 angS22!
记录形式的大小!
角度为度#MHz S DB R 50 50 -54.7578 -38.0391 -19.9482 -3.05701 -19.9355 -3.04468 -54.0156 -11.9438 53.7188 -53.9004 -27.2373 -19.9219 -3.19849 -19.9219 -3.2959 -52.7207 -12.2417 57.4375 -52.9434 -29.2256
-19.9248 -3.34265 -19.9209 -3.46069 -52.6055 -12.7515 61.1562 -52.5938 -27.0869 -19.9209 -3.71887 -19.9199 -3.7533 -52.2812 -8.5625 64.875 -52.5664 -22.415 -19.9346 -3.80676 -19.9375 -3.90979 -52.709 -7.354 68.5938 -51.9395 -
21.7559 -19.9287 -4.06787 -19.9463 -4.23804 -52.3848 -5.18701 DaveEdited:drkirkby on February 6,2013 12:04 AM

以上来自于谷歌翻译


     以下为原文

  > {quote:title=hfler wrote:}{quote}
> Hi!

> I wrote a matlab Programm to remotely get the S-Parameter from the VNA. is it possible to get the Data as .*S2P format from the network analyzer?

No.  

> is there any command List to make such programming?

There is a programming manual for the 8722D, which you should be able to download from the Agilent web site. There is no command to get a touchstone file directly from an 8722D. 

Since you already have the code to get the S-parameters, it is trivial to convert that into a touchstone file. If you look at the Touchstone specification for .s2p files 

http://www.eda.org/pub/ibis/connector/touchstone_spec11.pdf

it is *very* simple. I pointed you to the 1.1 draft specification. There is a 2.0 which has been agreed, but I think there is more support for the draft format than the updated one. 

Take a look at this below. This is the start of a Touchstone file I wrote for my 8720D (the 20 GHz version of  the 8722D). Every line starting with an exclamation mark is a comment, so is not needed. I put them since I thought they were useful to me - not because they are necessary. The only lines you need are one starting with a ****.

# MHz S DB R 50

and 9 columns of data which are sepparated by a space. In fact, that the line starting with the ****  could be simplified. The "R 50" is assumed by default. (This forum does not appear to support the **** character unless it is escaped, so I've done that. To avoid any confusion, I have attached the file I created. 

If you want the *C* code I used to get this data I can give it to you. But the whole code I wrote to get data from my 8720D is written for a Unix system, and assumes the National Instruments GPIB board. I did not use MATLAB, Labview or similar but just wrote the code myself in C based on reading the programming manual. It will be less confusing for you if you just look at the HP programming manual. 

I have added in bold the GPIB commands I used to get the first 9 lines, but as I say, none of this is actually required. 

! This is a touchstone format file. 
! It should be saved with .s2p extension 
! HEWLETT PACKARD,8720D,0,7.74               *IDN?*
! Date = 22 Jan 2013                                             *READDATE*
! Time = 20:43:52                                                   *READTIME*
! Start frequency = 0.050000000 GHz                 *START?*
! Stop frequency  = 6.000000000 GHz                *STOP?*
! IF bandwidth = 300 Hz                                         *IFBW?*
! Averaging = ON                                                    *AVERO?*
! Averaging factor = 4                                             *AVERFACT?*
! Port extensions = OFF                                         *PORE?*
! Port extension 1 = 0.000000 ps
! Port extension 2 = 0.000000 ps
! Points  = 1601
! Calibration kit = User-defined
! Calibration = Full 2-port
! freq magS11 angS11 magS21 angS21 magS12 angS12 magS22 angS22
! Magnitudes are in log form
! Angles are in degrees
# MHz S DB R 50
50 -54.7578 -38.0391 -19.9482 -3.05701 -19.9355 -3.04468 -54.0156 -11.9438
53.7188 -53.9004 -27.2373 -19.9219 -3.19849 -19.9219 -3.2959 -52.7207 -12.2417
57.4375 -52.9434 -29.2256 -19.9248 -3.34265 -19.9209 -3.46069 -52.6055 -12.7515
61.1562 -52.5938 -27.0869 -19.9209 -3.71887 -19.9199 -3.7533 -52.2812 -8.5625
64.875 -52.5664 -22.415 -19.9346 -3.80676 -19.9375 -3.90979 -52.709 -7.354
68.5938 -51.9395 -21.7559 -19.9287 -4.06787 -19.9463 -4.23804 -52.3848 -5.18701


Dave

Edited by: drkirkby on Feb 6, 2013 12:04 AM

附件

举报

田晴

2019-4-24 14:35:04
引用: 60user7 发表于 2019-4-24 20:05
> {quote:title = hfler写道:} {quote}>嗨!
>>我写了一个matlab程序来远程从VNA获取S参数。
是否可以从网络分析仪获取数据为。* S2P格式?

这非常有帮助。
谢谢。
我还有一个问题。
我想在运动下测量某些产品的S参数。
有没有办法测量多个扫描(3到4GHz,201点)。
我的意思是VNA应该测量一段时间(例如1分钟)。
你有没有想过VNA需要多少时间进行一次扫描(3GHz到4GHz 201点)?
如果你需要,我可以给你发送matlab代码。
我想在代码中构建一个循环。
但我不确定是否真的谢谢你的帮助

以上来自于谷歌翻译


     以下为原文

  it is very helpful . thank you.

i have one more question. I want to measure the S- parameter of some product under movment. is there any way to measure more than one sweep(3 to 4GHz, 201points). I mean the VNA should measure for a period of time (1 min for exemple).

do you have ny idea how much time does VNA need  to make one sweep (3GHz to 4GHz 201 points)?

I could send you the matlab code if you need it.

i thout about buildin a loop in the code. but i am not sure if is it true

thank you for your help
举报

田晴

2019-4-24 14:44:56
引用: nnmnnm 发表于 2019-4-24 20:25
这非常有帮助。
谢谢。
我还有一个问题。

您好我写了这个matlab函数来获取网络分析仪的测量数据。
%function [varargout] = HP8722(varargin)g = instrfind('Type','gpib','BoardIndex',32,'PrimaryAddress',26,'Tag','');
if isempty(g)g = gpib('AGILENT',32,26);
否则fclose(g);
g = g(1);
结束g.inputbuffersize = 500000;
g.timeout = 300;
%连接到仪器对象obj1。
的fopen(克);
fprintf中的(g, 'STAR?');
sfreq = str2num(的fscanf(克));
fprintf中的(g, '停止?');
stfreq = str2num(的fscanf(克));
fprintf中的(g, 'POIN?');
NOF = str2num(的fscanf(克));
fprintf(g,'S21')fprintf(g,'chan1,smic')fprintf(g,'REST')fprintf(g,'OUTPFORM');
数据=的fread(克,2 * NOF + 1, '浮动');
data = [] data = [data(1:2:2 * nof-1)+ j * data(2:2:2 * nof)]。';
FREQ = sfreq:(stfreq-sfreq)/(NOF-1):stfreq;
fprintf(g,'OPC?,WAIT')varargout {1} = data;
varargout {2} =频率;
谢谢

以上来自于谷歌翻译


     以下为原文

  Hi i wrote this matlab function to get the measurement data fro the network analyzer. 


function [varargout]=HP8722(varargin)
g = instrfind('Type', 'gpib', 'BoardIndex', 32, 'PrimaryAddress', 26, 'Tag', '');
if isempty(g)
    g = gpib('AGILENT', 32, 26);
else
    fclose(g);
    g = g(1);
end
g.inputbuffersize=500000;
g.timeout=300;
% Connect to instrument object, obj1.
fopen(g);
fprintf(g,'STAR?');
sfreq=str2num(fscanf(g));
fprintf(g,'STOP?');
stfreq=str2num(fscanf(g));
fprintf(g,'POIN?'); 
nof=str2num(fscanf(g));
fprintf(g,'S21')
fprintf(g,'chan1,smic')
fprintf(g,'REST')
fprintf(g,'OUTPFORM');
data=fread(g,2*nof+1,'float');
data=[]
data=[data(1:2:2*nof-1)+j*data(2:2:2*nof)].';
freq=sfreq:(stfreq-sfreq)/(nof-1):stfreq; 
fprintf(g,'OPC?,WAIT')
varargout{1}=data;
varargout{2}=freq;

thank you
举报

李鑫赢

2019-4-24 15:00:36
引用: nnmnnm 发表于 2019-4-24 20:35
您好我写了这个matlab函数来获取网络分析仪的测量数据。
%function [varargout] = HP8722(varargin)g = instrfind('Type','gpib','BoardIndex',32,'PrimaryAddress',26,'Tag','');
if isempty(g)g = gpib('AGILENT',32,26);

在我打电话给你发布的最后一个Matlab函数的时候,我觉得你有8722继续扫描。
在这种情况下,您收集的数据可能是一次扫描的一部分,也可能是另一次扫描的一部分,因为当您的函数执行时,分析器可能处于扫描中。
我建议你更换这一行:fprintf(g,'REST');
有了这个(如果我正确地解释了Matlab语法,我通常不用Matlab编程):fprintf(g,'OPC ?; SING');
的fscanf(克);
这将确保分析仪在为您输出数据时进行单次扫描并保持扫描状态。
如果你希望你的功能让分析仪连续扫描,我想你会在你的功能结束时添加这一行:fprintf(g,'CONT');

以上来自于谷歌翻译


     以下为原文

  It looks to me like you have your 8722 continuing to sweep while you call that last Matlab function you posted.  In that case, the data you are gathering could be part from one sweep and part from another because the analyzer may be in mid-sweep when your function executes.  I would recommend you replace this line:

fprintf(g,'REST');

with this (if I am interpreting the Matlab syntax correctly, I don't normally program in Matlab):

fprintf(g,'OPC?;SING'); 
fscanf(g);

That will ensure the analyzer takes a single sweep and holds from sweeping while it outputs the data for you.  If you want your function to leave the analyzer continuous sweeping, I think you'd add this line at the end of your function:

fprintf(g,'CONT');
举报

更多回帖

发帖
×
20
完善资料,
赚取积分