D/A data acquisition and analysis method based on remote frequency spectrograph communication

文档序号:1566494 发布日期:2020-01-24 浏览:7次 中文

阅读说明:本技术 基于远程频谱仪通信的d/a数据采集分析方法 (D/A data acquisition and analysis method based on remote frequency spectrograph communication ) 是由 李继秀 孟真 田易 刘谋 钟燕清 张兴成 阎跃鹏 于 2019-10-29 设计创作,主要内容包括:本发明提供一种基于远程频谱仪通信的D/A数据采集分析方法,包括:采用上位机对嵌入式设备和频谱仪进行参数设置;所述嵌入式设备依据所述上位机设置的参数产生模拟信号并发送给频谱仪;所述上位机控制所述频谱仪在线采集所述模拟信号并进行分析。本发明基于远程频谱仪通信的D/A数据采集分析方法中,上位机通过与频谱仪进行通讯并控制频谱仪进行信号采集及在线数据分析,从而实现对产生的模拟信号的性能指标科学定量直观的测试和界面化显示。(The invention provides a D/A data acquisition and analysis method based on remote spectrometer communication, which comprises the following steps: setting parameters of the embedded equipment and the spectrometer by using an upper computer; the embedded equipment generates an analog signal according to the parameters set by the upper computer and sends the analog signal to the frequency spectrograph; and the upper computer controls the frequency spectrograph to collect and analyze the analog signals on line. In the D/A data acquisition and analysis method based on remote spectrometer communication, the upper computer communicates with the spectrometer and controls the spectrometer to acquire signals and analyze data on line, so that scientific, quantitative and visual testing and interface display of performance indexes of generated analog signals are realized.)

1. A D/A data acquisition and analysis method based on remote spectrometer communication is characterized by comprising the following steps: the method comprises the following steps:

setting parameters of the embedded equipment and the spectrometer by using an upper computer;

the embedded equipment generates an analog signal according to the parameters set by the upper computer and sends the analog signal to the frequency spectrograph;

and the upper computer controls the frequency spectrograph to collect and analyze the analog signals on line.

2. The remote spectrometer communication-based D/a data acquisition and analysis method as claimed in claim 1, wherein: and the parameters set for the embedded equipment by adopting the upper computer comprise frequency points and/or amplitudes.

3. The remote spectrometer communication-based D/a data acquisition and analysis method as claimed in claim 1, wherein: and the upper computer calls MATLAB to set parameters of the frequency spectrograph through Windows platform application program development software.

4. The remote spectrometer communication-based D/a data acquisition and analysis method of claim 3, wherein: the parameters set by the MATLAB to the spectrometer include one or more of the starting frequency, resolution, and level for that frequency or level.

5. The remote spectrometer communication-based D/a data acquisition and analysis method of claim 3, wherein: the MATLAB connection spectrometer process comprises:

the MATLAB establishes an m file, and a directory package where the m file is located

VISA _ instrument.m library file;

the MATLAB establishes connection with the frequency spectrograph and accesses a serial number of the frequency spectrograph;

initializing the frequency spectrograph by the MATLAB and setting parameters;

the MATLAB starts scanning the frequency spectrograph, and obtains scanning point power and converts the scanning point power into ASCii code values;

and the MATLAB calculates SNR and SFDR by using the ASCii code value of the scanning point power conversion, and acquires and stores a frequency spectrum picture of the spectrometer.

6. The remote spectrometer communication-based D/a data acquisition and analysis method as claimed in claim 1, wherein: the upper computer accesses an IO library VISA of the frequency spectrograph through VXI-11Protocol based on a TCP/IP communication Protocol.

7. The remote spectrometer communication-based D/a data acquisition and analysis method as claimed in claim 1, wherein: the communication of the upper computer accessing the VISA is based on an information synchronization mode, and the command architecture of the communication is short for Simple Commands for Programmable Instruments (SCPI).

8. The remote spectrometer communication-based D/a data acquisition and analysis method as claimed in claim 1, wherein: the embedded device sends the D/A data to the frequency spectrograph through a special data cable.

