2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩29頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、<p>  Expanding the Features of a VI</p><p>  You can choose one of many LabVIEW VI templates to use as a starting point. However, sometimes you need to build a VI for which a template is not available.

2、 This chapter teaches you how to build and customize a VI without using a template.</p><p>  Building a VI from a Blank Template</p><p>  In the following exercises, you will open a blank VI and

3、 add Express VIs and structures to theblock diagram to build a new VI. You will build a VI that generates a signal, reduces the number of samples in the signal, and displays the resulting data in a table on the front pan

4、el. When you complete the exercises, the front panel of the VI will look similar to the front panel in Figure 3-1.</p><p>  You can complete the exercises in approximately 30 minutes.</p><p>  

5、Figure 3-1. Front Panel for the Reduce Samples VI</p><p>  Opening a Blank VI</p><p>  If no template is available for the task you want to create, you can start with a blank VI and add Expr

6、ess VIs to accomplish the specific task. Complete the following steps to open a blank VI. </p><p>  In the LabVIEW dialog box, click the arrow on the New button and select BlankVI </p><p>  from

7、 the shortcut menu or press the <Ctrl-N> keys to open a blank VI.</p><p>  Notice that a blank front panel and block diagram appear.</p><p>  Note You also can open a blank VI by selec

8、ting Blank VI from the Create new list in</p><p>  The New dialog box or by selecting File»New VI from the front panel or block</p><p>  diagram menu bar.</p><p>  2. If the Fu

9、nctions palette is not visible, right-click any blank space on the block diagram to bring up the temporary version of the Functions palette. Click the thumbtack, shown at left, in the upper left corner of the Functions p

10、alette to</p><p>  place the palette on the screen.</p><p>  Note You can right-click on a blank space on the block diagram or the front panel to bring up the Functions or Controls palettes.

11、</p><p>  Adding an Express VI that Simulates a Signal</p><p>  Complete the following steps to find the Express VI you want to use and then add it to the block diagram.</p><p>  1.

12、 If the Context Help window is not visible, press the <Ctrl-H> keys to open the Context Help window. You also can press the Show Context Help Window button, shown at left, to open the Context Help window.</p&g

13、t;<p>  2. Select the Input palette on the Functions palette and move the cursor over the Express VIs on the Input palette.Notice that the Context Help window displays information about the function of each Expre

14、ss VI.</p><p>  3. From the information provided in the Context Help window, find theExpress VI that can output a sine wave signal.</p><p>  4. Select the Express VI and place it on the block di

15、agram. The Configure Simulate Signal dialog box appears.</p><p>  5. Idle the cursor over the various options in the Configure Simulate Signal dialog box, such as Frequency (Hz), Amplitude, and Samples per s

16、econd (Hz). Read the information that appears in the Context Help window.</p><p>  6. Configure the Simulate Signal Express VI to generate a sine wave with a frequency of 10.7 and amplitude of 2.</p&g

17、t;<p>  7. Notice how the signal displayed in the Result Preview window changes to reflect the </p><p>  configured sine wave.</p><p>  8. Close the Configure Simulate Signal dialog box

18、.</p><p>  9. Move the cursor over the Simulate Signal Express VI and read the information that </p><p>  appears in the Context Help window.Notice that the Context Help window now displays th

19、e configuration of the Simulate Signal Express VI.</p><p>  Save this VI as Reduce Samples.vi to an easily accessible location.</p><p>  Modifying the Signal</p><p>  Complete the f

20、ollowing steps to use the LabVIEW Help to search for the Express VI that reduces the number of samples in a signal.</p><p>  1. Select Help»VI, Function, & How-To Help to open the LabVIEW Help.</

21、p><p>  2. Click the Search tab and type sample compression in the Type in the word(s) to search for text box.</p><p>  Notice that this word choice reflects what you want this Express VI to do—com

22、press, or reduce, the number of samples in a signal.</p><p>  3. Select the Sample Compression Express VI topic to display the topic that describes the Sample Compression Express VI.</p><p>  4.

23、 After you read the description of the Express VI, click the Place on the block diagram </p><p>  button, shown at left, to select the Express VI.</p><p>  5. Move the cursor to the block diagra

24、m.</p><p>  Notice how LabVIEW attaches the Sample Compression Express VI to the cursor.</p><p>  6. Place the Sample Compression Express VI on the block diagram to the right of the Simulate Sig

25、nal Express VI.</p><p>  7. Configure the Sample Compression Express VI to reduce the signal by a factor of 25 using the mean of these values.</p><p>  8. Close the Configure Sample Compression

26、dialog box.</p><p>  9. Using the Wiring tool, wire the Sine output in the Simulate Signal Express VI to the Signals input in the Sample Compression Express VI.</p><p>  Customizing the Front Pa

