LabVIEW Core 1 The Software Development Method
LabVIEW Core 1 The Software Development Method
Overview
This content should be reviewed before taking the LabVIEW Core 1 online course. It covers the software development method.
Table of Contents
1. Problem Solving
2. Software Development Method
3. Scenario
4. Design
5. Implementation
6. Testing
7. Maintenance
8. Course Project
1. Problem Solving
LabVIEW is a programming language you can use to solve various problems. Problem-solving skills are essential to creating solutions in LabVIEW. Computer programmers use a software
development method to solve problems using software programs. Following a method helps a programmer to develop code that has greater potential to successfully solve a given problem as
compared to writing code without a plan. A method also helps to make code more readable, scalable, and maintainable.
You will use the strategy described in this lesson to solve problems throughout the course.
2.
3.
4.
5.
During this course, this software development method serves as a framework for all hands-on development exercises. In most exercises, you receive the scenario and design steps. Then you
complete the implementation, testing, and maintenance steps. During this course, you learn to create successful implementations.
Furnace ExampleA furnace example in this lesson illustrates each step of the software development method described.
3. Scenario
During the scenario stage of the software development method, you define what your problem is so that you can approach it with all the necessary factors identified. You can remove extraneous
factors during this phase and focus on the core problem that you must solve. How you identify the problem initially can save you time while you design and implement a solution.
Furnace ExampleAssume that you must cure a material at a certain temperature for a set amount of time in a furnace. For this problem, it is not necessary to know the material type or the time
of day. You must know the cure time, cure temperature, and method for adjusting the furnace temperature.
4. Design
After you determine the scope of the problem, you can design a solution by analyzing the problem. Part of analyzing the problem is identifying the inputs and outputs of the software, as well as any
additional requirements. After you define the inputs and outputs, you can design an algorithm, flowchart and/or state transition diagram to help you arrive at a software solution.
Identify the Inputs
The inputs indicate the raw data that you want to process during the problem solving process.
Furnace ExampleInputs for the furnace software are the cure time (seconds), the necessary cure temperature (Kelvin), and the furnace temperature (Kelvin).
Identify the Outputs
The outputs represent the result of the calculation, processing, or other condition that the problem solving process implements.
Furnace ExampleThe output of the furnace software is an on/off switch that applies voltage to the furnace coil. Voltage is applied to the coil by changing the state of a switch that controls the
voltage supply to the coils. When the voltage is applied or removed, the furnace has an immediate change in temperature.
Identify Additional Requirements
Consider any other factors that might influence solving the problem. For example, do you need to use specific units such as centimeters or seconds?
Furnace ExampleAs an additional requirement for this example, assume that the furnace cannot start until the interior temperature is the same as the exterior temperature.
Designing an Algorithm to Solve the Problem
After determining the inputs, outputs, and additional requirements, you can create an algorithm. An algorithm is a set of steps that process your inputs and create outputs.
Furnace ExampleThis algorithm describes the operation of the furnace:
1. Read exterior temperature.
2. Read interior temperature.
3. If interior temperature is not equal to exterior temperature, go to step 1.
4. Read interior temperature.
5. If interior temperature is greater than or equal to desired temperature, turn off voltage to coil.
6. If current temperature is less than desired temperature, turn on voltage to coil.
7. If time is less than cure time, go to step 4.
8. Turn off voltage to coil.
Designing a Flowchart
A flowchart displays the steps for solving the problem. Flowcharts are useful because you can follow more complex processes of an algorithm in a visual way. For example, you can see if a
specific step has two different paths to the end solution and you can plan your code accordingly.
Furnace ExampleYou can design this example using either an algorithm or a flowchart. Figure 1-1 shows a flowchart following the algorithm designed in the previous subsection.
1/4
www.ni.com
The start of the program is signified with a solid circle, shown at left.
The end of the program is signified with a targeted circle, shown at left.
Furnace ExampleYou also can use a state transition diagram for this example. Figure 1-2 shows the furnace example redesigned as a state transition diagram. Both the flowchart and the state
transition diagram are valid ways to design LabVIEW code, but each may lead to a different programming solution.
5. Implementation
In the implementation stage, you create code for your algorithm or flowchart. When writing code in a text-based language, the algorithm elegantly translates into each line of code, depending on
the level of detail shown in the algorithm. Because LabVIEW is a graphical programming language, the flowchart works much the same way.
6. Testing
Testing and verifying is an important part of the software development method. Make sure to test your implementation with data that is both logical and illogical for the solution you created. Testing
logical data verifies that the inputs produce the expected result. By testing illogical data, you can test to see if the code has effective error handling.
Furnace ExampleTo test the error handling strategy of the furnace example, you could input a cure temperature that is less than the ambient temperature. An effective error handling strategy
could alert the user that the furnace can only increase temperature, not decrease it.
7. Maintenance
Maintenance is the ongoing process of resolving programming errors and adding parallel construction changes to the original solution for a problem.
Furnace ExampleAfter writing this code, you may discover that the customer wants to add a temperature sensor to another area of the oven to add redundancy to the system. Adding features to
the program is easier if you plan for scalability in your software from the beginning.
Exercise 1-1
2/4
www.ni.com
Goal
Solve a problem using the software development method without using software.
Scenario
You are responsible for displaying the time until arrival for airplanes at an airport. You receive this information in seconds, but must display it as a combination of hours/minutes/seconds.
Design
What inputs are you given?
What outputs are you expected to produce?
What is the relationship/conversion between the inputs and outputs?
Tip
Create an algorithm or flowchart that demonstrates the relationship between the inputs and outputs.
Implementation
During this stage, you implement the program from the algorithm or flowchart. For this exercise, skip this stage.
Testing
Use a set of known values to test the algorithm or flowchart you designed.
Example inputs with corresponding outputs:
Input
Output
0 seconds
60 seconds
3600 seconds
3665 seconds
Maintenance
If a test value set has failed, return to the design phase and check for errors.
End of Exercise 1-1
8. Course Project
Throughout this course, the course project illustrates concepts, both as hands-on exercises and as a case study. The project meets the following requirements:
1.
2.
Analyzes each temperature to determine if the temperature is too high or too low
3.
4.
5.
6.
If the user does not stop the program, the entire process repeats
Stop
Outputs
One state transition diagram, shown in Figure 1-3, is chosen so that all students may follow the same instruction set. This state transition diagram is chosen because it successfully solves the
problem and it has parts that can be effectively used to demonstrate course concepts. However, it may not be the best solution to the problem.
3/4
www.ni.com
4/4
www.ni.com