9. The remote spectrometer communication-based D/a data acquisition and analysis method as claimed in claim 1, wherein: the host is in communication connection with the frequency spectrograph through a network cable.

Technical Field

The invention relates to an analog signal online analysis technology, in particular to a D/A data acquisition and analysis method based on remote spectrometer communication.

Background

At present, data acquisition and analysis based on digital signals are performed, and performance analysis of analog signals can be performed only by means of manual setting and observation of external tools such as a frequency spectrograph, or by means of hardware and an additional A/D converter to generate digital signals, so that data acquisition and subsequent analysis are performed. This is not conducive to the realization of automated testing of analog signals, particularly for batch products, in real applications, and it is also difficult to directly quantify some performance indicators of analog signals in the products for evaluation and testing.

Disclosure of Invention

The D/A data acquisition and analysis method based on the remote spectrometer communication provided by the invention realizes the on-line quantitative evaluation and test of the analog signal.

The invention provides a D/A data acquisition and analysis method based on remote spectrometer communication, which comprises the following steps:

setting parameters of the embedded equipment and the spectrometer by using an upper computer;

the embedded equipment generates an analog signal according to the parameters set by the upper computer and sends the analog signal to the frequency spectrograph;

and the upper computer controls the frequency spectrograph to collect and analyze the analog signals on line.

Optionally, the parameters set for the embedded device by the upper computer include frequency points and/or amplitudes.

Optionally, the upper computer calls MATLAB to set the parameters of the spectrometer through Windows platform application program development software.

Optionally, the parameter set by the MATLAB on the spectrometer includes one or more of a start frequency, a resolution, a signal frequency, or a level.

Optionally, the MATLAB-connected spectrometer process includes:

the MATLAB establishes an m file, and a directory package VISA _ INSTRUMENT.M library file where the m file is located;

the MATLAB establishes connection with the frequency spectrograph and accesses a serial number of the frequency spectrograph;

initializing the frequency spectrograph by the MATLAB and setting parameters;

the MATLAB starts scanning the frequency spectrograph, and obtains scanning point power and converts the scanning point power into ASCii code values;

and the MATLAB calculates SNR and SFDR by using the ASCii code value of the scanning point power conversion, and acquires and stores a frequency spectrum picture of the spectrometer.

Optionally, the upper computer accesses an IO library VISA of the spectrometer through VXI-11Protocol based on a TCP/IP communication Protocol.

Optionally, the communication of the upper computer accessing the VISA is based on an information synchronization mode, and a command architecture of the communication is short for Simple Commands for Programmable Instruments (SCPI).

Optionally, the embedded device sends the D/a data to the spectrometer over a dedicated data cable.

Optionally, the host is in communication connection with the frequency spectrograph through a network cable.

In the D/A data acquisition and analysis method based on remote spectrometer communication, the upper computer communicates with the spectrometer and controls the spectrometer to acquire signals and analyze data on line, so that scientific, quantitative and visual testing and interface display of performance indexes of generated analog signals are realized.

Drawings

FIG. 1 is a block connection diagram of an upper computer, an embedded device and a frequency spectrograph in the remote frequency spectrograph communication-based D/A data acquisition and analysis method of the invention;

FIG. 2 is a diagram of the working flow of the method for collecting and analyzing D/A data based on remote spectrometer communication according to the present invention, in which the upper computer software calls MATLAB;

FIG. 3 is a flow chart of the MATLAB remote spectrometer communication work flow in the remote spectrometer communication-based D/A data acquisition and analysis method of the present invention;

fig. 4 is a display interface of the spectrometer captured in the D/a data acquisition and analysis method based on remote spectrometer communication according to the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

As shown in fig. 1 to 4, the present embodiment provides a D/a data acquisition and analysis method based on remote spectrometer communication, the method including:

setting parameters of the embedded equipment and the spectrometer by using an upper computer;