27、nel</p><p>  In the previous exercises, you added controls and indicators to the front panel using the Controls palette. You also can add controls and indicators from the block diagram. Complete the followin

28、g steps to create controls and indicators. </p><p>  1. Right-click the Mean output in the Sample Compression Express VI and select Create»Numeric Indicator to create a numeric indicator.</p><

29、;p>  2. Right-click the Mean output of the Sample Compression Express VI and select Insert Input/Output from the shortcut menu to insert the Enable input.</p><p>  3. Right-click the Enable input and sele

30、ct Create»Control to create the Enable switch.</p><p>  4. Right-click the wire linking the Sine output in the Simulate Signal Express VI to the Signals input in the Signal Compression Express VI and se

31、lect Create»Graph Indicator.</p><p>  Notice that you can create controls and indicators from the block diagram. When you reate controls and indicators using this method, LabVIEW automatically creates

32、terminals that are labeled and formatted correctly.</p><p>  5. Using the Wiring tool, wire the Mean output in the Sample Compression Express VI to the Sine terminal. Notice that the Merge Signals function a

33、ppears.</p><p>  6. Arrange the objects on the block diagram so that they appear similar to Figure 3-2.</p><p>  Tip You can right-click any wire and select Clean Up Wire from the shortcut me

34、nu to have LabVIEW automatically arrange the wires for you.</p><p>  Figure 3-2. Block Diagram for the Reduce Samples VI</p><p>  7. Display the front panel.</p><p>  Notice that th

35、e controls and indicators you added automatically appear on the front panel with labels that correspond to their function.</p><p>  8. Save this VI.</p><p>  Configuring the VI to Run Continuous

36、ly Until the User Stops It</p><p>  In the current state, the VI runs once, generates one signal, then stops executing. To run the VI until a condition is met, you can add a While Loop to the block diagram.

37、Complete the following steps to add a While Loop.</p><p>  1. Display the front panel and run the VI.</p><p>  Notice how the VI runs once and then stops. Also notice how there is no STOP button

38、.</p><p>  2. Display the block diagram and select the While Loop on the Execution Control palette.</p><p>  3. Move the cursor to the upper left corner of the block diagram. Place the top left

39、corner of the While Loop here.</p><p>  4. Click and drag the cursor diagonally to enclose all the Express VIs and wires, as shown in Figure3-3.</p><p>  Figure 3-3. Placing the While Loop aroun

40、d the Express VIs</p><p>  Notice that the While Loop, shown at left, appears with a STOP button wired to the condition terminal. This While Loop is configured to stop when the user clicks the STOP button.&l

41、t;/p><p>  5. Display the front panel and run the VI.</p><p>  Notice that the VI now runs until you click the STOP button. A While Loop executes the functions inside the loop until the user presse

42、s the STOP button.</p><p>  Controlling the Speed of Execution</p><p>  To plot the points on the waveform graph more slowly, you can add a time delay to the block diagram. Complete the followin

43、g steps to control the speed at which the VI executes.</p><p>  1. On the block diagram, select the Time Delay Express VI on the Execution Control palette and place it inside the loop.</p><p>  

44、2. Type .250 in the Time delay (seconds) text box.This time delay specifies how fast the loop runs. With a .250 second time delay, the loop iterates once every quarter of a second.</p><p>  3. Close the Conf

45、igure Time Delay dialog box.</p><p>  4. Save this VI.</p><p>  5. Display the front panel and run the VI.</p><p>  6. Click the Enable switch and notice the change on the graph.<

46、;/p><p>  Notice how if the Enable switch is on, the graph displays the reduced signal. If the Enable switch is off, the graph does not display the reduced signal.</p><p>  7. Click the STOP button

47、 to stop the VI.</p><p>  Using a Table to Display Data</p><p>  Complete the following steps to display a collection of mean values in a table on the front panel.</p><p>  1. On th

48、e front panel, select the Express Table indicator on the Text Indicators palette and place it on the front panel to the right of the waveform graph.</p><p>  2. Display the block diagram.</p><p>

49、;  Notice that the Table terminal appears wired to the Build Table Express VI automatically.</p><p>  3. If the Build Table Express VI and the Table terminal are not selected already, click an open area on t

50、he block diagram to the left of the Build Table Express VI and the Table terminal. Drag the cursor diagonally until the selection rectangle encloses the Build Table Express VI and the Table terminal, shown at left. A mov

51、ing dashed outline called a marquee highlights the Build Table Express VI, the Table terminal, and the wire joining the two.</p><p>  4. Drag the objects into the While Loop to the right of the Mean terminal

