Simulink与LabVIEW联合仿真教程_第1页
Simulink与LabVIEW联合仿真教程_第2页
Simulink与LabVIEW联合仿真教程_第3页
Simulink与LabVIEW联合仿真教程_第4页
Simulink与LabVIEW联合仿真教程_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Building a LabVIEW User Interface for a Simulink? Model with LabVIEW Simulation Interface Toolkit36 ratings | 3.75 out of 5OverviewThe Simulation Interface Toolkit (SIT) provides a seamless integration between The MathWorks Inc. Simulink? software and LabVIEW. The Simulation Interface Toolkit automa

2、tically generates LabVIEW code to interface with a Simulink model resulting in a flexible and easy-to-use user interface. You first must configure the Simulink? model to communicate with LabVIEW. Then you can create a LabVIEW host VI that automatically calls, runs, and interacts with the Simulink? m

3、odel.Table of Contents1. Configuring the Simulink Model2. Creating a LabVIEW User Interface3. Creating Connections between the LabVIEW User Interface and the Simulink? Model4. AttachmentsConfiguring the Simulink ModelBefore LabVIEW can communicate with the Simulink? model, you must correctly configu

4、re the model in Simulink?.1. Save the attached files,absbrakes in gleclosed.mdland abss in gleclosed.vi, to thecomputer.2. Launch MATLAB? and notice how the MATLAB? command window displays the following message:Starti ng the SIT Server on port 6011SIT Server startedThe Simulation Interface Toolkit a

5、utomatically installs the SIT server. If you do not see this message. you have not installed the toolkit correctly.3. Enter simulinkin the MATLAB? command window to launch the Simulink ? Library Browser window.4. Select File?Open and select the absbrakesingleclosed.mdl, which is file you downloaded

6、in Step1, to open the ABS Braking model.The simulation model should look similar to the following diagram:This Simulink? model represents an anti-lock braking system for a desired slip. The brake torque adjusts according to the current wheel speed and vehicle speed to achieve the desired slip.5. At

7、each point you want to monitor in the simulation model, add anNISink totheabsbrakes in gleclosed.mdlto allow LabVIEW to read the data at that point in the simulationmodel . In the Simulink ? Library Browser window, double-click the NI Toolkit Sinks library. Notice the NISink and NIXYGraph blocks.6.

8、Place an NISink block in the model window of the absbrakesingleclosed.mdl.Connect the signal to the NISink block. The ABS Braking Model should look similar to the following diagram:You also can use the NIXYGraph block to plot and compare two signals in LabVIEW.7. Save the Simulink? model.You now can

9、 create a user interface in LabVIEWfor the Simulink? model. Notice that the model remains fully-operational within the Simulink? environment.Creating a LabVIEW User InterfaceTo interact with the ABS Braking Model using a LabVIEW user interface, you need to create a user interface in LabVIEW.1. Launc

10、h LabVIEW and open a new VI.2. Select one slider control and three gauges and place them on the front panel.3. Label the slider control Relative Slip.4. Label the three gauges Wheel Speed , Vehicle Speed , and Brake Torque5. ChangetheRelative Slipscale to 0 to 0.3.6. ChangetheWheel Speedand Vehicle

11、Speedscales to 0 to 1007. ChangetheBrake Torquescale to be 0 to 1500.The front panel of the VI should look like the following front panel:8. Save this VI as abssingleclosed.vi. Notice that there is no block diagram code for calling theSimulink? model.Creating Connections between the LabVIEW User Int

12、erface and the Simulink? ModelThe Simulation Interface Toolkit enables LabVIEW to run and communicate with the Simulink? model once you make the appropriate connections. MATLAB? and Simulink? must remain open to configure and run the simulation model.1. On the front panel menu bar, select Tools?SIT

13、Connection Manager to launch the SIT Connection Manager dialog box. Notice how the Controls and indicators listbox displays the controls and indicators you created on the front panel of the abssingleclosed VI.2. Click the Load Model button to display the Select Host dialog box.3. In the Select Host

14、dialog box, make sure the Machine Name/IP is localhost4. Click the OK button. By selecting localhost, LabVIEW connects to the SIT Server that MATLAB? initially started. If you choose to start MATLAB? on a separate computer with SIT 2.0 installed, you can connect to that computer by typing in the cor

15、rect IP address.5. In the Select Model dialog box, navigate to the folder where you saved theabsbrakesingleclosed.mdl.Select the absbrakesingleclosed.mdlfile and click the OK button.Notice how all the parameters and sinks associated with the ABS Braking Model appears in theModel parametersand sinks

16、listbox in the SIT Connection Manager dialog box.6. To create a connection between the Brake Torque gauge in LabVIEW and the Brake Torque input in the Simulink? model, select Brake Torque in the Controls and indicators listbox and select Brake?Brake in the Model parameters and sinks listbox.7. Click

17、 the Add to Connections button to add the connection to the Current connections table.8. Similarly, create the remaining connections between the LabVIEW controls and indicators and the Simulink? parameters and sinks. The SIT Connection Manager dialog box should look similar to the following figure:L

18、 PE Hidb 弓 mlSlipJ1 rvarlllBftr.-lnlRanK?wFlGdllfl Ji 3HC .E hll I idiiiM>i< hiiHCoribrdE and ndhTHtorc- FIddel abdizke亦uladosed + -册H Vfl-' Mfio-Nro nniruigfu D Edna Horn tf Brahe prwsjra a - csiOeIcgs GaniwEkm+ - HvroiiiGLBg gl - N*QrreiritciTraEttins.fl ElrnkE 仙吟声年a 艮 wheel+ Enlarge Ima

19、geNotice that the parameters and controls have a r icon in front of them while sinks and indicators have a “ icon in front of them. Use these icons to ensure that you do not make an invalid connection.9. Click the OK button.Notice that the Simulation Interface Toolkit generates the block diagram cod

20、e that governs the interaction between the LabVIEW front panel and theabsbrakes in gleclosed.mdl. The VI should look similar to the followingfigure:10. Click theRun button,to run the VI. TheSelect Hostdialog box appears.click theRun button,on the11. Verify that the host computer is localhost . Click

21、 the OK button. Although the VI starts do run, the Simulink? model is not running yet.12. To run the Simulink? model,absbrakes in gleclosed.mdl,front panel.13. Adjust the values of the Relative Slip slider while the Simulink? model is running. You can see the effect of relative slip on the wheel speed, vehicle speed, and brake torque.The process described here does not require The MathWorks Real-Time Workshop?. This VI uses Simulink? to run the simulation. You also can use the Simulation Int

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论