Simulink与LabVIEW联合仿真教程

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

BuildingaLabVIEWUserInterfaceforaSimulink®ModelwithLabVIEWSimulationInterfaceToolkit36ratings|3.75outof5OverviewTheSimulationInterfaceToolkit(SIT)providesaseamlessintegrationbetweenTheMathWorksInc.Simulink®softwareandLabVIEW.TheSimulationInterfaceToolkitautomaticallygeneratesLabVIEWcodetointerfacewithaSimulinkmodelresultinginaflexibleandeasy-to-useuserinterface.YoufirstmustconfiguretheSimulink®modeltocommunicatewithLabVIEW.ThenyoucancreateaLabVIEWhostVIthatautomaticallycalls,runs,andinteractswiththeSimulink®model.TableofContents1.ConfiguringtheSimulinkModel2.CreatingaLabVIEWUserInterface3.CreatingConnectionsbetweentheLabVIEWUserInterfaceandtheSimulink®Model4.AttachmentsConfiguringtheSimulinkModelBeforeLabVIEWcancommunicatewiththeSimulink®model,youmustcorrectlyconfigurethemodelinSimulink®.1.Savetheattachedfiles,absbrakesingleclosed.mdlandabssingleclosed.vi,tothecomputer.2.LaunchMATLAB®andnoticehowtheMATLAB®commandwindowdisplaysthefollowingmessage:StartingtheSITServeronport6011SITServerstartedTheSimulationInterfaceToolkitautomaticallyinstallstheSITserver.Ifyoudonotseethismessage.youhavenotinstalledthetoolkitcorrectly.3.EntersimulinkintheMATLAB®commandwindowtolaunchtheSimulink®LibraryBrowserwindow.4.SelectFile»Openandselecttheabsbrakesingleclosed.mdl,whichisfileyoudownloadedinStep1,toopentheABSBrakingmodel.Thesimulationmodelshouldlooksimilartothefollowingdiagram:ThisSimulink®modelrepresentsananti-lockbrakingsystemforadesiredslip.Thebraketorqueadjustsaccordingtothecurrentwheelspeedandvehiclespeedtoachievethedesiredslip.5.Ateachpointyouwanttomonitorinthesimulationmodel,addanNISinktotheabsbrakesingleclosed.mdltoallowLabVIEWtoreadthedataatthatpointinthesimulationmodel.IntheSimulink®LibraryBrowserwindow,double-clicktheNIToolkitSinkslibrary.NoticetheNISinkandNIXYGraphblocks.6.PlaceanNISinkblockinthemodelwindowoftheabsbrakesingleclosed.mdl.7.ConnectthesignaltotheNISinkblock.TheABSBrakingModelshouldlooksimilartothefollowingdiagram:YoualsocanusetheNIXYGraphblocktoplotandcomparetwosignalsinLabVIEW.8.SavetheSimulink®model.YounowcancreateauserinterfaceinLabVIEWfortheSimulink®model.Noticethatthemodelremainsfully-operationalwithintheSimulink®environment.CreatingaLabVIEWUserInterfaceTointeractwiththeABSBrakingModelusingaLabVIEWuserinterface,youneedtocreateauserinterfaceinLabVIEW.1.LaunchLabVIEWandopenanewVI.2.Selectoneslidercontrolandthreegaugesandplacethemonthefrontpanel.3.LabeltheslidercontrolRelativeSlip.4.LabelthethreegaugesWheelSpeed,VehicleSpeed,andBrakeTorque.5.ChangetheRelativeSlipscaleto0to0.3.6.ChangetheWheelSpeedandVehicleSpeedscalesto0to1007.ChangetheBrakeTorquescaletobe0to1500.ThefrontpaneloftheVIshouldlooklikethefollowingfrontpanel:8.SavethisVIasabssingleclosed.vi.NoticethatthereisnoblockdiagramcodeforcallingtheSimulink®model.CreatingConnectionsbetweentheLabVIEWUserInterfaceandtheSimulink®ModelTheSimulationInterfaceToolkitenablesLabVIEWtorunandcommunicatewiththeSimulink®modelonceyoumaketheappropriateconnections.MATLAB®andSimulink®mustremainopentoconfigureandrunthesimulationmodel.1.Onthefrontpanelmenubar,selectTools»SITConnectionManagertolaunchtheSITConnectionManagerdialogbox.NoticehowtheControlsandindicatorslistboxdisplaysthecontrolsandindicatorsyoucreatedonthefrontpaneloftheabssingleclosedVI.2.ClicktheLoadModelbuttontodisplaytheSelectHostdialogbox.3.IntheSelectHostdialogbox,makesuretheMachineName/IPislocalhost.4.ClicktheOKbutton.Byselectinglocalhost,LabVIEWconnectstotheSITServerthatMATLAB®initiallystarted.IfyouchoosetostartMATLAB®onaseparatecomputerwithSIT2.0installed,youcanconnecttothatcomputerbytypinginthecorrectIPaddress.5.IntheSelectModeldialogbox,navigatetothefolderwhereyousavedtheabsbrakesingleclosed.mdl.Selecttheabsbrakesingleclosed.mdlfileandclicktheOKbutton.NoticehowalltheparametersandsinksassociatedwiththeABSBrakingModelappearsintheModelparametersandsinkslistboxintheSITConnectionManagerdialogbox.6.TocreateaconnectionbetweentheBrakeTorquegaugeinLabVIEWandtheBrakeTorqueinputintheSimulink®model,selectBrakeTorqueintheControlsandindicatorslistboxandselectBrake»BrakeintheModelparametersandsinkslistbox.7.ClicktheAddtoConnectionsbuttontoaddtheconnectiontotheCurrentconnectionstable.8.Similarly,createtheremainingconnectionsbetweentheLabVIEWcontrolsandindicatorsandtheSimulink®parametersandsinks.TheSITConnectionManagerdialogboxshouldlooksimilartothefollowingfigure:[+]EnlargeImageNoticethattheparametersandcontrolshaveaiconinfrontofthemwhilesinksandindicatorshaveaiconinfrontofthem.Usetheseiconstoensurethatyoudonotmakeaninvalidconnection.9.ClicktheOKbutton.NoticethattheSimulationInterfaceToolkitgeneratestheblockdiagramcodethatgovernstheinteractionbetweentheLabVIEWfrontpanelandtheabsbrakesingleclosed.mdl.TheVIshouldlooksimilartothefollowingfigure:10.ClicktheRunbutton,toruntheVI.TheSelectHostdialogboxappears.11.Verifythatthehostcomputerislocalhost.ClicktheOKbutton.AlthoughtheVIstartsdorun,theSimulink®modelisnotrunningyet.12.ToruntheSimulink®model,absbrakesingleclosed.mdl,clicktheRunbutton,,onthefrontpanel.13.Adjustth

1 / 5
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功