52、.</p><p>  Notice that the While Loop automatically resizes to enclose the Build Table Express VI and the Table termial.</p><p>  5. Using the Wiring tool, wire the Mean terminal of the Sample C

53、ompression Express VI to the Signals input of the Build Table Express VI.</p><p>  The block diagram should appear similar to Figure 3-4.</p><p>  Figure 3-4. Block Diagram of the Reduce Samples

54、 VI</p><p>  6. Display the front panel and run the VI.</p><p>  7. Click the Enable switch.</p><p>  The table displays the mean values of every 25 samples of the sine wave. Notice

55、 if the Enable switch is off, the table does not record the mean values.</p><p>  8. Stop the VI.</p><p>  9. Experiment with properties of the table by using the Table Properties dialog box. Fo

56、r example, try changing the number of columns to one.</p><p>  10. Save and close this VI.</p><p><b>  Summary</b></p><p>  The following topics are a summary of the ma

57、in concepts you learned in this chapter.</p><p>  Using the LabVIEW Help Resources</p><p>  You can use the Context Help window and the LabVIEW Help to learn more about Express VIs. Both provide

58、 information that describe the functionality of the Express VI and how to configure the Express VI.</p><p>  The following is a summary of the different ways you learned to use the help resources in this cha

59、pter.</p><p>  ? The Context Help window displays basic information about LabVIEW objects when you move the cursor over each object. Objects with context help information include VIs, structures, palettes,

60、 and dialog box components.</p><p>  ? When you place an Express VI on the block diagram, the Context Help window displays a brief description of the Express VI and information about how you configured the

61、 Express VI.</p><p>  ? You can find and select an Express VI and other block diagram objects in the LabVIEW Help. Click the Place on the block diagram button to select a block diagram object and place it

62、on the block diagram.</p><p>  ? To navigate the LabVIEW Help, use the Contents, Index, and Search tabs. Use the Contents tab to get an overview of the topics and structure of the help. Use the Index tab

63、to find a topic by keyword. Use the Search tab to search the help for a word or phrase.</p><p>  Customizing the Block Diagram Code</p><p>  There are many controls, indicators, Express VIs, and

64、 structures that you can use to customize a VI. To customize a VI, you can create controls and indicators, control when a VI stops running, and display generated data in a table.</p><p>  Creating Controls a

65、nd Indicators</p><p>  Create controls and indicators that are wired to Express VIs from the block diagram by right-clicking the Express VI input, output, or wire, and selecting an option from the Create sho

66、rtcut menu.</p><p>  Controlling When a VI Stops Running</p><p>  Use the While Loop to continually run the code enclosed within the loop. The While Loop stops running when a stop condition is m

67、et. When you place or move an object in a While Loop near the border, the loop automatically resizes to add space for that object.</p><p>  The Execution Control palette includes objects that let you control

68、 the number of times a VI runs, as well as the speed at which the VI runs.</p><p>  Displaying Data in a Table</p><p>  The table indicator displays collected data. Use the Build Table Express V

69、I to build a table of collected data.</p><p>  Acquiring Data and Communication with Instruments</p><p>  This chapter introduces you to the Express VIs you use for data acquisition and instrume

70、nt communication on a PC running Windows.</p><p>  Refer to the LabVIEW Measurements Manual for information about data acquisition and instrument communication on all platforms.</p><p>  Acquiri

71、ng a Signal</p><p>  In the following exercises, you will use the DAQ Assistant Express VI to create an NI-DAQmx task. Refer to the Taking an NI-DAQmx Measurement in LabVIEW help tutorial for information abo

72、ut additional methods you can use to create NI-DAQmx tasks. To launch this help tutorial, select Help»Taking an NI-DAQmx Measurement in LabVIEW.</p><p>  Note The following exercises require that you

73、have installed NI-DAQmx and an</p><p>  NI-DAQmx-supported device. Refer to the National Instruments Web site at ni.com/daq for the list of NI-DAQmx-supported devices. If you do not have NI-DAQmx installed o

74、r an NI-DAQmx-supported device, refer to the LabVIEW Measurements Manual for information about using Traditional NI-DAQ for data acquisition.</p><p>  Complete the following exercises to create an NI-DAQmx t

75、ask that continuously takes a voltage reading and plots the data on a waveform graph.</p><p>  You can complete the exercises in approximately 30 minutes.</p><p>  Creating an NI-DAQmx Task</

76、p><p>  In NI-DAQmx, a task is a collection of one or more channels, timing, triggering, and other properties that apply to the task itself. Conceptually, a task represents ameasurement or generation you want t

77、o perform. For example, you can create a task to measure temperature from one or more channels on a DAQ device. Complete the following steps to create and configure a task that reads a voltage level from a DAQ device.<