optionally, the upper computer sets the frequency point, the amplitude and the like of the embedded device through the serial port, and after the setting is successful, the embedded device sends an effective analog signal to the frequency spectrograph;

optionally, the upper computer remote frequency spectrograph communication is remote communication to the frequency spectrograph by invoking MATLAB through Windows platform application development software, where the remote communication includes: the MATLAB call is initialized, and parameters are set as follows: the method comprises the following steps of (1) calling MATLAB to be remotely connected with a frequency spectrograph at an initial frequency, a resolution, a signal frequency, a level and the like;

the embedded equipment generates an analog signal according to the parameters set by the upper computer and sends the analog signal to the frequency spectrograph;

and the upper computer controls the frequency spectrograph to collect and analyze the analog signals on line.

Optionally, the MATLAB-connected spectrometer process includes:

the MATLAB establishes an m file, and a directory package VISA _ INSTRUMENT.M library file where the m file is located;

the MATLAB establishes connection with the frequency spectrograph and accesses a serial number of the frequency spectrograph;

initializing the frequency spectrograph by the MATLAB and setting parameters;

the MATLAB starts scanning the frequency spectrograph, and obtains scanning point power and converts the scanning point power into ASCii code values;

and the MATLAB calculates SNR and SFDR by using the ASCii code value of the scanning point power conversion, and acquires and stores a frequency spectrum picture of the spectrometer.

Optionally, the upper computer accesses an IO library VISA of the spectrometer through VXI-11Protocol based on a TCP/IP communication Protocol.

Optionally, the communication of the upper computer accessing the VISA is based on an information synchronization mode, and a command architecture of the communication is short for Simple Commands for Programmable Instruments (SCPI).

Optionally, the embedded device sends the D/a data to the spectrometer over a dedicated data cable.

Optionally, the host is in communication connection with the frequency spectrograph through a network cable.

The method is implemented by the following specific processes:

step 1: the host computer sets the frequency point, amplitude and the like of the embedded equipment through the serial port;

step 2: the embedded equipment completes the setting and sends an effective analog signal to the frequency spectrograph

And step 3: the upper computer software starts an MATLAB engine through dynamic library linkage; initializing MATLAB calling; setting MATLAB calling parameters, such as: initial frequency, resolution, criticizing, collected signal frequency, collected points and the like; a MATLAB remote spectrometer is invoked.

In this step, the process of the Windows platform application development software calling MATLAB is realized by software, and the specific implementation process is as follows:

3-1) MATLAB generates DLL file through Windows platform application program development software compiler

Setting compiler

Mex-setup Windows platform application program development software compiler for compiling files

Generating DLL files

MCC–W CPPLIB:MYLIB–T LINK:LIB MY.M

Under the file directory, MYLIB.lib, MYLIB.dll, MYLIB.h are generated

3-2) Windows platform application development software calls MATLAB

Firstly, copying the three files generated in the step 3-1) to a current Windows platform application program development software engineering directory.

Setting a Windows platform application program development software path:

the header file path needs to INCLUDE the current engineering path and the INCLUDE path under the Bin of MATLAB; the library function path needs to comprise a current engineering path and an LIB path of an MATLAB; in addition, five library files are required to be added into the current engineering link, wherein four of the five library files are MATLAB library files, mclmcr.lib, mclmcrt.lib, libmat.lib and libmx.lib; the other is the library file generated in 3-1).

The code link library file adopts the following mode:

#pragma comment(lib,"mclmcrrt.lib")

#pragma comment(lib,"libmx.lib")

#pragma comment(lib,"libmat.lib")

#pragma comment(lib,"mclmcr.lib")

the MATLAB call is initialized in the following way:

libvc_matlab_fswInitialize()

setting parameters and calling an MATLAB remote frequency spectrograph:

mwArray startFrq (1,1, mxDOUBLE _ CLASS); creating a starting frequency array

mwArray stopFrq (1,1, mxDOUBLE _ CLASS); creating termination frequency arrays

startfrq. setdata (& (stafrq), 1); initial frequency assignment

