




已阅读5页,还剩20页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Larsen LabVIEW for Engineers英文原版教程教材教案 LabVIEW forEngineersThis page intentionally left blank LabVIEW for EngineersRONALDW.LARSENMontana StateUniversityPrentice HallBostonColumbusIndianapolisNewYorkSan FranciscoUpper Saddle RiverAmsterdamCapeTownDubaiLondonMadridMilanMunichParisMontrealTorontoDelhiMexico CitySaoPauloSydneyHong KongSeoulSingaporeTaipeiTokyoVP/Editorial Director,Engineering/Computer Science:Marcia J.HortonAssistant/Supervisor:Dolores MarsSeniorEditor:Holly StarkAssociateEditor:Dee BernhardEditorialAssistant:Keri RandDirectorof Marketing:Margaret WaplesSeniorMarketing Manager:Tim GalliganMarketingAssistant:Mack PattersonVice-President,Production:Vince OBrienSenior ManagingEditor:Scott DisannoProjectManager:Greg DullesSeniorOperations Supervisor:Alan FischerOperationsSpecialist:Lisa McDowellSeniorArt Director:Jayne ConteArtDirector:Kenny BeckCoverDesigner:Bruce KenselaarMediaEditor:Daniel SandinComposition:IntegraPrinter/Binder:Hamilton PrintingCo.Cover Printer:Lehigh-Phoenix ColorCreditsand acknowledgmentsborrowed fromother sourcesand reproduced,with permission,in thistextbookappear on appropriate pagewithin text.LabVIEW is a registeredtrademark ofNational Instruments,Austin,TX,78759-3504.Copyright?xxPearson Education,Inc.,publishing asPrentice Hall,One LakeStreet,Upper SaddleRiver,New Jersey07458.All rightsreserved.Manufactured in the UnitedStates ofAmerica.Thispublication isprotected byCopyright,and permissionshould beobtained from the publisherprior toanyprohibited reproduction,storage ina retrievalsystem,or transmissionin anyform orby anymeans,electronic,mechanical,photocopying,recording,or likewise.To obtainpermission(s)to usematerialfrom thiswork,please submita writtenrequest toPearson Education,Inc.,Permissions Department,One LakeStreet,UpperSaddleRiver,New Jersey07458.Many of the designationsby manufacturersand sellerto distinguishtheir productsare claimedastrademarks.Where thosedesignations appear in this book,and thepublisher wasaware of a trademarkclaim,the designationshave beenprinted ininitial capsor allcaps.Library ofCongress Cataloging-in-Publication DataLarsen,Ronald W.LabVIEW forEngineers/Ronald W.Larsen.p.cm.Includes index.ISBN-13:978-0-13-609429-6(alk.paper)ISBN-10:0-13-609429-5(alk.paper)1.LabVIEW.2.EngineeringData processing.3.EngineeringComputer programs.4.Scientific apparatusand instrumentsData processing.I.Title.TA345.5.L33L37xx620.00285dc22xx05xx10987654321ISBN10:0-13-609429-5ISBN13:978-0-13-609429-6Contentsv1?INTRODUCTION11.1What isLabVIEW11.2Assumptions21.3Conventions in the Text31.4LabVIEW VIs41.5Starting LabVIEW51.6Creating a VI121.7LabVIEW Menus21Key Terms24Summary25Self-Assessment252?LABVIEW BASICS262.1Opening a VI262.2Basic Mathin LabVIEWUsing Functions262.3Programming Preview:While Loops372.4Dataflow Programming382.5Data Typesand Conversions402.6Documenting VIs442.7Printing aVI492.8Saving YourWork492.9Closing aVI51Key Terms52Summary52Self-Assessment55Problems563?LABVIEW MATHFUNCTIONS603.1Introduction603.2Basic MathFunctions623.3Trigonometric andHyperbolic TrigonometricFunctions743.4Exponential andLogarithm Functions773.5Boolean andComparison Functions803.6Programming Preview:Debugging87Key Terms91Summary92Self-Assessment96Problems984?MATRIX MATHUSING LABVIEW1034.1Working withMatrices andArrays in LabVIEW1034.2Extracting aSubarray from a LargerArray orMatrix1064.3Adding Arrays1114.4Transpose Array1124.5Multiplying anArray bya Scalar1134.6Matrix Multiplication1144.7Element byElement Multiplication1164.8Condition Number1174.9Matrix Determinant1184.10Inverse Matrix1204.11Solving SimultaneousLinear Equations1214.12Programming Preview:For Loops127Key Terms133Summary133Self-Assessment137Problems1385?DATA ACQUISITIONWITH LABVIEW1425.1Overview ofData Acquisition1425.2Sensors,Signals andSignal Conditioning1445.3Data AcquisitionHardware1535.4Using LabVIEWto CollectData158Key Terms174Summary174Self-Assessment175Problems1776?GETTING DATAINTO ANDOUT OFLABVIEW WITHOUTDATA ACQUISITION1816.1Introduction1816.2Writing LabVIEWData to a Spreadsheet File181viContents6.3Writing LabVIEWData toa MeasurementFile1856.4Reading a LabVIEW MeasurementFile1896.5Reading aSpreadsheetFileinLabVIEW1906.6Using SpreadsheetData toInitialize aMatrix Control199Key Terms209Summary209Self-Assessment211Problems2127?GRAPHING WITHLABVIEW2167.1Introduction2167.2Using WaveformCharts2177.3Using WaveformGraphs2287.4Modifying GraphFeatures2367.5Generating1D Arraysfor Graphing2407.6Putting LabVIEWGraphs toWork2427.7Using XYGraphs2D Plotting2487.83D Graphing2547.9Getting Graphsonto Paperand intoReports258Key Terms258Summary259Self-Assessment261Problems2628?DATA ANALYSISUSING LABVIEWVIS2648.1Introduction2648.2Basic Statistics2648.3Interpolation2698.4Curve Fitting2768.5Regression280Key Terms290Summary290Self-Assessment292Problems2939?PROGRAMMING INLABVIEW2979.1Introduction2979.2LabVIEW ProgrammingBasics,Expanded2979.3Structures314Key Terms344Summary344Self-Assessment347Problems348Contentsvii10?LOOKING FORWARD:ADVANCED MATHUSING LABVIEWVIS35210.1Introduction35210.2Working withPolynomials35210.3Statistics:Hypothesis Testing35410.4Differentiation35510.5Integration35710.6RungeKutta Integration35910.7Exponential Filter36110.8Spectral Analysis36310.9Monte CarloSimulation36410.10PID Controller368APPENDIX:PRINTING VIS370INDEX377viiiContentsESource ReviewersixWewould liketo thankeveryone whohelped uswith orhas reviewedtexts in this series.Naeem Abdurrahman,University ofTexas,AustinSharon Ahlers,Cornell UniversityDavidG.Alciatore,Colorado StateUniversityStephen Allan,Utah StateUniversityAnil Bajaj,Purdue UniversityGrantBaker,University ofAlaskaAnchorageWilliam Bard,University ofTexasWilliam Beckwith,Clemson UniversityHaymBenaroya,Rutgers UniversityJohnBiddle,California StatePolytechnic UniversityRayBiswajit,Bloomsburg University of PADonaldBlackmon,UNC CharlotteTomBledsaw,ITT TechnicalInstituteFred Boadu,Duke UniversityGregoryBoardman,Virginia TechStuartBrand,The Ohio State UniversityJeraldBrevick,The Ohio State UniversityTomBryson,University ofMissouri,RollaRamzi Bualuan,University ofNotre DameDanBudny,Purdue UniversityBettyBurr,University ofHoustonFernando Cadena,New MexicoState UniversityJoelCahoon,Montana StateUniversityDale Calkins,University ofWashingtonMonica Cardella,Purdue UniversityLindaChattin,Arizona StateUniversityHarish Cherukuri,University ofNorthCarolinaCharlotteVanessa Clark,Washington Universityin St.LouisArthur Clausing,University ofIllinoisBarry Crittendon,Virginia Polytechnicand StateUniversityDonaldDabdub,University ofCA IrvineRichardDavis,University ofMinnesota DuluthKurtDeGoede,Elizabethtown CollegeJohnDemel,OhioStateUniversityJames Devine,University ofSouth FloridaHeidiA.Diefes-Dux,Purdue UniversityJeffreyA.Doughty,Northeastern UniversityJerryDunn,Texas TechUniversityRon Eaglin,University ofCentral FloridaDaleElifrits,University ofMissouri,RollaTimothy Ellis,Iowa StateUniversityNurgun Erdol,Florida AtlanticUniversityChristopher Fields,Drexel UniversityPatrickFitzhorn,Colorado StateUniversityJulie DykeFord,New MexicoTechSusan Freeman,Northeastern UniversityHowardM.Fulmer,Villanova UniversityFrankGerlitz,Washtenaw CommunityCollegeJohn Glover,University ofHoustonRichard Gonzales,Purdue CalumetJohnGraham,University ofNorth CarolinaCharlotteHayden Griffin,Virginia TechLauraGrossenbacher,University ofWisconsin MadisonAshishGupta,SUNY atBuffaloOtto Gygax,Oregon StateUniversityMal Heimer,Florida InternationalUniversityRobin A.M.Hensel,West VirginiaUniversityDonald Herling,Oregon StateUniversityOrlando Hernandez,The Collegeof NewJerseyDavid Herrin,University ofKentuckyThomas Hill,SUNY atBuffaloA.S.Hodel,Auburn UniversitySusanL.Holl,California St.U.SacramentoKathryn Holliday-Darr,Penn StateU BehrendCollege,ErieTom Horton,University ofVirginiaDavid Icove,University ofTennesseeJames N.Jensen,SUNY atBuffaloMary Johnson,Texas A&M CommerceVernJohnson,University ofArizonaJean C.Malzahn Kampe,Virginia PolytechnicInstitute andState UniversityMosesKarakouzian,University ofNevada LasVegasAutar Kaw,University ofSouth FloridaKathleenKitto,Western WashingtonUniversityKenh Klika,University ofAkronHarold Knickle,University ofRhode IslandTerryL.Kohutek,Texas A&M UniversityThomasKoon,Binghamton UniversityRezaLangari,Texas A&MBill Leahy,Georgia Instituteof TechnologyJohnLumkes,Purdue UniversityMaryC.Lynch,University ofFloridaMelvin J.Maron,University ofLouisvilleChristopher McDaniel,UNC CharlotteKhanjanMehta,Penn StateUniversity ParkF.Scott Miller,University ofMissouri-RollaJames Mitchell,Drexel UniversityRobertMontgomery,Purdue UniversityNajiMounsef,Arizona StateUniversityNikos Mourtos,San JoseState UniversityMarkNagurka,Marquette UniversityRomarathnamNarasimhan,University ofMiamiShahnam Navee,Georgia SouthernUniversityxESource ReviewersJamesD.Nelson,Louisiana TechUniversitySoronadi Nnaji,Florida A&M UniversitySheilaOConnor,Wichita StateUniversityMatt Ohland,Clemson UniversityPailyP.Paily,Tennessee StateUniversityKevin Passino,OhioStateUniversityTed Pawlicki,University ofRochesterErnesto Penado,Northern ArizonaUniversityMichael Peshkin,Northwestern UniversityRalphPike,Louisiana StateUniversityAndrew Randall,University ofCentral FloridaDr.John Ray,University ofMemphisMarcella Reekie,Kansas StateUniversityStanley Reeves,Auburn UniversityLarryRichards,University ofVirginiaMarc H.Richman,Brown UniversityJeffreyRingenberg,University ofMichiganPaul Ronney,University ofSouthern CaliforniaChristopherRowe,Vanderbilt UniversityBlairRowley,Wright StateUniversityLiz Rozell,Bakersfield CollegeMohammadSaed,Texas TechUniversityTabb Schreder,University ofToledoHeshem Shaalem,Georgia SouthernUniversityRandy Shih,Oregon Instituteof TechnologyHowardSilver,Fairleigh DickensonUniversityAvi Singhal,Arizona StateUniversityGreg Sun,University ofMassachusetts BostonJohnSustersic,The PennState UniversityTimSykes,Houston CommunityCollegeMurat Tanyel,Geneva CollegeTobyTeorey,University ofMichiganScott Thomas,Wright StateUniversityVirgil A.Thomason,University ofTN atChattanoogaNeil R.Thompson,University ofWaterlooDennis Truax,Mississippi StateUniversityRaman MenonUnnikrishnan,Rochester InstituteofTechnologyThomas Walker,Virginia TechMichaelS.Wells,Tennessee TechUniversityEd Wheeler,University ofTennessee atMartinJoseph Wujek,University ofCalifornia,BerkeleyEdward Young,University ofSouth CarolinaGarryYoung,Oklahoma StateUniversitySteve Yurgartis,Clarkson UniversityMandochehrZoghi,UniversityofDaytonESource ReviewersxiThispageintentionally leftblankLabVIEWforEngineersThis pageintentionallyleftblank Introduction1.1WHAT ISLABVIEW?In thepast,LabVIEW wasjust a graphical programminglanguage thatwasdeveloped to make iteasier to collect data from laboratoryinstruments usingdata acquisition systems.LabVIEW wasalways easyto useonce yougot usedtowiring connectorsto writeyour puterprograms,and itdefinitely makesdata acquisition aneasier taskthan withoutLabVIEW,but LabVIEW is notjustfor dataacquisition anymore.LabVIEW can be used to performthe following:?acquire datafrom instruments?process data(e.g.,filtering,transforms)?analyze data?control instrumentsand equipmentForengineers,LabVIEW makesit possibleto bringinformation fromtheoutside worldinto aputer,make decisionsbased on the acquireddata,and sendputed results back into the worldto controlthe waya piece ofequipment operates.As an example,the LabVIEW program(front panel)shown in Figure1.1reads a process measurement(a temperaturevalue)from apieceofequipment,pares themeasured processtemperature with the desiredtemperature(called asetpoint),and outputsa signaltoa controller totry tocontrol thetemperatureat thesetpoint value.You can see in Figure1.1that when thetemperature wentabove setpoint,the controller output decreased.This causesavalve ona heatsource toclose(partially)to bringthe temperatureback tosetpoint.In thisbrief example:?A temperaturevalue wasread from an externaldevice.?The desiredsetpoint temperaturewas enteredonacontrol on the front panel.?A controlleroutput wascalculated usinga PI Controller algorithm.?The controlleroutput waswritten toan externaldevice.O bj ec ti ve sAfterreading thischapter,you willknow:what LabVIEW is and howit can be used to acquire,process,and analyzedatawhat aLabVIEW VI is,andhowfront panel and block diagrams are usedhow tostart LabVIEWand create a blank VIhow touse LabVIEWmenus to open andsave VIsCH AP TE R1LabVIEWs abilityto getdatafromoutside the real world,use the data insideapro-gram,and sendresultsbackout to thereal world allowsengineers tointeract withandcontrol eventsin therealworld,not justinside puters.Using LabVIEWprogramsis afast andefficient way to developa newdevice orprototype a newinstrument.And LabVIEW is beingsuch anindustrial standardthat theLab-VIEWprogramused to create theprototype maysoon bethe programused in themercial versionas well.1.2ASSUMPTIONSThe authoris makinga fewassumptions aboutthe readerand aboutthe version ofLabVIEW that you have available.1.2.1Target AudienceAspart of the Pearson-Prentice HallE-Source series,this textis targetedat first-and second-year engineeringstudents.As such,the readeris assumedto havesomemathematical ability,but verylittle experiencewith LabVIEW.And whileLabVIEWis oftenused fordataacquisition,that is not theprimary focusof this2IntroductionFigure1.1LabVIEW VIfor PI Controller(front panel).BaseFullStudentProDevTopic?Trig Functions?Boolean Functions?Matrix MathNo*?Simultaneous EquationsFunction?File I/O?Graphs?Basic StatisticsNo?InterpolationNo?Curve FittingNo?RegressionNo?IntegrationNo?DifferentiationNo?Differential Equations*An easyworkaround ispresented in the text.Section1.3Conventions in the Text3text.Instead,we willfocus onusing themathematical powerof LabVIEWtotackle theanalysis ofdata sets,whether they are acquiredfrom anexperimentalsystem ornot.1.2.2LabVIEW VersionsLabVIEWis awell-developed program,and thechanges fromone versionto anotheraresmall.The authorhas usedLabVIEW8.5and LabVIEWxxFull versionswith noaddedbells orwhistles indeveloping the examples inthis text.For thematerial coveredinthis text,users ofearlier versionsof LabVIEW will seevery fewdifferences.LabVIEWissold inthe followingpackages:?Base Packagereduced mathematicsfunctionality?Full Packageplete set of math functions?Student Editionfull packagewith awatermark inthe lowerright cornerof eachfront panel?Professional Packagecan createstand-alone applications?NI DeveloperSuiteincludes extraadd-ons andtoolkitsIn this text,we willmake useof manyof themathfunctionsthat are availableonly inthe Full,Student,Professional,and Developerpackages.Some of the moreadvancedanalysis techniquesillustrated inthis textwill beunavailable inthe Basepackage.For example,It is assumed that the readerhas aess to atleast theStudent LabVIEWpackage.1.3CONVENTIONS INTHE TEXTThefollowing conventionsareused inthistext:?Keywordsshown initalics thefirst timethey appear.?Literalsitems meantto betyped exactlyas theyappearinthe textare shown inbold font.4IntroductionFigure1.2PIControllerVI,block diagram.?Function andControl namesthe functionsto be selected from the FunctionsPalette and the Controls to beselectedfrom the Controls Palette will beshown inboldfont.The locationwithin thepalette structureis indicatedusing slashes,asMain Palette/Sub-Pallet/Group/Function.?Menu Selectionswhen actionsare initiatedfromamenu,the menuandsubmenu choicesare indicated,separated byslashes asMenu Option/Submenu Option.1.4LABVIEW VIsLabVIEW programs arecalled VIs.Originally,VI stoodfor virtualinstrument,butLabVIEW isnow usedfor manymore applicationsthan justcreating aputersimulation of an instrument,and LabVIEW programs aretypically referredto sim-ply asVIs.A LabVIEW VI hastwo parts:?Front PanelDisplays the controls(knobs,buttons,graphs,etc.)and representsthegraphical interfacefor the VI.An exampleof aVI front panel is shown in Figure1.1.?Block DiagramHolds the programming elements(called blocks,functions,orsometimes subVIs)that arewired together to buildthe graphicalprogram.Theblock diagramfor thePIControllerVI isshown in Figure1.2.This textis intendedfor studentswho arenew toLabVIEW,so Figure1.2ispresented asa previewonly.For studentswho want to knowa littlemore abouthowthe LabVIEW program works,Figure1.3shows themajor programsections inthePI Controller.(If youare notinterested inthe programdetails,you canskip aheadtoSection1.5.)Section1.5Starting LabVIEW5Figure1.3The partsof aLabVIEWprogram.1.Read ananalog voltage(the processmeasurement)from thedata acquisitionsystem.2.Get parametervalues from the controlson the front panel.3.Display valueson the front panelusing numericindicators and graphs.4.Calculate the controlleroutputvalue.5.Write ananalog voltage(thecontrolleroutput)to thedataacquisitionsystem.1.5STARTING LABVIEWThelearning approachthat isusedinthistextis totry toget thereader creatingLabVIEW programs asquickly aspossible.To aomplishthis,some featuresmaybe presentedbriefly atfirst,with justenough informationto allowanexampleto bedeveloped.The detailswill bepresented laterinthechapter.That said;lets start LabVIEW.LabVIEWisstarted from the Windows Start menuas illustratedin Figure1.4.Start Menu/All Programs/National Instruments LabVIEWIf LabVIEW has beenused recently,there will be anicon inthe leftpanel oftheWindowsStart menu(marked with (1)inFigure1.4).Otherwise,use theAll6IntroductionFigure1.4Startmenushowing twooptionsfor starting LabVIEW.Programs buttonand find the National Instruments LabVIEWicon inthe listofinstalled programs(marked with (2)inFigure1.4).Alternatively,there mightbe ashortcut toLabVIEW on the puterdesktop,asshown inFigure1.5.If yourputer does not have a desktopshortcut for LabVIEW,you cancreate oneby right-clicking on the NationalInstrumentsLabVIEWicon(marked with (2)inFigure1.4)and selectingCreate Shortcutfrom thepop-up menu.As LabVIEWloads,the titlescreen shown inFigure1.6is displayed.Once theprogramhas loadedinto memory,the titlescreen disa
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- GB/T 46280.2-2025芯粒互联接口规范第2部分:协议层技术要求
- 2025年地铁安全员安全操作面试题及答案
- 2025年保卫处面试法律法规题集
- 2025年志愿服务基金会招聘面试指南专业模拟题及答案
- 2025年天津市选调生面试常见问题及参考答案
- 2025年浙江省选调面试热点问题集
- 2025年汽车销售顾问执业资格考试试题及答案解析
- 2025年项目管理核心预测题
- 2025年酒店管理人力资源考核师资格考试试题及答案解析
- 2025年建筑工程施工管理工程师资格考试试题及答案解析
- 旧物募捐活动方案
- 文物保护工程进度及工期保证措施
- 智慧城市建设的伦理考量与社会责任
- 智慧校园建设“十五五”发展规划
- 电厂检修项目风险评估报告
- 妊娠期甲状腺疾病诊治
- 成品纸仓库管理制度
- 公司电动汽车安全管理制度
- 电工入场安全教育试卷(含答案)
- 纪念抗日战争胜利80周年
- 数字化牙科扫描技术-洞察及研究
评论
0/150
提交评论