labview ile kontroller

Upload: physicsebenz

Post on 09-Apr-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 labview ile kontroller

    1/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 forthe creation of Virtual Instruments (VI's) that allow PC based control systems toachieve a wide range of flexibility and functionality.

    The primary focus of this chapter is to describe the logic that was implemented in thecreation 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 areindividually presented and thoroughly explained. Section 3.3 describes theintegration of the sub-VI's into the main VI.

    Hierarchical VI ChartLab View (TM) organizes its programs in a hierarchical manner. A main programmay 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. Inthis 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:

  • 8/8/2019 labview ile kontroller

    2/14

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

    Stepper Motor & BaffleTwo sub-VI's were created to control the stepper motor, which opens and closes thebaffle. 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 eachcuring cycle.

    AMOTOR.VI

    'AMOTOR.VI' includes one input and one output. When given a FALSE input fromthe 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 itslast case. Once the baffle is opened to a certain degree, it cannot be directed to openfurther. In this fashion, this VI will not react to consecutive TRUE or FALSE cases. Itwill open when closed and close when open.

  • 8/8/2019 labview ile kontroller

    3/14

    RESETMOTOR.VI

    'RESETMOTOR.VI' is very similar to 'MOTOR.VI'. The main difference between thetwo is that this VI's only function is to close the baffle. Due to the nature in which thestepper 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 andend 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 noaction. 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 themotor to create air flow during heating, and to let fresh air in during cooling. Duringnormal operation of the chamber, the fan is either in the full speed or slow speedmode. 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 theactual speed of the VI through the use of a reflective optoswitch. The sensor is

    described fully in the next hardware section.

    FAN_CONTROL.VI

  • 8/8/2019 labview ile kontroller

    4/14

    '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 UPDATECHANNEL.VI' is shown. This sub-VI is provided by Lab View (TM) to provide basicAnalog Output functions.

    FAN_MONITOR.VI

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

    The voltage is input into the PCI 1200 and the readings are manipulated to representthe proper speed of the motor. The sub-VI takes in a voltage reading and compares itto a look-up table to find the corresponding frequency. The look-up table contains anarray of voltages and the corresponding motor frequencies that were determinedduring development and testing. Once the proper frequency has been determined,

  • 8/8/2019 labview ile kontroller

    5/14

    the sub-VI divides it by four to get the actual speed in revolutions per second (Fourreflective strips are attached to each blade of the fan, such that each revolution willcause the optoswitch to react four times).

    'FAN_MONITOR.VI' provides feedback for the control of the fan. This VIcomplements the 'FAN_MOTOR.VI' to create a reliable fan control system. In thismanner, the system operator will be notified through the main VI if the fan everstops rotating during normal operation.

    Lights

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

    LIGHT1ON & LIGHT2ON.VI

    Note, the diagram for 'LIGHT1ON.VI' is shown in the bottom half of Figure 3.6. Thissub-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 areeach 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. Theamount of heat radiated by light 1 is substantial to keep the proper temperaturerange. Lights 1 and 2 are both used during the warm-up period to reach the curing

    temperature as fast as possible.

    Temperature MeasurementTwo 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'

  • 8/8/2019 labview ile kontroller

    6/14

  • 8/8/2019 labview ile kontroller

    7/14

    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 ofthe data. The creation of sub-VI's allows one to distribute complexity, so that theprogram is much easier to understand.

    'TEMP_STATUS.VI' outputs the temperature status, the chart data, and the file-savedata to the 'TEMP-ANALY.VI'. All of the outputs are arranged on the right hand sideof the diagram. The top-right side illustrates the 'File Save' output. This output is sentto a separate sub-VI that actually saves the temperature data in a spreadsheet typefile 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 curingtemperature. These alarms are imperative to the final integration process discussedin 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 awayfrom the desired accuracy boundary. The 'Way Over' and 'Way Under' cases indicatethat 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 degreecushion on either side. The logic that was implemented into the temperature analysissub-system actually functions to keep the temperature within one degree of the

    accuracy boundary. In effect, a 0.5 degrees Celsius user defined accuracy willactually function within a 0.4 degrees Celsius accuracy.

  • 8/8/2019 labview ile kontroller

    8/14

    TimingOne sub-VI supports the timing functions for the main project. 'ATIMER.VI' takes thedesired curing time and performs a countdown once the proper curing temperaturehas been achieved.ATIMER.VI

    '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 propercuring temperature has been achieved. After the time has expired the sub-VI outputsa 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 andoutputs are used to keep an accurate time count from iteration to iteration.

    Save-to-FileThree 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 isaccomplished with the 'DATA_EXAMPLE.VI'. The 'GET_FILENAME .VI' is used toprompt the user for the file in which to save the data.

    TIMER1.VI

  • 8/8/2019 labview ile kontroller

    9/14

  • 8/8/2019 labview ile kontroller

    10/14

    'GET_FILENAME.VI' prompts the user for a path and filename in which to save thedata from 'DATA_EXAMPLE.VI'. The VI outputs the pathname and filename if theuser 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 anappropriate location.

    DATA_EXAMPLE.VI

    'DATA_EXAMPLE.VI' performs the actual save-to-file function. Dave Langstromdeveloped the basis for this VI, and minor adjustments were made to fit thefunctionality 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', itindicates the user-specified filename and path for the saved file. The 'Go' input

  • 8/8/2019 labview ile kontroller

    11/14

    activates the file transfer process once the cycle has begun. The 'Write' input is takenfrom the 'TIMER.VI', it initiates a file transfer once every 10 seconds or as indicatedby the 'TIMER.VI'.

    Sub-VI IntegrationThe twelve sub-VI's shown in Figure 3.1 were integrated to form the main VI. Themain VI has two primary modes: the Reset Mode and Curing Mode. When the mainprogram is initially executed, any functions in the gray area are executed. The singleblock 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 VIexecution. Once the program has started, all program activity will remain in thewhite area, either in Reset Mode or Curing Mode.After the Digital Output port initialization, the main VI performs the functions in theexterior white box and enters the Reset Mode. The Reset Mode resets the chamberand prompts the user for information relating to the curing cycle. Once the user hasentered the pertinent data, the VI enters the Curing Mode and performs a completecuring cycle before returning to the Reset Mode. If the user depresses the EmergencyQuit 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 theduration of program execution. The concepts described in this subsection focus onthe manner in which the two modes affect chamber activity. The user's interactionfrom mode to mode is fully discussed in the Graphical User Interface (GUI) Section.

    RESET MODEFigure 3.14, below, illustrates the main diagram in the reset mode. The center-mostwindow illustrates the activity for the reset mode.

  • 8/8/2019 labview ile kontroller

    12/14

    In this mode, the 'RESET_MOTOR.VI' is activated to place the baffle in the closedposition 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 forthe next cycle. In this fashion, each cycle begins with a clear chart.CURING MODE

    The center-most window in Figure 3.14, shown above, is replaced with the graywindow shown in Figure 3.15, below.

  • 8/8/2019 labview ile kontroller

    13/14

    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-upmode, the curing mode, and the cool-down mode. Initially, the curing cycle entersthe 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, thefan speed is kept slow and the baffle is kept closed. The 'Under' case switches light 1on. The 'Over' and 'Within Limit' cases switch light 1 off. This process proceedsthroughout 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

  • 8/8/2019 labview ile kontroller

    14/14

    broken at any time during the curing process or if the user chooses to reset the curingcycle.

    'ATIMER.VI' continues to count down from the set curing time as long as thetemperature 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-downperiod cools the chamber down to the user-specified room temperature. Once theroom temperature has been achieved, control is returned to the Reset Mode and thefile-save function is terminated.

    At the beginning of the next cycle, the user can choose to append the new data to theprevious data by simply entering the same path and filename information whenprompted. In this fashion, multiple sets of data can be graphed on the samespreadsheet to facilitate analysis. Separate filenames can also be entered to segmenttemperature data analysis.ConclusionSoftware development for this project involved the design of twelve unique sub-VI'sto provide overall program flexibility, efficiency, and functionality. The sub-VI'swere integrated to support two primary modes in the main VI, the Reset Mode andthe Curing Mode. The Reset Mode's primary function was to return the chamber to astable state in preparation for the next curing cycle. In the Curing Mode, all of thesub-VI's were incorporated to perform four unique sub-modes. The file mode, thewarm-up mode, the curing mode, and the cool-down mode were performed in orderto complete the overall curing cycle.