You are on page 1of 14

Software Design

The Software Design process involved the use of National Instruments' Lab View
(TM)product and standard G programming techniques. Lab View (TM) allows for
the creation of Virtual Instruments (VI's) that allow PC based control systems to
achieve a wide range of flexibility and functionality.

The primary focus of this chapter is to describe the logic that was implemented in the
creation of the Lab View (TM) VI's. The main program is composed of several sub-
VI's that were developed in a hierarchical fashion. In this chapter, the sub-VI's are
individually presented and thoroughly explained. Section 3.3 describes the
integration of the sub-VI's into the main VI.

Hierarchical VI Chart

Lab View (TM) organizes its programs in a hierarchical manner. A main program
may be composed of multiple sub-programs. These sub-programs may also contain
their own supporting units. Each provides a specific function to the overall project. In
this manner, changes in specific program functions can be done transparently.
For this project, twelve unique sub-VI's were created within the main VI program.
The hierarchical chart is represented in Figure 3.1 below:
Sub-VI Development

Each of the sub-VI's are described in detail in this section. The VI's are presented
according to the project functions that they support. The sub-VI's support timing,
heating, cooling, file saving, and chamber monitoring.

Stepper Motor & Baffle

Two sub-VI's were created to control the stepper motor, which opens and closes the
baffle. The 'AMOTOR.VI' opens and closes the baffle during heating and cooling. The
'RESETMOTOR.VI' was created to assure that the baffle is closed at the end of each
curing cycle.


'AMOTOR.VI' includes one input and one output. When given a FALSE input from
the main VI, this sub-VI closes the baffle. When given a TRUE input (as shown in
Figure 3.2) the sub-VI opens the baffle. The sub-VI was developed to remember its
last case. Once the baffle is opened to a certain degree, it cannot be directed to open
further. In this fashion, this VI will not react to consecutive TRUE or FALSE cases. It
will open when closed and close when open.

'RESETMOTOR.VI' is very similar to 'MOTOR.VI'. The main difference between the

two is that this VI's only function is to close the baffle. Due to the nature in which the
stepper motor was implemented in the project, there is no feedback from the motor.
Thus, there is no way to assure that the baffle is closed or open. For this purpose, the
'RESETMOTOR.VI' functions to reset the baffle to a closed state at the beginning and
end of each cycle. This VI is imperative to assuring the proper position of the baffle.
When this VI receives a FALSE case the baffle is closed. The TRUE case performs no
action. An indicator in the main VI indicates the position of the baffle at all times.

Fan Motor
Two sub-VI's control the Fan Motor. 'FAN_CONTROL.VI' controls the speed of the
motor to create air flow during heating, and to let fresh air in during cooling. During
normal operation of the chamber, the fan is either in the full speed or slow speed
mode. The fan is only in full speed mode during cool down with the baffle open;
every other case warrants slow speed mode. The 'FANMONITOR.VI' monitors the
actual speed of the VI through the use of a reflective optoswitch. The sensor is
described fully in the next hardware section.

'FAN_CONTORL.VI' includes two inputs and one output. 'Speed control copy'
controls the fan mode, either full speed or slow speed. The other input, 'ON', is
always true to assure continual fan motion.

Note, on the upper far right of Figure 3.4, another VI called 'A0 UPDATE
CHANNEL.VI' is shown. This sub-VI is provided by Lab View (TM) to provide basic
Analog Output functions.


'FAN_MONITOR.VI' outputs the speed of the motor in revolutions per second. The
block image on the bottom-left is the analog input device provided in Lab View
(TM). This mechanism accepts voltage readings from the LM2907. The LM2907
accepts a pulse train from the reflective optoswitch and converts it into a voltage. The
integration of the LM2907 and the optoswitch is further described in the hardware

The voltage is input into the PCI 1200 and the readings are manipulated to represent
the proper speed of the motor. The sub-VI takes in a voltage reading and compares it
to a look-up table to find the corresponding frequency. The look-up table contains an
array of voltages and the corresponding motor frequencies that were determined
during development and testing. Once the proper frequency has been determined,
the sub-VI divides it by four to get the actual speed in revolutions per second (Four
reflective strips are attached to each blade of the fan, such that each revolution will
cause the optoswitch to react four times).
'FAN_MONITOR.VI' provides feedback for the control of the fan. This VI
complements the 'FAN_MOTOR.VI' to create a reliable fan control system. In this
manner, the system operator will be notified through the main VI if the fan ever
stops rotating during normal operation.

Two sub-VI's, LIGHT1ON.VI and LIGHT2ON.VI, control the operation of the lights
for heating purposes. They both function in exactly the same manner to switch the
lights on and off. Lights 1 and 2 are both turned on during the heating process. Only
Light 1 is turned on during the curing process to keep the temperature within the
desired accuracy range. Once the chamber has achieved the proper curing
temperature, Light 1 functions to keep the temperature within the given range.


Note, the diagram for 'LIGHT1ON.VI' is shown in the bottom half of Figure 3.6. This
sub-VI diagram is exactly the same as the 'LIGHT2ON.VI' diagram. When a TRUE
case is received by this sub-VI, the corresponding light is switched on. The lights are
each connected to a solid-state relay which accepts a Boolean TRUE/FALSE
(+5V/0V) for light operation.

As mentioned above, only light 1 is used during the actual curing period. The
amount of heat radiated by light 1 is substantial to keep the proper temperature
range. Lights 1 and 2 are both used during the warm-up period to reach the curing
temperature as fast as possible.

Temperature Measurement
Two sub-VI's are used to measure the temperature. As illustrated in Figure 3.1,
'TEMP_STATUS.VI' is actually a sub-VI of 'TEMP_ANALY.VI'. 'TEMP_ANALY.VI'
accepts the temperature from the analog input port and sends it to
'TEMP_STATUS.VI'. 'TEMP_STATUS.VI' processes the data and outputs its results
back to 'TEMP_ANALY.VI' which then outputs to the main VI.


'TEMP_ANLY.VI' takes a voltage reading from the LM35A temperature sensor. The
LM35A is discussed in the next hardware section. Maximum resolution for the
temperature measurement was achieved by configuring the analog input port to
accept a range from 0 to 1 V. The LM35 outputs .01 V per degree Celsius. Thus, with
12 bit A/D conversion and a 1 volt range, the analog port will provide a resolution of
.244 mV. The flexibility to command this type dynamic resolution from the A/D
converter is what makes Lab View (TM) so powerful in the development of control

The 'TEMP_ANLY.VI' accepts two inputs from the main VI, the desired accuracy and
the desired curing temperature. It takes these inputs and sends them to the
'TEMP_STATUS.VI' along with the received temperature. There are seven outputs
that are sent to the main VI. All of the data for these seven outputs is received from

'TEMP_STATUS.VI' is illustrated at the bottom-right side of the image. It is described

in the next sub-section.

Although the 'TEMP_STATUS.VI' and the 'TEMP_ANALY.VI' appear to be exactly
the same in terms of inputs and outputs, their respective diagrams are very different.
The 'TEMP_STATUS.VI' is much more complex, as it involves the processing of all of
the data. The creation of sub-VI's allows one to distribute complexity, so that the
program is much easier to understand.
'TEMP_STATUS.VI' outputs the temperature status, the chart data, and the file-save
data to the 'TEMP-ANALY.VI'. All of the outputs are arranged on the right hand side
of the diagram. The top-right side illustrates the 'File Save' output. This output is sent
to a separate sub-VI that actually saves the temperature data in a spreadsheet type
file form. The 'Chart Output' creates a chart that graphs the upper temperature limit,
the lower temperature limit, and the actual measured temperature.

The other outputs indicate if the temperature is below or above the desired curing
temperature. These alarms are imperative to the final integration process discussed
in 3.3. The outputs are used to activate the lights, the baffle, and the fan. The 'Over'
and 'Under' cases indicate that the temperature is less than one degree Celsius away
from the desired accuracy boundary. The 'Way Over' and 'Way Under' cases indicate
that the temperature is outside of the desired accuracy boundary. The 'Within Limit'
case indicates that the temperature is well within desired accuracy, with a one degree
cushion on either side. The logic that was implemented into the temperature analysis
sub-system actually functions to keep the temperature within one degree of the
accuracy boundary. In effect, a 0.5 degrees Celsius user defined accuracy will
actually function within a 0.4 degrees Celsius accuracy.
One sub-VI supports the timing functions for the main project. 'ATIMER.VI' takes the
desired curing time and performs a countdown once the proper curing temperature
has been achieved.


'ATIMER.VI' accepts the user input in minutes and seconds. It begins the countdown
based when the 'Start' input is TRUE. The 'Start' input is TRUE once the proper
curing temperature has been achieved. After the time has expired the sub-VI outputs
a TRUE to the 'TimeUp' output. 'RunTime' outputs the actual countdown in milli-
seconds from the given time to zero during the curing process. The other inputs and
outputs are used to keep an accurate time count from iteration to iteration.

Three sub-VI's are incorporated to provide the timed file transfer function. The file-
save function controls the manner in which the temperature and limits are saved to
the spreadsheet file. The measurements are output once every 10 seconds throughout
the complete cycle; warm-up, curing, and cool-down.
The timed file output is controlled with the 'TIMER1.VI', and the actual file transfer is
accomplished with the 'DATA_EXAMPLE.VI'. The 'GET_FILENAME .VI' is used to
prompt the user for the file in which to save the data.

'TIMER1.VI' accepts two primary inputs. The 'Curing Time' input relates to the
increment value (msec) that the timer will wait between file transfer. In this case, an
input of 10,000 msec causes the timer to initiate file transfer once every ten seconds.
The 'Start' input is TRUE at the beginning of each cycle.
'TIMER1.VI' has two primary outputs. The upper-right green TRUE/FALSE icon in
the diagram indicates one. This output is only TRUE once every ten seconds or as
indicated by the 'Curing Time' input during the curing period. The 'Time in Sec'
output relates to the cycle's elapsed time. This value is updated once every ten
seconds, when the file transfer occurs. The 'Run Time' output in this sub-VI indicates
the cycle's elapsed time in milliseconds.
The other inputs and outputs shown in the diagram are used to keep an accurate
time count from iteration to iteration. The FALSE case for this VI does not perform
any action for the main VI.

'GET_FILENAME.VI' prompts the user for a path and filename in which to save the
data from 'DATA_EXAMPLE.VI'. The VI outputs the pathname and filename if the
user designates one. If the user chooses not to save the data by pressing the cancel
button, the 'Cancelled' output will indicate a FALSE case to the
'DATA_EXAMPLE.VI'. The user prompt resembles a standard windows based file-
save box. The user can directly enter a file or browse the file-systems for an
appropriate location.


'DATA_EXAMPLE.VI' performs the actual save-to-file function. Dave Langstrom

developed the basis for this VI, and minor adjustments were made to fit the
functionality of this project. This sub-VI contains three primary inputs: 'Path', 'Go',
and 'Write'. The 'Path' input is taken directly from the 'GET_FILENAME .VI', it
indicates the user-specified filename and path for the saved file. The 'Go' input
activates the file transfer process once the cycle has begun. The 'Write' input is taken
from the 'TIMER.VI', it initiates a file transfer once every 10 seconds or as indicated
by the 'TIMER.VI'.

Sub-VI Integration

The twelve sub-VI's shown in Figure 3.1 were integrated to form the main VI. The
main VI has two primary modes: the Reset Mode and Curing Mode. When the main
program is initially executed, any functions in the gray area are executed. The single
block in the gray area initializes the Digital Output port. It is important to distinguish
that this initialization process is only performed once at the beginning of the main VI
execution. Once the program has started, all program activity will remain in the
white area, either in Reset Mode or Curing Mode.

After the Digital Output port initialization, the main VI performs the functions in the
exterior white box and enters the Reset Mode. The Reset Mode resets the chamber
and prompts the user for information relating to the curing cycle. Once the user has
entered the pertinent data, the VI enters the Curing Mode and performs a complete
curing cycle before returning to the Reset Mode. If the user depresses the Emergency
Quit button at any time during the curing cycle, the main VI will automatically
return to the Reset Mode.

The main VI will continue to alternate from Reset Mode to Curing Mode for the
duration of program execution. The concepts described in this subsection focus on
the manner in which the two modes affect chamber activity. The user's interaction
from mode to mode is fully discussed in the Graphical User Interface (GUI) Section.

Figure 3.14, below, illustrates the main diagram in the reset mode. The center-most
window illustrates the activity for the reset mode.
In this mode, the 'RESET_MOTOR.VI' is activated to place the baffle in the closed
position and to assure that the lights are off. 'LIGHT1ON.VI' and 'LIGHT2ON.VI' are
sent FALSE cases to turn them off. The reset mode also functions to clear the chart for
the next cycle. In this fashion, each cycle begins with a clear chart.

The center-most window in Figure 3.14, shown above, is replaced with the gray
window shown in Figure 3.15, below.
The Curing Mode performs all of the functions necessary to complete a curing cycle.
The curing cycle is composed of four sub-modes; the file-save mode, the warm-up
mode, the curing mode, and the cool-down mode. Initially, the curing cycle enters
the file mode, where the user is prompted for a path and filename through the
'GET_FILENAME.VI'. Based on the user's data, the file-save process is initiated
through the 'DATA_EXAMPLE.VI'.

Once the user has either initiated or cancelled the save-to-file window in the file-save
mode, the curing cycle enters the warm-up mode. The warm-up, curing, and cool-
down modes are all controlled by the 'TEMP_ANALY.VI'. In the warm-up mode, the
'Way Under' case is TRUE. This activates both lights, sets the fan to slow speed, and
closes the baffle.

Once the chamber has achieved the desired temperature within the desired accuracy,
the chamber enters the curing mode of the curing cycle. Throughout this mode, the
fan speed is kept slow and the baffle is kept closed. The 'Under' case switches light 1
on. The 'Over' and 'Within Limit' cases switch light 1 off. This process proceeds
throughout the curing mode, until the curing time expires or until an emergency quit
is activated. Emergency quit is activated if the temperature accuracy boundary is
broken at any time during the curing process or if the user chooses to reset the curing

'ATIMER.VI' continues to count down from the set curing time as long as the
temperature remains within the accuracy boundaries. Once the time has expired, the
baffle is opened and the fan is set to high for the cool-down mode. The cool-down
period cools the chamber down to the user-specified room temperature. Once the
room temperature has been achieved, control is returned to the Reset Mode and the
file-save function is terminated.

At the beginning of the next cycle, the user can choose to append the new data to the
previous data by simply entering the same path and filename information when
prompted. In this fashion, multiple sets of data can be graphed on the same
spreadsheet to facilitate analysis. Separate filenames can also be entered to segment
temperature data analysis.

Software development for this project involved the design of twelve unique sub-VI's
to provide overall program flexibility, efficiency, and functionality. The sub-VI's
were integrated to support two primary modes in the main VI, the Reset Mode and
the Curing Mode. The Reset Mode's primary function was to return the chamber to a
stable state in preparation for the next curing cycle. In the Curing Mode, all of the
sub-VI's were incorporated to perform four unique sub-modes. The file mode, the
warm-up mode, the curing mode, and the cool-down mode were performed in order
to complete the overall curing cycle.