LabVIEW 虚拟仪器外文翻译资料

 2022-08-21 11:08

LabVIEW Virtual Instruments

1.Getting Started with LabVIEW Virtual Instruments

LabVIEW programs are called virtual instruments, or VIs, because their appearance and operation imitate physical instruments, such as oscilloscopes and multimeters. LabVIEW contains a comprehensive set of tools for acquiring, analyzing, displaying, and storing data, as well as tools to help you troubleshoot your code. In LabVIEW, you build a user interface, or front panel, with controls and indicators. Controls are knobs, push buttons, dials, and other input devices. Indicators are graphs, LEDs, and other displays. After you build the user interface, you add code using VIs and structures to control the front panel objects. The block diagram contains this code. Use LabVIEW to communicate with hardware such as data acquisition, vision, and motion control devices and GPIB, PXI, VXI, RS-232, and RS-485 instruments.

Building a Virtual Instrument

In the following exercises, you will build a VI that generates a signal and displays that signal in a graph. When you complete the exercises, the front panel of the VI will look similar to the front panel in Figure 1-1.

Figure 1-1. Front Panel for the Acquiring a Signal VI

Opening a New VI from a Template

LabVIEW provides templates containing information from which you can build your VI. These templates help you get started with LabVIEW. Complete the following steps to create a VI that generates a signal and displays it on the front panel.

1. Launch LabVIEW.

2. In the LabVIEW dialog box,click the New button to display the New dialog box.

3. Select VI from Templateraquo;Tutorial (Getting Started)raquo;Generate and Display in the Create new list. This template VI generates and displays a signal.

Notice that previews of the template VI appear in the Front panel preview and the Block diagram preview sections. Figure 1-2 shows the New dialog box and the Generate and Display template VI.

Figure 1-2. New Dialog Box

4. Click the OK button to open the template. You also can double-click the name of the template VI in the Create new list to open the template.

5. Examine the front panel of the VI.

The user interface, or front panel, appears with a gray background and includes controls and indicators. The title bar of the front panel indicates that this window is the front panel for the Generate and Display VI.

Note If the front panel is not visible, you can display the front panel by selecting Windowraquo;Show Front Panel.

6. Examine the block diagram of the VI.

The block diagram appears with a white background and includes Vis and structures that control the front panel objects. The title bar of the block diagram indicates that this window is the block diagram for the Generate and Display VI.

Note If the block diagram is not visible, you can display the block diagram by selecting Windowraquo;Show Block Diagram.

7. In the front panel toolbar, click the Run button, Notice that a sine wave appears on the graph.

8. Stop the VI by clicking the STOP button, on the front panel.

Adding a Control to the Front Panel

Controls on the front panel simulate the input devices on a physical instrument and supply data to the block diagram of the VI. Many physical instruments have knobs you can turn to change an input value. Complete the following steps to add a knob control to the front panel.

Tip Throughout these exercises, you can undo recent edits by selecting Editraquo;Undo or pressing the lt;Ctrl-Zgt; keys.

1. If the Controls palette, shown in Figure 1-3, is not visible on the front panel, select Windowraquo;Show Controls Palette to display it.

Figure 1-3. Controls Palette

2. Move the cursor over the icons on the Controls palette to locate the Numeric Controls palette.

Notice that when you move the cursor over icons on the Controls palette, the name of that subpalette appears in the gray space above all the icons on the palette. When you idle the cursor over any icon on any palette, the full name of the subpalette, control, or indicator appears.

3. Click the Numeric Controls icon to access the Numeric Controls palette.

4. Select the knob control on the Numeric Controls palette and place it on the front panel to the left of the waveform graph. You will use this knob in a later exercise to control the amplitude of a signal.

5. Select Fileraquo;Save As and save this VI as Acquiring a Signal.vi to an easily accessible location.

Running the VI

Running a VI executes your solution. Complete the following steps to run the Acquiring a Signal VI.

1. Display the front panel by selecting Windowraquo;Show Front Panel or by clicking the front panel.

Tip Press the lt;Ctrl-Egt; keys to switch from the front panel to the block diagram or from the block diagram to the front panel.

2. Click the Run button.

3. Move the cursor over the knob control.

Notice how the cursor becomes a hand, or the Operating tool. Use the Operating tool to change the value of a control or select the text within a control.

4. Using the Operating tool, turn the knob to adjust the amplitude of the sawtooth wave. Notice how the amplitude of the sawtooth wave changes as you turn the knob. Also notice that the y-axis on the graph autoscales to account for the change in amplitude.

To indicate that the VI is running, the Run button changes to a darkened arrow, shown at left. You cannot edit the front panel or block diagram while the VI runs.

5. Click the STOP button, shown at left, to stop the VI.

Note Although the Abort Execution button looks like a stop button, the Abort Execution button does not always properly close the VI. National Instruments recommends stopping your VIs using the STOP button on the front pa

剩余内容已隐藏,支付完成后下载完整资料


LabVIEW 虚拟仪器

1.LabVIEW 虚拟仪器入门

所有的LabVIEW 程序都被称为虚拟仪器(VI),因为程序的外观和操作方式都与诸如示波器、万用表等实际仪器类似。LabVIEW 包括齐全的用于数据采集、分析、显示、存储数据、调试代码的工具。在LabVIEW 中,您可以利用控制件和显示件建立用户界面,即前面板。控制件包括旋钮、按钮等输入控件,显示件包括图表、LED 等显示器件。在完成用户界面的创建后,您可以通过VI 和结构添加代码来控制前面板上的对象。这些程序代码就构成了程序框图。利LabVIEW,您可以和诸如数据采集设备、图像设备、运动控制设备等硬件进行通信,也可以和GPIB、PXI、VXI、RS-232、RS-485 仪器通信。

创建一个虚拟仪器程序(VI)

在下面的练习中,您将创建一个VI,能够产生一个信号并把它在图表上显示出来。当您完成练习,VI 的前面板如图1-1 所示。

图1-1 采集信号的VI 前面板

打开一个新的VI 模板

LabVIEW 模板包含的信息能够帮助您创建您的VI 程序。这些模板帮助您LabVIEW 起步。完成下面的步骤,您可以创建一个VI 程序来产生信号并把它显示在前面板上。

1. 启动LabVIEW。

2. 在LabVIEW 对话框中,点击New 按键来显示New 对话框。

3. 选择Create new 列表中的VI from Templategt;gt;Tutorial(Getting Started)gt;gt;Generate and Display,这个模板VI 程序产生并显示一个信号。

注意在Front panel preview 和Block diagram preview 区域有该模板VI 的预览。在图1-2 中显示了New 对话框及能够产生和显示信号的模板VI。

图1-2 New 对话框

4. 单击OK 键打开该模板,也可以双击在Create new 列表中的该模板VI 的名字来打开该模板。

5. 察看VI 程序的前面板。

用户界面即前面板的背景是灰色的,在界面上有控制件和显示件。前面板的标题栏说明了该窗口就是产生和显示信号VI 的前面板。

注意 如果前面板被隐藏,您可以单击Windowgt;gt;Show Front Panel 来显示它。

6. 察看VI 程序的程序框图。

程序框图的背景是白色的,包含控制前面板对象的VI 和结构。程序框图的标题栏说明了该窗口是产生和显示VI 的程序框图。

注意 如果程序框图隐藏,您可以单击Windowgt;gt;Show Block Diagram 来显示它。

7. 在前面板工具条内,单击Run 按钮。

8. 注意这时在图表中显示一个正弦波。

9. 在前面板上单击STOP 按钮,可以停止VI 运行。

在前面板中加入一个控件

在前面板中的控件模拟实际仪器的输入装置,将数据传送给VI 程序的流程框图。许多实际仪器用旋钮来改变输入量。完成下面的步骤在前面板中加入一个旋钮。

提示 在练习中,您可以单击Editgt;gt;Undo 选项或快捷键lt;Ctrl-Zgt;取消最近的操作。

1. 如果Controls Palette(控件选板)(如图示1-4)在前面板没有显示,单击Windowgt;gt;Show Controls Palette 选项来显示。

图1-4.Controls 选板

2. 在控件选板中将光标移至Numeric Controls 选板。注意在控件选板中,当您移动光标经过图标时,相应的子选板的名字将显示于选板中所有图标的上方。当您的光标在选板中的任一图标上停留时,将会显示其子选板、控制件或显示件的完整内容。

3. 单击Numeric Controls 图标, 打开Numeric Controls 选板。

4. 在Numeric Controls 选板中选择旋钮控件,并把它放在前面板中靠近波形图表的左边。您在后面的练习中也将用到该旋钮来调节信号的幅值。

5. 单击Filegt;gt;Save As,将该VI 程序保存到容易找到的位置,文件名为Acquiring a Signal.vi。

运行VI程序

运行VI 程序实现您的方案。完成下面的步骤来实现该采集信号VI 程序。

1. 单击Windowsgt;gt;Show Front Panel 或点击前面板,显示前面板。

提示 快捷键lt;Ctrl-Egt;可以在前面板和程序框图之间相互转换。

2. 点击Run 按钮。

3. 移动光标到Knob 控件。

注意光标如何变成小手,即操作工具。利用操作工具来改变控件的数值或选择控件内的文本。

4. 利用操作工具,旋转旋钮来调节锯齿波的幅值。

注意:当您旋转旋钮时,锯齿波的幅度如何改变。另外图表的Y 轴根据幅值的改变自动确定座标范围。Run 按钮变成一个黑色箭头时,表明此VI 程序正在运行。这时您不可以编辑前面板或程序框图。

5. 点击STOP 按钮,停止VI 运行,如图所示。

注意 尽管Abort Execution 按键看上去像一个停止按键,Abort Execution 按键并不总能正确地关闭VI 程序。NI 推荐您使用前面板的STOP 按键来停止您的VIs。当出现错误使得STOP 按键无法停止应用程序时,可以使用Abort Execution 按键。

定制Knob (旋钮) 控件

Knob 控件能改变锯齿波的幅值,因此标志为Amplitude (幅度) 可恰当地反映此旋钮的功能。完成下面的步骤可以定制在前面板内一个控件的外观。

1. 右击旋钮控件并从快捷菜单中单击Propreties,显示出KnobProperties 对话框。

2. 在Apperance 标签的Label 区域内,删除Knob 标记,并在文本框内键入Amplitude。Knob Properties 对话框显示如图1-5。

图1-5 Knob Properties 对话框

3. 点击Scale 标签,在Scale Style 区域选中Ramp Visible 复选框

注意在前面板内的旋钮控件会立即反映出这些变化。

4. 单击OK 按钮,应用当前的配置并关闭Knob Properties 对话框。

5. 保存此VI 程序。

提示 在您创建您的VI 时,您可以试验不同的属性和配置设置,您也可以添加或删除对象。记住单击Editgt;gt;Undo 或快捷键lt;Ctrl-Zgt;可以取消最近的操作。

6. 利用Knob Properties 对话框,您可以试验knob 其它属性。例如,点击Scale 标签内的调色盒,您可以改变Marker Text Color 所对应的颜色。

7. 当您试验时,点击Cancel 按钮可以使您改变的设置无效。如果应用您改变的设置,则点击OK 按钮。

定制波形图

波形图显示了两个信号。为了区分缩放信号的曲线和模拟信号的曲线,您需要定制曲线绘制。完成下面的步骤可以定制在前面板内显示件的外观。

1. 移动光标至波形图中的曲线图例顶部。

注意在图表中有两个曲线,在曲线图例中却只显示了一条曲线。当双向箭头出现时,如图1-11,点击并拖曳曲线图例的边框直到出现第二条曲线名字。

图1-6 展开一个曲线图例

3. 右击波形图,从快捷菜单中单击Properties,显示出GraphProperties 对话框。

4. 在Plots 标签内,从下拉菜单中选择Sawtooth。点击Line Color调色盒显示出颜色拾取工具,并选择一个新的线条颜色。

5. 从下拉菜单中选择Sawtooth(Scaled)。

6. 选中Donrsquo;t use waveform names for plot names 复选框。

7. 在Name 文本框内,删除现在的标记,改变该条曲线的名字为Scaled Sawtooth。