stopfrq. setdata (& (stpfrq), 1); terminating frequency assignment

vc _ matlab _ fsw (startFrq, stopFrq, varef, stringTemp, brbw, bvbw, vaSapoint); invoking MATLAB for communication

End MATLAB Call

libvc_matlab_fswTerminate();

mclTerminateApplication();

And 4, step 4: MATLAB starts remote connection frequency spectrograph

And 5: MATLAB Access Spectroscopy Serial number

Step 6: spectrometer reply serial number

And 7: after the MATLAB receives the serial number, initializing the frequency spectrograph

And 8: parameter setting of MATLAB to spectrometer

And step 9: MATLAB enabled scanning of a spectrometer

Step 10: MATLAB obtains scanning point power and converts into ASCii code value

Step 11: MATLAB calculates SNR and SFDR by using scanning points, and graphically displays

Step 12: and obtaining and storing a frequency spectrum picture of the frequency spectrograph by the MATLAB.

In the above steps 4-12, the connection between the MATLAB and the spectrometer is implemented by software, and the following is a specific embodiment:

the software version information is as follows:

MATLAB 2014a

VISA IO library 15.5

Windows XP

the communication connection mode and the protocol information are as follows:

using LAN physical network connections

The communication protocol is TCP/IP protocol

The Protocol for accessing VISA library is VXI-11Protocol

The communication instruction structure is SCPI (short for Simple Commands for Programmmable instruments)

Remote communication

Setting an upper computer and a frequency spectrograph in a local area network frequency band;

the MATLAB establishes m files and the directory thereof must contain VISA _ INSTRUMENT. M library files

Remote connection

specan=VISA_Instrument(['TCPIP::',ip,'::INSTR'])

The IP address is the IP address of the spectrometer, the specan is the handle returned after the connection is successful, and if the connection is unsuccessful, the connection is 0 and an error is reported.

Access spectrometer serial number

idnResponse=specan.QueryString('*IDN?');

This is a command with a return value, the SCPI command is divided into two types: one is to execute only without return, and the other is to execute with a return value. The statement returns the sequence value of the spectrometer

Initialization of a spectrometer

Initialization includes zeroing, resetting, and some other initial settings

Write (' RST; ' CLS '); resetting the spectrometer to clear error queues

Write ('INIT: CONT OFF'); close continuous scanning (continius sweep)

Write ('SYST: DISP: UPD ON'); initiating update settings

Errorchecking (); checking whether an error is generated after initialization

Parameter setting for a spectrometer

Write ('FREQ: START% 0.9f', startfrq); setting the starting frequency

Write ('FREQ: STOP% 0.9f', stopfrq); setting the stop frequency

Write ('BAND% f', rbw); setting resolution RBW

Write ('DISP: WIND: TRAC: Y: RLEV% 0.2f', ref); setting a reference level

Write ('SWE: POIN% d', swpoint); setting the number of scanning points

Errorchecking (); checking whether an error is generated after parameter setting

Initiating a scan

specan.Write('INIT');

Acquiring scanning point power and converting the scanning point power into ASCii code value

traceASC=specan.QueryASCII_ListOfDoubles('FORM ASC;:TRAC? TRACE1',sweepPoints);

Calculating SNR and SFDR by using scanning point

10 < SP > (traceASC/10); conversion to raw power value

Ps ═ sum (specp (F _ in-span: F _ in + span)); calculating signal power value

p-sum (spectp (10: stopfrq)); calculating full frequency band power value

Pc=max(max(traceASC(10:F_in-span)),max(traceASC(F_in+span:N)));

SFDR=max_dB-Pc;

Pn=p-Ps;

SNR=10*log10(Ps/Pn);

Acquiring and storing frequency spectrum picture of frequency spectrograph

specan.Write('HCOP:DEV:LANG

PNG; MMEM: NAME "c: \ Temp \ Device _ Screen.png'; setting screen copy

Write ('HCOP: IMM'); screen copy

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种新能源柔性直流并网暂态谐波检测方法及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!