Ex4-6 Instrumentation Mechanical Engineering
Ex4-6 Instrumentation Mechanical Engineering
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
Output Output
Create Error Heatstroke Freeze Warning
Warning and and
TRUE TRUE
Output
Upper Limit
< Lower Limit
and TRUE
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.
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.
❑ While the terminals are still selected, use the right arrow key on the
keyboard to move the indicators to the right.
❑ 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.
❑ Select Create»Constant.
❑ Select Create»Constant.
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.
End of Exercise