LabVIEW实践之路14-15
- 格式:doc
- 大小:101.50 KB
- 文档页数:2
LabVIEW入门讲义背景介绍LabVIEW是实验室虚拟仪器集成环境(Laboratory Virtual Instrument Engineering Workbench)的简称,是美国国家仪器公司(NATIONAL INSTRUMENTS,简称NI)的创新软件产品,也是目前应用最广、发展最快、功能最强的图形化软件集成开发环境。
目前它广泛地被工业界、学术界和研究实验室所接受,视为一个标准的数据采集和仪器控制软件。
LabVIEW集成了与满足GPIB、VXI、RS-232和RS-485协议的硬件及数据采集卡通讯的全部功能。
它还内置了便于应用TCP/IP、ActiveX等软件标准的库函数。
这是一个功能强大且灵活的软件。
利用它可以方便地建立自己的虚拟仪器,其图形化的界面使得编程及使用过程都生动有趣。
图形化的程序语言,又称为“G”语言。
其编写的程序称为虚拟仪器VI(Virtual Instrument),以.VI后缀。
使用这种语言编程时,基本上不写程序代码,取而代之的是流程图或流程图。
它尽可能利用了技术人员、科学家、工程师所熟悉的术语、图标和概念,因此,LabVIEW 是一个面向最终用户的工具。
它可以增强你构建自己的科学和工程系统的能力,提供了实现仪器编程和数据采集系统的便捷途径。
使用它进行原理研究、设计、测试并实现仪器系统时,可以大大提高工作效率。
以下的课程内容可以在wiki上找到:/doku.php?id=home:whyx:labview第一课 LabVIEW概述第一节虚拟仪器(VI)的概念使用LabVIEW开发平台编制的程序称为虚拟仪器程序,简称为VI。
VI包括三个部分:程序前面板、框图程序和图标/连接器。
程序前面板用于设置输入数值和观察输出量,用于模拟真实仪表的前面板。
在程序前面板上,输入量被称为控制(Controls),输出量被称为显示(Indicators)。
控制和显示是以各种图标形式出现在前面板上,如旋钮、开关、按钮、图表、图形等,这使这得前面板直观易懂。
第8章 波形运算 155
的;线性方式会给出最佳的峰值与均值比。
¾ 信号输出:产生的波形信号。
¾ 峰值因数:输出信号的峰值电压与平均值电压的比。
¾ 实际单频信号频率:
如果强制频率转换为TRUE ,则输出强制转换频率后单频的频率。
8.1.7 课堂练习——生成混合信号
本小节演示使用基本混合单频VI 产生不同形式的信号波形。
操作提示: 本实例利用基本混合单频VI 对混合单频的各种参数进行调节,并输出必要信息。
前面板及程序框图如图8-10和图8-11所示。
图
8-10 前面板
图8-11 程序框图
8.1.8 仿真信号
Express VI 可模拟正弦波、方波、三角波、锯齿波和噪声。
该VI
还存在于【函数】选板 生成混合信号。
虚拟仪器技术实验指导书信息电子技术学院赵化启注意:在试验之前,首先创建一个以自己名字命名的目录,所有的练习程序都保存到该目录中。
补充练习所生成的VI,以“EX+练习序号.vi”命名,如EX01.vi等。
实验一 Labview软件VI的创建实验1.实验目的:(1)创建一个VI程序。
(2)创建一个VI程序模拟温度测量。
2.实验要求:(1)学会使用工具模板、控件模板、函数模板。
(2)了解控件的快捷菜单、属性。
学会如何使用帮助。
(3)理解不同的数据类型是通过颜色和线形来区分的。
3.实验器材:虚拟仪器综合实验平台(PC机等)4.实验内容及原理:虚拟仪器 (VI: Virtual Instrument) 是在以通用计算机为核心的硬件平台上,由用户设计定义,具有虚拟面板,测试功能由测试软件实现的一种计算机仪器系统。
虚拟仪器是以特定的软件支持取代相应功能的电子线路,用计算机完成传统仪器硬件的一部分乃至全部功能,它是以具备控制、处理分析能力的软件为核心的软仪器。
使用者在操作这台计算机时,就象在操作一台他自己设计的仪器一样。
利用Labview软件可以实现VI的设计。
创建一个VI程序模拟温度测量。
假设传感器输出电压与温度成正比。
例如,当温度为70°F时,传感器输出电压为0.7V。
本程序也可以用摄氏温度来代替华氏温度显示。
本程序用软件代替了DAQ数据采集卡。
在程序面板使用编程→数值→随机数(0到1)来仿真电压测量,然后把所测得的电压值转换成摄氏或华氏温度读数。
5.实验步骤:●选择文件 >> 新建VI,打开一个新的前面板。
假如已关闭了所有的VI,则在LabVIEW的对话框中选择新建VI。
注意:若控件面板不可见,可选择菜单察看 >> 控件选板,使控件面板可见。
也可以在前面板的空白区域内单击鼠标右键的方法弹出快捷菜单,使控件面板可见。
●在菜单新式 >> 数值中选择温度计(或Express >> 数值显示控件 >> 温度计),并置于前面板上。
/training Developing ProficiencyWith Graphical System DesignLabVIEW and software engineering skill level requiredSimple Data LoggerBasic DeveloperSoftware DeveloperSmart Grid MonitoringSoftware ArchitectCollimator ControlLarge Hadron Collider (LHC)Proficiency Varies by ApplicationAs the size, complexity, and criticality of your application increase, the knowledge and skills you need to be successful change. Because of this, users who have been developing simpler LabVIEW applications for many years may have diffi culty delivering a more complex system. As you move from project to project, you should assess which additional concepts you need to learn and scale your skill set to match the demands of your new application.n /trainingY our Success Depends on ProficiencySuccessfully completing an application with the graphical system design approach means more than simply generating a functional program that meets requirements. A successful project also minimizes development time and maintenance costs while taking full advantage of National Instruments tools, including increased productivity with NI LabVIEW system design software and access to advanced technology through NI hardware. Proficiency with National Instruments products makes this kind of success possible.Embedded Monitoring and ControlTo help you develop embedded monitoring and control systems, NI CompactRIO hardware offers powerful benefits including precise high-speed timing and control plus rugged hardware. Find which level of proficiency is required for your embedded application:High-performance (FPGA) prototype High-performance (FPGA) deployment Basic performance (Scan Engine) prototype Basic performance (FPGA) deploymentInstrument ControlNI offers high-quality instrument control hardware for buses such as GPIB, USB, and Ethernet to help you automate your measurements. And you can use NI resources to identify which category your application falls into and which level of instrument control proficiency you need:Tester/technician System developer System architectData Acquisition (DAQ)NI is a trusted computer-based measurement provider for engineers and scientists. Find out the level of DAQ proficiency you need to take advantage of NI DAQ’s high-performance I/O, industry-leading technologies, and software-driven productivity gains for your application:Perform basic measurements Develop DAQ systemsArchitect complex DAQ systemsNI Hardware ProficiencyIn addition to determining which level of LabVIEW proficiency you require to achieve success with your graphical system design application, you need to identify the level of hardware proficiency required. NI offers skills guides at /skills-guide/hardware for each of the following hardware platforms./trainingTechnician or Basic DeveloperSoftware EngineerSoftware ArchitectSpend less than 10 hours a week developing applications in LabVIEWEither I am or the team I lead is using LabVIEW regularlyPlan to use LabVIEW for only one project Support and maintain own applications or application will not be maintained Develop any applications to be used, supported, or maintained Build a functional prototype or short-term use systemDesign a “mission critical” application: incorrect execution may result in significant lossDevelop or support/troubleshoot a small to medium application (<20 VIs)Determine and design the manager for a large applicationuse on current applicationSupport and maintenance How Do I Use This Brochure?This brochure offers guidelines to determine the level of profi ciency that best ensures success for current and future projects. To help you accelerate your development, create quality code that you can reconfi gure and reuse, and effectively confi gure and control your hardware, NI skills guides assist you in identifying which profi ciency level your current application requires. You can then learn more about the skill sets important for profi ciency at that level and the options for obtaining those skills consistent with your time constraints, budget, and personal learning preferences.Steps to Graphical System Design ProficiencyStep 1: Read the descriptions below and find the category that best applies to you.Step 2: F ind the corresponding category in the LabVIEW Skills Guide on the back of this pageto identify your proficiency path.Step 3: Review the applicable hardware proficiency paths online at /skills-guide/hardware .LabVIEW Skills GuideTo find training courses near you, view the NI training catalog at /training./skills-guide/training‘‘Iestimate that the training courses have saved me more than 150 hours in self-paced learning time to get to an equivalent skill level.’’–Thomas Sumrak, Test Engineer, PAR Technologies, LLCThe Experience Y ou NeedWith NI training courses, you learn recommended techniques to reduce development time and improve application performance and scalability. In a recent survey, customers reported on average 66 percent faster learning times, 50 percent quicker development, and 43 percent less maintenance after taking NI training courses. Learn from NI and industry experts in a variety of formats, including online, virtual, and classroom settings. NI training is a smart and safe investment to unlock your application development potential.Training FormatsNI offers courses in several languages and formats including classroom training at facilities worldwide or on-site at your facility, online courses, and virtual training to better serve your individual needs. Whichever course format you choose, NI training courses can help you achieve immediate productivity gain and long-term success.Visit /training/optionsfor more details.The mark LabWindows is used under a license from Microsoft Corporation.Windows is a registered trademark of Microsoft Corporation in the United States and other countries.n/trainingCoursesNational Instruments provides many different training courses designed to help you become successful using your NI hardware and software. NI engineers and certifi ed professional instructors design and teach courses that help you learn to develop robust, maintainable applications.Purchasing OptionsPurchase Now, Schedule Now If you already know the course you need and when you would like to take it, you can get started now by browsing our training catalog at /training.Purchase Now, Schedule Later Buy training credits now and redeem them within the year for any training or certifi cation offering. Credits can be applied to anyone and are valid anywhere in the country of purchase.Membership SavingsTake regional and online courses and certifi cation exams for one low price. Memberships are available in six-month, one-year, and two-year options.Already a Member of the Standard Service Program (SSP)?With an active LabVIEW SSP membership, you are entitled to online training. Visit /ssp to see the courses you are eligible for and begin viewing training videos immediately.The mark LabWindows is used under a license from Microsoft Corporation.Windows is a registered trademark of Microsoft Corporation in the United States and other countries.Validate Y our ExpertiseFor developers and engineers using NI software, certification is a proven way to boost career potential. Certification helps inspire confidence in technical skills, leading to promotions, new opportunities, and higher pay for individuals. For organizations, certification is a strategic investment that pays off in increased productivity, reduced turnover, and an overall competitive advantage.n /trainingBenefits of CertificationNI certifi cation demonstrates that you have the skills needed to create high-quality applications with NI software platforms and gives customers, peers, and employers confi dence in your abilities. A recent survey of NI Certifi ed LabVIEW Developers revealed tangible benefi ts that have a direct, measurable, and positive impact on employee and manager alike, such as the following:54 percent said the quality of their work improved 45 percent said their peers’ perceptions of them improved 29 percent received new project opportunities36 percent said the certification increased their compensation by more than 5 percent 10 percent received a promotion at workCertifications OfferedSkill LevelEmbedded Systems DeveloperCoreNI LabVIEWNI TestStand NI LabWindows ™/CVIAssociate DeveloperBroad understanding of core features and the ability to interpret existing LabVIEW codeNo certification offered No certification offeredReasons to Certify Your EmployeesNI certification provides a standard, industry-accepted way of gauging employees’ skills, whether they are developing a part of a program or the complete application architecture.It also allows employers to clearly define and recognize technical skill development goals for individual employees while gaining the benefits of better work quality. At the same time, certification helps individuals within the organization recognize their peers and technical leaders, allowing the development of communication channels and communities that promote the use of good development practices and quick problem resolution.‘‘You can be confident in what you are getting if that certification level is there. Those individuals have the knowledge and experience to hit the ground running, and we had an aggressive timetable for completing the project.’’–David Hakey, Certified LabVIEW Architect and GE Energy Employee/trainingPrepare for Your NI CertificationNational Instruments provides a variety of materials to help you prepare for your certification exam. Go online to view preparation guides, webcasts, sample exams, solutions, and a recommended preparation plan based on when you’re taking the test and how much experience you have.Visit /training/certification_prep .Register for an Exam Near YouIn the Americas and Europe, National Instruments offers many certification exams through Pearson VUE testing centers. For all other exams, please refer to the upcoming exam schedule for your area or contact your local National Instruments office to request a different date or location.Visit /certificationschedule.Already Certified?Find a job that leverages your skills set. There are great companies out there looking for the best and brightest Certified LabVIEW Developers. Find employers at /labviewcareers .Need More Help?Additional Resources for Continuing Y our LearningLabVIEW User GroupsLabVIEW user groups provide the opportunity for you to learn from and interact with other LabVIEW developers face-to-face. Find a user group in your area to get connected. Visit /usergroups for more information.Live Events and WebcastsFree technical sessions presented live at local NI events and virtually via webcast help you learn additional tips and tricks and keep up with the latest NI product and technology developments. Visit /events for more information.Discussion ForumsVisit /forums and ask questions and start discussions with peers and NI experts.NI Developer CommunityVisit /community to find the latest example code, tutorials, and more from LabVIEW and other NI product users across the globe.Technical Support ResourcesAccess technical support resources such as online product manuals, the NI KnowledgeBase, and written tutorials. Visit /support for more information.No Time to Learn?If you are unable to gain the skill level you need in the time allotted for your project, NI can augment your expertise by connecting you with an NI Alliance Partner or certified user who can help.NI Alliance Partner NetworkThe NI Alliance Partner Network is a program of more than 700 companies worldwide that provide complete solutions and high-quality products based on graphical system design. To find an NI Alliance Partner, visit /alliance .NI Certified UsersThousands of certified professionals all over the world have proven their knowledge and skills with NI products by successfully completing NI certification exams. T o view a list of certified users in your area, visit /training/certification .©2013 National Instruments. All rights reserved. CompactRIO, CVI, DIAdem, LabVIEW, Multisim, National Instruments, NI, , NI FlexRIO, NI TestStand, NI VeriStand, and Ultiboard are trademarks of National Instruments. The mark LabWindows is used under a license from Microsoft Corporation. Windows is a registered trademark of Microsoft Corporation in the United States and other countries. Other product and company names listed are trademarks or trade names of their respective companies. A National Instruments Alliance Partner is a business entity independent from National Instruments and has no agency, partnership, or joint-venture relationship with National Instruments. 350891V-01 12200US Corporate Headquarters11500 N Mopac Expwy Austin, TX 78759-3504T : 512 683 0100 F: 512 683 9300 info@International Branch Offices—/global。
本文部分内容来自网络整理,本司不为其真实性负责,如有异议或侵权请及时联系,本司将立即删除!== 本文为word格式,下载后可方便编辑和修改! ==labview,实习报告篇一:labviEW虚拟仪器实习报告实验一:实验步骤(1)启动LabVIEW,创建一个VI并命名为test1。
(2)在前面板中放置一个温度计控件,并修改控件标签名为发动机温度和设置最大值为100。
该控件从“控件—经典—经典数值”子选项板中获得。
(3)按同样的方法在前面板中放置一个仪表控件,并修改仪表控件的标签名为汽车速度,标尺刻度范围为0~150。
(4)按同样的方法在前面板中放置一个数值输入控件,并修改控件标签名为发动机转速。
(5)从“窗口”下拉菜单中选择“显示程序窗口”切换到程序框图窗口。
(6)在程序窗口中创建乘法函数,该函数中函数选项板中的“函数—编程—数值”子选项板中选择,并和发动机转速输入控件连线,为乘法函数创建一个常量,修改为图中所示值。
(7)按同样的方法创建加法函数、平方根函数和除法函数,并按图中所示修改常量值和连好线。
(8)切换至前面板,在发动机转速控件中输入数值,点击运行按钮,运行VI程序。
(9)修改图标为T/V以表示该子VI输出量为发动机温度和汽车速度,并保存。
前面板:程序框图:实验二:实验步骤:(1)启动LabVIEW,创建一个vi并保存为test2。
(2)在前面板中创建一个旋钮控件,修改标签名为发动机转速,设置数值范围为0~5000,从旋钮控件中调出一个数字显示控件来同步显示旋钮控件当前值。
(3)在前面板创建两个数值显示控件,并修改标签名为汽车速度和发动机温度。
(4)切换至程序框图窗口。
(5)在程序框图中创建一个大于或等于函数。
(6)在程序框图中调用实验一的子函数,从函数选板中的“函数—选择VI”选在实验一创建的子vi.vi。
(7)在程序框图中创建一个蜂鸣器函数,并按图示连线情况连线。
(8)切换至前面板,在发动机转速中输入数值,点击运行按钮运行。
实验一虚拟仪器及LabVIEW入门实验一要求:运行National Instruments LabVIEW ,完成下列实验讲义中的所给出的练习题1-1和1-2。
并完成实验报告。
1.1虚拟仪器概述虚拟仪器(virtual instrumention)是基于计算机的仪器。
计算机和仪器的密切结合是目前仪器发展的一个重要方向。
粗略地说这种结合有两种方式,一种是将计算机装入仪器,其典型的例子就是所谓智能化的仪器。
随着计算机功能的日益强大以及其体积的日趋缩小,这类仪器功能也越来越强大,目前已经出现含嵌入式系统的仪器。
另一种方式是将仪器装入计算机。
以通用的计算机硬件及操作系统为依托,实现各种仪器功能。
虚拟仪器主要是指这种方式。
下面的框图反映了常见的虚拟仪器方案。
虚拟仪器的主要特点有:⏹尽可能采用了通用的硬件,各种仪器的差异主要是软件。
⏹可充分发挥计算机的能力,有强大的数据处理功能,可以创造出功能更强的仪器。
⏹用户可以根据自己的需要定义和制造各种仪器。
虚拟仪器实际上是一个按照仪器需求组织的数据采集系统。
虚拟仪器的研究中涉及的基础理论主要有计算机数据采集和数字信号处理。
目前在这一领域内,使用较为广泛的计算机语言是美国NI公司的LabVIEW。
虚拟仪器的起源可以追朔到20世纪70年代,那时计算机测控系统在国防、航天等领域已经有了相当的发展。
PC机出现以后,仪器级的计算机化成为可能,甚至在Microsoft公司的Windows诞生之前,NI公司已经在Macintosh 计算机上推出了以前的版本。
对虚拟仪器和LabVIEW长期、系统、有效的研究开发使得该公司成为业界公认的权威。
普通的PC有一些不可避免的弱点。
用它构建的虚拟仪器或计算机测试系统性能不可能太高。
目前作为计算机化仪器的一个重要发展方向是制定了VXI标准,这是一种插卡式的仪器。
每一种仪器是一个插卡,为了保证仪器的性能,又采用了较多的硬件,但这些卡式仪器本身都没有面板,其面板仍然用虚拟的方式在计算机屏幕上出现。
《虚拟仪器》实验指导书适用专业:机械电子、自动化等课程代码: 8300091 总学时: 32 总学分: 2编写单位:机械学院编写人:车畅审核人:审批人:批准时间:年月日实验1 LabVIEW入门1 实验目的(1)初步学会使用LabVIEW;(2)掌握创建自己的VI。
2 实验任务(1)建立一个测量温度和容积的VI;(2)为 VI创建图标和联接器;(3)使用LabvIEW图表模式。
3 实验步骤练习 1-1 使用三种图表模式目的:查看 VI 分别在三种模式下执行时图表的显示。
1.建立前面板及流程图如下该程序中利用一个循环产生连续的sin(i)函数值,并及时地在chart图表上显示出来,现在前面板上的chart是一个strip,这是一个坐标式显示器,与纸带式图表记录器相似。
每接受一个新数据,新数据就将显示在右侧,而原有数据移动到左侧图1-1 图表的例子2.用鼠标选中chart,点击右键,可在快速菜单中选择Advanced»Update Mode子菜单。
可以选择更换其他两种更新模式。
示波器模式是一个返回式的显示器,与示波器类似。
每接受一个新数据时,它就把新数据绘制在原有数据的右侧。
当数据曲线到达显示区的右边缘时,VI 会删除全部图形,从左边缘重新开始绘制曲线。
示波器模式显然要快于条状图模式,因为它不会因为滚动产生溢出。
扫描模式更接近于示波器模式,但是当数据曲线到达显示区的右边时,不会变成空白,而是会出现一个移动的垂线,标记新数据的开始,并当VI添加新数据时穿过整个显示区。
练习 1-1 结束。
4 实验报告写出练习 1-1的中的步骤要点,附上运行时的前后面版图形。
实验2 程序结构1 实验目的(1)学会使用LabVIEW中的While循环;(2)学会使用LabVIEW中的移位寄存器;(3)学会使用LabVIEW中的For循环;(4)学会使用LabVIEW中的CASE结构;(5)学会使用LabVIEW中的顺序结构;(6)学会使用LabVIEW中的公式节点。
第一章LabVIEW起步:做应该做的
2.4 虚拟波形发生器
如图19所示,前面板上主要就是一个波形图控件、退出按钮以及波形参数控件。
注意,不要着急把所有的东东都放到前面板上,先看看我们用到了哪些框图VI不迟。
图19 虚拟波形发生器前面板
框图程序涉及while循环、基本函数发生器、高斯白噪声发生器
以及延时等待(ms) 。
如图20所示,完成框图程序的顺序没有严
格要求,不过通常还是把流程控制VI拖进来,
在这儿就是while循环。
默认循环右下角是循
环条件(条件为真事停止或继续),左下角的i
则是循环次数,从0开始。
当然,如果不给循
环条件连一个布尔按钮或常量,这个程序肯定
是不能执行的,那你可以放一个按钮在前面板,
然后在框图程序中找到这个按钮并连到循环条
件上。
当然,最快捷的是在循环条件上点右键,
在菜单中选择创建输入控件(常量等也可以,
由功能决定)。
在VI连线端点右键后直接创建
输入输出控件是最常用的快速完成程序的方
法。
图20 虚拟波形发生器程序框图好的,我猜该程序难到你的应该是用到的各函数在哪儿找:while循环就不必说
LabVIEW实践之路
了;波形图也非常容易找;延时等待无疑是在“定时”这一分组里;而基本函数发生器、高斯白噪声发生器就在信号处理>>波形生成里;至于加号,不许问!
可能你也注意到了,前面板上都是中文标签,后面的程序里面为什么这么多英文名称?你很仔细,这是通过右键快速生成控件的时候经常会碰到的,你在前面板控
件上右键就会看到显示项>>标题上打了勾,但标签上没有。
那么如果在对应的框图程序图标上点右键呢,没错,英文的是标签!标题和标签是不一样的,后面用到属性节点时好好讲一下。
当然,如果你直接在前面板上建立一个控件,一般标签和标题的文本是一致的哦。
简单说一下这个程序。
该虚拟波形发生器能够产生常见的
正弦、三角波、锯齿波、方波(通过基本函数发生器),并根
据需求可以调整波形参数;同时能够给信号添加指定强度的高
斯白噪声;波形通过图形方式显示;当然,while循环是要整
个波形产生、显示的过程持续进行,不过为了避免循环全速进
行占用过多资源,加了一个500ms的延时。
(循环中的延时是
非常常用的,别忘了)
最后我们的程序执行时面板看起来比较清爽,少了菜单、
快捷按钮等等,这个样式的实现很简单:在你的程序文件菜单
里选择VI属性,找到窗口外观一项,剩下的就不用再啰嗦了。
OK,LabVIEW实践之路第一章要写结语了,就两句话:用好LabVIEW也得付出努力,用它做应该做的。