LIQUID LEVEL DIGITAL CONTROL SYSTEM AND A CASE STUDY:DESIGNING A CONTROLLER

DESIGNING A CONTROLLER

The circuit diagram of the closed-loop system is shown in Figure 11.10. The loop is closed by connecting the output of the level sensor to the analog input AN0 of the microcontroller.

Liquid Level Digital Control System a Case Study-0175

Liquid Level Digital Control System a Case Study-0176

Notice that the output of the microcontroller was set to 200, which corresponds to 200× 5000/256 = 3906 mV, and this was the voltage applied to the power. We then obtain the following transfer function:

Liquid Level Digital Control System a Case Study-0177

The time constant of the system is 31 s. It was shown in Section 10.6 that the sampling time should be chosen to be less than one-tenth of the system time constant, i.e. T < 3.1 s. In this case study, the sampling time is chosen to be 100 ms, i.e. T = 0.1 s.

Liquid Level Digital Control System a Case Study-0178

Liquid Level Digital Control System a Case Study-0179

The controller software is shown in Figure 11.13. The PI algorithm has been implemented as a parallel structure. At the beginning of the program the controller parameters are defined. The program consists of the functions Initialize AD, Initialize Timer, Read AD Input, and the interrupt service routine (ISR). The A/D converter is initialized to receive analog data from channel AN0. The Read AD Input function reads a sample from the A/D converter and stores it in variable yk . The timer is initialized to interrupt every 10 ms. At the beginning of the ISR routine, the PI algorithm is implemented after every 10th interrupt, i.e. every 100 ms. This ensures that the controller sampling time is 100 ms. The ISR routine reads the output of the level sensor and converts it to digital. Then the PI controller algorithm is implemented. Notice that in the algorithm the input of the D/A converter is limited to full scale, i.e. 255. After sending an output to D/A, the ISR routine re-enables the timer interrupts and the program waits for the occurrence of the next interrupt.

The step response of the closed-loop system is shown in Figure 11.14. Here, the reference input was set to 2280. Clearly the system response, although noisy, reaches the set-point with no steady-state error, as desired.

Leave a comment

Your email address will not be published. Required fields are marked *