8. 点击OK 按钮,应用当前的配置,并关闭Graph Properties 对话框。

注意: 在前面板内的曲线颜色发生了改变。

9. 利用Graph Properties 对话框试验图表的其它属性。例如,在Scales 标签内,禁用自动缩放功能。

10. 当您试验时,点击Cancel 按钮可以使您改变的设置无效。如果应用您改变的设置,则点击OK 按钮。

11. 保存并关闭该VI 程序。

3.扩展VI 的特性

您可以选择多个LabVIEW VI 模板中的一个来创建您的VI。然而,在某些情况下模板并不适用于您需要创建的VI 程序。本章将教会您如何在不使用模板的情况下创建和定制一个VI 程序。

利用空模板创建新的VI

在下面的练习中,您将要打开一个空的VI,并在程序框图中添加ExpressVIs 和结构,来创建一个新的VI 程序。新的VI 程序实现产生信号、减少信号的采样点,并在前面板的表格中显示最终数据。当您完成练习时,VI 程序的前面板如图2-1 所示。

图2-1 Reduce Samples VI 的前面板

打开一个空VI

如果没有模板适合您需要实现的任务,您可以从一个新VI 开始,添加Express VIs 来实现指定的任务。完成下面的步骤来打开一个空VI。

1. 在LabVIEW 对话框,点击New 按钮上的箭头,从快捷菜单中单击Blank VI 或快捷键lt;Ctrl-Ngt;,来打开一个空VI。

注意,一个空前面板和程序框图也同时显示。

注意 在New 对话框的Create new 列表内单击Blank VI,或者从前面板或程序框图的菜单栏中单击Filegt;gt;New VI,都可以打开一个空VI。

1.如果Functions 选板不可见,在程序框图内的任何空白区右击,即会跳出Functions 选板。 点击在Functions 选板左上方的图钉图标,则把该模板放置在屏幕上。

注意 您可以在程序框图或前面板的空白区右击,来提取出Functioins 选板或Controls 选板。

添加一个模拟信号的Express VI

完成下面的步骤,查找您想要使用的Express VI,并将其添加到程序框图中。

1. 如果Context Help 窗口没有出现,可以按lt;Ctrl-Hgt;键打开它。您也可以按Show Context Help Window 按钮(如左图所示),打开Context Help 窗口。

2. 在Functioins 选板中选择Input 选板,将光标移至Input 选板中的Express VIs 上。注意,Context Help 窗口中显示每个Express VI 的功能的信息。

3. 通过Context Help 窗口提供的信息,找到可以输出一个正弦波信号的Express VI。

4. 选择Express VI 并将其放置到程序框图内,出现ConfigureSimulate Signal 对话框。

5. 将光标在Configure Simulate Signal 对话框的各个选项上移动,例如Frequency (Hz), Amplitude, 和Samples per second (Hz),查看Context Help 窗口内显示的信息。

6. 配置Simulate Signal Express VI,以产生一个频率为10.7、振幅为2的正弦波。

7. 注意Result Preview 窗口内显示的信号,自动改变来反映您配置的正弦波。

8. 关闭Configure Simulate Signal 对话框。

9. 将光标移动至Simulate Signal Express VI,并读取Context Help窗口内显示的信息。

扩展VI 的特性注意,此时Context Help 窗口内显示出Simulate Signal Express VI的配置。

10. 保存此VI 到容易找到的位置,命名为Reduce Samples.vi。

调整信号

完成下面的步骤,利用LabVIEW Help,查找可以使信号采样点减少的Express VI。

1. 单击Helpgt;gt;VI, Function, amp;How-To Help,打开LabVIEW Help。

2. 点击Search 标签,在Type in the word(s) to search for 文本框内键入sample compression。

注意,该单词的选择反映出您需要Express VI 压缩还是减少信号采样点。

3. 选择Sample Compression Express VI 主题,来显示描述该S

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[499406],资料为PDF文档或Word文档,PDF文档可免费转换为Word

原文和译文剩余内容已隐藏,您需要先支付 30元 才能查看原文和译文全部内容!立即支付

以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。