本期帶來(lái)基于Matlab與LabVIEW聯(lián)合開(kāi)發(fā)的電機(jī)測(cè)試平臺(tái),LabVIEW是一款圖形化開(kāi)環(huán)設(shè)計(jì)軟件,可以實(shí)現(xiàn)VXI、串口、GPIBPXI等總線的通信,具有良好的通用性能,可以極大的縮短系統(tǒng)的研發(fā)時(shí)間,提高工作效率。本系統(tǒng)能實(shí)時(shí)采集電機(jī)在不同工況運(yùn)行下的各種參數(shù),對(duì)電機(jī)的電壓、電流、功率等進(jìn)行監(jiān)測(cè),實(shí)現(xiàn)對(duì)電機(jī)性能的檢測(cè)。LabVIEW通過(guò)SIT工具包調(diào)用來(lái)實(shí)現(xiàn)Matlab對(duì)電機(jī)啟動(dòng)的電流等信號(hào)進(jìn)行分析與處理。
1、系統(tǒng)構(gòu)成
系統(tǒng)基于虛擬儀器為核心的測(cè)試平臺(tái),其數(shù)據(jù)采集卡選用的是美國(guó)NI公司產(chǎn)品,并配以外圍電機(jī)驅(qū)動(dòng)電路如直流電機(jī)的供電電源控制、起動(dòng)大電路等部分,由程序來(lái)控制外圍驅(qū)動(dòng)電路以實(shí)現(xiàn)對(duì)電機(jī)的起動(dòng)和制動(dòng)控制。整個(gè)過(guò)程充分發(fā)揮了計(jì)算機(jī)在數(shù)據(jù)處理、顯示和存儲(chǔ)上的強(qiáng)大功能,使得整個(gè)測(cè)試系統(tǒng)的高效性得到了保證,極大提高了系統(tǒng)的靈活性。編程環(huán)境選擇LabVIEW編程語(yǔ)言,并結(jié)合Matlab對(duì)電機(jī)信號(hào)處理分析,充分利用二者的混合編程技術(shù),提高電機(jī)測(cè)試平臺(tái)的效率。
2、硬件系統(tǒng)設(shè)計(jì)
電機(jī)測(cè)試系統(tǒng)硬件主要包括為電機(jī)提供能量及驅(qū)動(dòng)的電機(jī)控制柜,用于測(cè)量電機(jī)功率信息的功率分析儀,兩電機(jī)間用于測(cè)量扭矩、電機(jī)轉(zhuǎn)速的扭矩傳感器,為系統(tǒng)降溫的水冷系統(tǒng)和用于測(cè)量水冷系統(tǒng)水溫的溫度采集卡,讀取系統(tǒng)數(shù)字信號(hào)及模擬信號(hào)的數(shù)據(jù)釆集卡。
3、軟件系統(tǒng)設(shè)計(jì)
利用LabVIEW良好的人機(jī)交互特性,將所需調(diào)用的參數(shù)和仿真信息全部顯示在界面上,以便實(shí)時(shí)觀測(cè)電機(jī)各參數(shù)檢測(cè)結(jié)果。
4、Matlab實(shí)時(shí)通訊
LabVIEW通過(guò)仿真接口工具包(SIT)可調(diào)用MATLAB/Simulink程序并能夠?qū)崿F(xiàn)同步通訊。安裝MATLAB、LabVIEW和仿真接口工具包SIT后打開(kāi)MATLAB,運(yùn)行edit MATLABrc,在打開(kāi)的MATLABrc 文件末尾添加:
addpath('C:\\Simulation InterfaceToolkit'); % 將SimilinkInterface Toolkit添加到Path中
NISIT_Add Paths;
NISITServer;
MATLAB,在命令窗口上會(huì)出現(xiàn)以下信息:
Starting the SIT Server on Port 6011
SIT Server started
打開(kāi)Simulink可以在Libraries找到NISIT Blocks 模塊。建立MATLAB與LabVIEW實(shí)時(shí)通訊主要分為兩個(gè)步驟,即指定模型路徑和控件與模型建立連接。
(1)指定MATLAB仿真路徑
打開(kāi)前面建立的LabVIEW控制界面,選擇工具下的SITConnection Manager, 進(jìn)入配置頁(yè)面。首先選擇Modeland Host選項(xiàng)卡,在Current Model中,指定Sinulink路徑
(2)控件與模塊建立連接
選擇Mappings選項(xiàng)卡,指定LabVIEW前面板中輸入控件、波形圖表與永磁同步電機(jī)矢量控制系統(tǒng)MATLAB/Simulink仿真模型模型的參數(shù)一一對(duì)應(yīng)。
%%%%%%%%%總體改變%%%%%%%
%%%% n 行波波數(shù)
%%%% u 定轉(zhuǎn)子動(dòng)摩擦系數(shù)
%%%% ke 摩擦材料的等效剛度
%%%% R 轉(zhuǎn)子等效半徑
%%%% Dz 軸向阻尼系數(shù)
%%%% Dr 轉(zhuǎn)子光電總阻尼
%%%% Fn 預(yù)壓力
%%%%電機(jī)工作頻率
%%%%行波波長(zhǎng)
%%%%%%%%%%總體改變%%%%%%%%
%%%%%%%%%%%%%%%%參數(shù)值
J17=9;
J18=0.2;
J19=2.6E+09;
J21=3.10E-03;
J25=9300;
J26=10;
J27=70000;
J29=0.00014;
J30=0.0005;
J20=1.5E-03;
J22=0.00000066675;
J23=0.000000142;
J24=0.0005;
J28=2*3.1415926*J27;
%%%%%%%%%%%%%%%%%參數(shù)值
gain0=J17/J21;
gain1=1/gain0;
gain2=gain0;
gain3=gain1;
gain4=2*J18*J19*J22;
gain5=2;
gain6=J17*J21;
gain7=1/J23;
gain8=J21/gain0/J28;
gain9=gain1;
gain10=60/3.1415926/2;
gain11=2*J17*J19;
gain12=J25;
gain13=1/J24;
gain14=1;
gain15=gain1;
%%%%%%%%%%%%%轉(zhuǎn)換為set_para可以用的字符串類(lèi)型,并且不丟失精度
temp=sym(gain0);
gain0=char(vpa(temp,15));
temp=sym(gain1);
gain1=char(vpa(temp,15));
temp=sym(gain2);
gain2=char(vpa(temp,15));
temp=sym(gain3);
gain3=char(vpa(temp,15));
temp=sym(gain4);
gain4=char(vpa(temp,15));
temp=sym(gain5);
gain5=char(vpa(temp,15));
temp=sym(gain6);
gain6=char(vpa(temp,15));
temp=sym(gain7);
gain7=char(vpa(temp,15));
temp=sym(gain8);
gain8=char(vpa(temp,15));
temp=sym(gain9);
gain9=char(vpa(temp,15));
temp=sym(gain10);
gain10=char(vpa(temp,15));
temp=sym(gain11);
gain11=char(vpa(temp,15));
temp=sym(gain12);
gain12=char(vpa(temp,15));
temp=sym(gain13);
gain13=char(vpa(temp,15));
temp=sym(gain14);
gain14=char(vpa(temp,15));
temp=sym(gain15);
gain15=char(vpa(temp,15));
%%%將三個(gè)simulink模型參數(shù)調(diào)整
open ModerForJ.slx
set_param('ModerForJ/Gain0','Gain',gain0);
set_param('ModerForJ/Gain1','Gain',gain1);
set_param('ModerForJ/Gain2','Gain',gain2);
set_param('ModerForJ/Gain3','Gain',gain3);
set_param('ModerForJ/Gain4','Gain',gain4);
set_param('ModerForJ/Gain5','Gain',gain5);
set_param('ModerForJ/Gain6','Gain',gain6);
set_param('ModerForJ/Gain7','Gain',gain7);
set_param('ModerForJ/Gain8','Gain',gain8);
set_param('ModerForJ/Gain9','Gain',gain9);
set_param('ModerForJ/Gain10','Gain',gain10);
set_param('ModerForJ/Gain11','Gain',gain11);
set_param('ModerForJ/Gain12','Gain',gain12);
set_param('ModerForJ/Gain13','Gain',gain13);
set_param('ModerForJ/Gain14','Gain',gain14);
set_param('ModerForJ/Gain15','Gain',gain15);
save_system;
close_system
open ModerForT.slx
set_param(