LabVIEW Core 1 - The Software Development Method

Publish Date: Apr 03, 2013 | 62 Ratings | 3.37 out of 5 | Print

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.

Back to Top

2. Software Development Method

Following a set of steps that has been refined over the years by software engineers can simplify solving problems using software. This course describes a specific set of steps called the software development method. The software development method is a strategy for using LabVIEW to implement a software solution. Use the software development method to create a solution to your problem.

In the software development method, complete the following steps:

1.       Define the problem (scenario).

2.       Design an algorithm and/or flowchart.

3.       Implement the design.

4.       Test and verify the implementation.

5.       Maintain and update the implementation.

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 Example—A furnace example in this lesson illustrates each step of the software development method described.

Back to Top

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 Example—Assume 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.

Back to Top

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 Example—Inputs 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 Example—The 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 Example—As 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 Example—This 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 Example—You 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.

Furnace_Flow2.png in Core 1 Art

 

Figure 1-1.  Flowchart for Furnace Example

 

Designing a State Transition Diagram

State transition diagrams are a specific type of flowchart that are commonly used when creating LabVIEW state machines. State transition diagrams allow you to clearly indicate the states of a program and what causes the program to transition from one state to the next. A state transition diagram uses a labeled circle to signify a steady state and a labeled arrow to indicate a transition from a state.

A state is a part of a program that satisfies a condition, performs an action, or waits for an event. A transition is the condition, action, or event that causes the program to move to the next state.

StartCircle.PNG in Core 1 Art   The start of the program is signified with a solid circle, shown at left.

EndCircle.PNG in Core 1 Art   The end of the program is signified with a targeted circle, shown at left.

Furnace Example—You 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.

Furnace_Flow.png from Core 1 Art folder

 

Figure 1-2.  State Transition Diagram for Furnace Example

 

Back to Top

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.

Back to Top

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 Example—To 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.

Back to Top

7. Maintenance

Maintenance is the ongoing process of resolving programming errors and adding parallel construction changes to the original solution for a problem.

Furnace Example—After 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           Software Development Method

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     Use the Windows calculator to help you determine the relationship.

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 0 hours, 0 minutes, 0 seconds
60 seconds 0 hours, 1 minute, 0 seconds
3600 seconds 1 hour, 0 minutes, 0 seconds
3665 seconds 1 hour, 1 minute, 5 seconds

 

Maintenance

If a test value set has failed, return to the design phase and check for errors.

End of Exercise 1-1 

Back to Top

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.       Acquires a temperature every half a second

2.       Analyzes each temperature to determine if the temperature is too high or too low

3.       Alerts the user if there is a danger of heat stroke or freeze

4.       Displays the data to the user

5.       Logs the data if a warning occurs

6.       If the user does not stop the program, the entire process repeats

The course project has the following inputs and outputs.

Inputs

•          Current Temperature (T)

•          High Temperature Limit (X)

•          Low Temperature Limit (Y)

•          Stop

Outputs

•          Warning Levels: Heatstroke Warning, No Warning, Freeze Warning

•          Current Temperature Display

•          Data Log File

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.

Project State Transition LVBI.png in Core 1 Art Folder

Figure 1-3.  Project State Transition Diagram

Figure 1-4 shows an example of an alternate state transition diagram. This state transition diagram also solves the problem very effectively. One of the major differences between these two diagrams is how they can be expanded for future functionality. In the state transition diagram in Figure 1-3, you can modify the diagram to include warning states for other physical phenomena, such as wind, pressure, and humidity. In the state transition diagram in Figure 1-4, you can add other layers of temperature warnings. The possible future changes you expect to your program affect which diagram you choose.

alternate_transition.png in Core 1 art folder

 

Figure 1-4.  Alternate Project State Transition Diagram

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit