Page 73 - Mechatronics with Experiments
P. 73

CLOSED LOOP CONTROL  59

                                     Clock
                                                                                  On clock interrupt
                                                    T

                                                                       Foreground program
                                         Background program
                                         main()                        Control algorithm
                                                                       1. Determine desired response
                                                                       2. A/D conversion of sensor signal
                                         check operator I/O            3. Calculate control : u
                                         check error conditions        4. D/A conversion of control: u
                                         check machine I/O
                                                                       5. Return to background program



                              Mesured y(kT)                       Mesured y(kT)






                                                           t                                    t



                             Control u(kT)                        Control u(kT)
                                               T




                                                              t                                    t
                                         kT  t 1  t 1 - for step(1)
                                                  t  - for step(2)
                                              t 2  2
                                                  t  - for step(3)
                                               t 3  3
                                                t 4 t  - for step(4)
                                                  4
                             FIGURE 2.10: Effective time delay due to signal conversion, processing, and update methods
                             in a digital control system.


                             as soon as possible. In the foreground program, it handles the closed loop control update
                             for the current sampling period. This involves the following tasks,


                                1. determine the desired response (sample from A/D if necessary),
                                2. A/D sample of the sensor signal,
                                3. calculate the control action,
                                4. send the control action to D/A,
                                5. return to the background program.


                             This implementation and timing of the sequence of operations are shown in Figure 2.10 on
                             the left-hand side. Note that A/D conversion is an iterative process and the conversion times
                             may vary from one cycle to the next. As a result, the effective update period for control
   68   69   70   71   72   73   74   75   76   77   78