78、;/p><p>  1. Open a new VI.</p><p>  2. Select the DAQ Assistant Express VI, shown at left, on the Input palette and place it on the block diagram. The DAQ Assistant launches and a Create New dialo

79、g box appears.</p><p>  3. Click the Analog Input button to display the Analog Input options.</p><p>  4. Select Voltage to create a new voltage analog input task.The dialog box displays a list

80、 of channels on each DAQ device installed. The number of channels listed depends on the number of channels you have on the DAQ device.</p><p>  5. In the My Physical Channels listbox, select the physical ch

81、annel to which the signal is connected, such as ai0, and then click the Finish button. The DAQ Assistant opens a new window, shown in Figure 4-1, which displays options for configuring the channel you selected to complet

82、e a task.</p><p>  Figure 4-1. Configuring a Task Using the DAQ Assistant</p><p>  6. In the Input Range section of the Settings tab, enter 10 for the Max value and enter -10 for the Min

83、value.</p><p>  7. In the Task Timing tab, select the Acquire N Samples option.</p><p>  8. Enter a value of 1000 in the Samples To Read input box.</p><p>  Testing the Task</p&g

84、t;<p>  You can test the task to verify that you correctly configured the channel. Complete the following steps to confirm that you are acquiring data.</p><p>  1. Click the Test button, shown at left

85、. An Analog Input Test Panel dialog box appears.</p><p>  2. Click the Start button once or twice to confirm that you are acquiring data, and then click the OK button to return to the DAQ Assistant.</p>

86、;<p>  3. Click the OK button to return to the block diagram.</p><p>  4. Save this VI as Read Voltage.vi to an easily accessible location.</p><p>  Graphing Data from a DAQ Device</p

87、><p>  Using the task you created in the previous exercise, you can graph the data acquired from a DAQ device. Complete the following steps to plot the data from the channel in a waveform graph and change the n

88、ame of the signal.</p><p>  1. On the block diagram, right-click the data output and select Create» Graph Indicator.</p><p>  2. Display the front panel.</p><p>  3. Run the

89、VI three or four times and observe the waveform graph.</p><p>  Notice that Voltage appears in the waveform graph plot legend.</p><p>  4. Display the block diagram.</p><p>  5. R

90、ight-click the DAQ Assistant Express VI and select Properties to rename thechannel.</p><p>  6. Right-click Voltage in the Channel List listbox and select Rename to display the Rename a channel or channels

91、dialog box.</p><p>  Tip You also can select the name of the channel and press the <F2> key to access the Rename a channel or channels dialog box.</p><p>  7. In the New Name text box,

92、 enter First Voltage Reading, and click the OK button.</p><p>  8. Click the OK button to apply this configuration and return to the block diagram.</p><p>  9. Display the front panel and run

93、the VI.</p><p>  Notice that First Voltage Reading appears in the waveform graph plot legend.</p><p>  10. Save this VI.</p><p>  Editing an NI-DAQmx Task</p><p>  You

94、 can add a channel to the task so that you can compare two separate voltage readings. You also can customize the task to acquire the voltage readings continuously. Complete the following steps to add a new channel to the

95、 task and acquire data continuously.</p><p>  1. Display the block diagram and double-click the DAQ Assistant Express VI to add a </p><p>  new channel.</p><p>  2. Click the Add

96、Step button, shown at left, to open the Add Channels To Task dialog </p><p><b>  box.</b></p><p>  3. Select any unused physical channel in the My Physical Channels listbox.</p&g

97、t;<p>  4. Click the OK button to return to the DAQ Assistant.</p><p>  5. Rename the channel Second Voltage Reading.</p><p>  6. In the Task Timing tab, select the Acquire Continuousl

98、y option.When you set timing and triggering options in the DAQ Assistant, these options apply to all the channels in the Channel List.</p><p>  7. Click the OK button to apply this configuration and return

99、to the block diagram.</p><p>  8. Place a While Loop around the DAQ Assistant Express VI and the graph indicator wired to the data output. The block diagram should appear similar to Figure 4-2.</p>&

100、lt;p>  Figure 4-2. Block Diagram for the Read Voltage VI</p><p>  Visually Comparing Two Voltage Readings</p><p>  Because you have two voltage readings displayed on a graph, you can customi

101、ze the plots to distinguish between the two. Complete the following steps to customize the plot color on the waveform graph.</p><p>  1. On the front panel, expand the plot legend to include two plots.</p

102、><p>  2. Run the VI.</p><p>  Notice two plots now appear in the graph and the plot legend automatically updates to include both plot names.</p><p>  3.Right-click First Voltage Read

103、ing and select Color from the shortcut menu. Using the</p><p>  Color picker, select a color, such as yellow, so that the plot is easy to read. Change the plot color of Second Voltage Reading.</p>&l

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論