异步机空载试验的虚拟仪器系统
本系统的软件是在LabWindows/CVI开发平台下实现。
数据采集是采用DAQ数据采集卡,采集通道通过daq::s!(i:j)格式确定,下面的程序为采集程序的部分:
char DaqStr34A[20] = “daq::1!(0:5)”;
char DaqStr34B[20] = “daq::1!(6:11)”;
SetCtrlAttribute (hMainPanel, PANEL_ReadData, ATTR_DIMMED, 1);
strcpy(channelStringA, DaqStr34A); //设置采样通道
strcpy(channelStringB, DaqStr34B);
GetCtrlVal (hMainPanel, PANEL_numCyc, &numCyc);
numChannels=6; numScans=64;
rate=50*numScans;
DataCount= numScans * numCyc;
iTestedWaveform = (double *) malloc (DataCount * numChannels * sizeof (double));
iLoadWaveform = (double *) malloc (DataCount * numChannels * sizeof (double));
err = nidaqAIScanOp (channelStringA, numScans * numCyc, rate, upper,
lower, kNidaqGroupByChannel, & actualRate, iTestedWaveform);
err=nidaqAIScanOp (channelStringB, numScans * numCyc, rate, upper, lower,
kNidaqGroupByChannel, & actualRate, iLoadWaveform);
采集的每一点的电压电流每相值用Labwindows/CVI库自带的RMS函数进行有效值计算,再通过Mean函数计算出平均值,求取每一相的功率值。从上述仪表中可以将试验采集的数据记录保存。
Kp = 0;
for (index = 0; index 《 numChannels*numCyc; index++){
Copy1D (&iTestedWaveform[Kp*numScans], numScans, Upek[index]);
RMS ( Upek[index], numScans, & Up[index] ); //有效值计算
++Kp; //Upek:试验原始数据(行:numchannels*numcyc,列:numScans)