0% found this document useful (0 votes)
14 views5 pages

Ex4-6 Instrumentation Mechanical Engineering

Uploaded by

Mustafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Ex4-6 Instrumentation Mechanical Engineering

Uploaded by

Mustafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Determine Warnings VI

Goal
Modify a VI to use a Case structure to make a software decision.

Scenario
You created a VI where a user inputs a temperature, a maximum
temperature, and a minimum temperature. A warning string generates
depending on the relationship of the given inputs. However, a situation
could occur that causes the VI to work incorrectly. The user could enter a
maximum temperature that is less than the minimum temperature. Modify
the VI to generate a different string to alert the user to the error: "Upper
Limit < Lower Limit." Set the Warning? indicator to True to indicate
the error.

Design
Modify the flowchart created for the original Determine Warnings VI as
shown in Figure 1.

Output
Min.Temp
Min Temp>= No Current
Min TempTemp
>= No Current Temp No No Warning
Max Temp Max
MaxTemp
Temp Min. Temp and
FALSE

Yes Yes Yes

Output Output
Create Error Heatstroke Freeze Warning
Warning and and
TRUE TRUE

Output
Upper Limit
< Lower Limit
and TRUE

Figure 1. Modified Determine Warnings Flowchart

The original block diagram for the Determine Warnings VI appears in


Figure 2. This VI must have a Case structure added to execute the code if
the maximum temperature is greater than or equal to the minimum
temperature. Otherwise, the code will not execute. Instead, a new string is
generated and the Warning? indicator is set to True.

© National Instruments Corporation 1 Determine Warnings VI


Figure 2. Determine Warnings VI Block Diagram

Implementation
Complete the following instructions to modify the block diagram similar to
that shown in Figure 3. This VI is part of the temperature weather station
project.

Figure 3. Determine Warnings VI Block Diagram

1. Open the Determine Warnings VI in the <Exercises>\


LabVIEW Basics I\Determine Warnings directory.

2. Open the block diagram.

© National Instruments Corporation 2 Determine Warnings VI


3. Create space on the block diagram to add the Case structure.
The Max Temp and Min Temp controls and the Warning Text and
Warning? indicators should be outside of the new Case structure,
because both cases of the Case structure use these indicators and
controls.

❑ Select the Min Temp and Max Temp control terminals.

Tip To select more than one item press the <Shift> key while you select the items.

❑ While the terminals are still selected, use the left arrow key on the
keyboard to move the controls to the left.

Tip Press and hold the <Shift> key to move the objects in five pixel increments.

❑ Select the Warning Text and Warning? indicator terminals.

❑ Align the terminals by selecting Align Objects»Left Edges.

❑ While the terminals are still selected, use the right arrow key on the
keyboard to move the indicators to the right.

4. Compare Min Temp and Max Temp.

❑ Add the Greater? function to the block diagram.

❑ Wire the Min Temp output to the x input of the Greater? function.

❑ Wire the Max Temp output to the y input of the Greater? function.

❑ Add a Case structure around the block diagram code, except for the
excluded terminals.

❑ Wire the output of the Greater? function to the case selector of the
Case structure.

5. If Min Temp is less than Max Temp, execute the code that determines
the warning string and indicator.

❑ While the True case is visible, right-click the border of the Case
structure, and select Make This Case False from the shortcut menu.
When you create a Case structure around existing code, the code is
automatically placed in the True case.

© National Instruments Corporation 3 Determine Warnings VI


6. If Min Temp is greater than Max Temp, create a custom string for the
Warning Text indicator and set the Warning? indicator to True, as
shown in Figure 4.

Figure 4. Determine Warnings VI Block Diagram

❑ Select the True case.

❑ Right-click the string output tunnel.

❑ Select Create»Constant.

❑ Enter Upper Limit < Lower Limit in the constant.

❑ Right-click the Warning? output tunnel.

❑ Select Create»Constant.

❑ Use the Operating tool to change the constant to a True constant.

7. Save the VI.

© National Instruments Corporation 4 Determine Warnings VI


Test
1. Switch to the front panel of the VI.

2. Resize the Warning Text indicator to a length to accommodate the new


string.

3. Test the VI by entering values from Table 1 for Current Temp, Max
Temp, and Min Temp, and running the VI for each set of data.
Table 1 shows the expected Warning Text and Warning? Boolean value
for each set of data.

Table 1. Testing Values for Determine Warnings.vi

Current Temp Max Temp Min Temp Warning Text Warning?


30 30 10 Heatstroke Warning True
25 30 10 No Warning False
10 30 10 Freeze Warning True
25 20 30 Upper Limit < Lower True
Limit

4. Save and close the VI.

End of Exercise

© National Instruments Corporation 5 Determine Warnings VI

You might also like