# Real Time Control System Digital Control System Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

In real-time control system, digital control system plays the main role in the industrial environment. The digital control systems act as a digital computer in order to transfer the data and also it acts as a system controller. In the feedback of the control system, the digital computer can be used to serve as a controller or compensator. For the performance of the control system, the data can be transferred in a particular interval to the computer. In the computer system the data can be transferred in the form of binary variables. The data that can be transferred to the digital computer is in the form discrete system. The discrete system is the series of signals per time and these time series is called sampled signals. And that can be transferred to the s-domain and, ultimately to the Z-domain by the relation Z= esT that means the Laplace transform is converted into the Z-transform. A digital computer can serve the compensator for the feedback of the control system.

The digital control is a finite for the need to ensure the error in coefficient like A/D and D/A convertor and so on. To analyze the stability and transient response of the system, the transfer function of Z-transform may be used. The digital control can also utilize the root loci method in order to find out the roots of the characteristics equation. For a series of task the digital control system can be used. The main advantages of the digital control system as controller device are

a) Flexibility and Reliability

b) Cheap

d) Static operation

e) Speed and low cost

f) Accuracy.

The digital control system performs the output operation in digital form and receives the error in the form of digital. Many computer are used to manipulate and able to receive the several inputs. The measurement of the signal from the input are converted from analogue to digital in the form A/D convertor and send it to the computer and after processing the input, the digital computer results the output in the form of digital form. The digital computer consists of central processing unit (CPU), input-output units and memory unit.

In the PID controller, the feedback control system has come from the linear system. The purpose of the digital control system is to show how to work with discrete functions either with the state space form or in the form of the transfer function.

## AIM:

The aim of this experiment is to express all the characteristics of the digital control system that are implemented using digital computers. In order to achieve the personal computer will be connected to a DC servo mechanism by the way of digital to analogue and an analogue to digital card. The results of the digital control system are different from the analogue counterpart in many ways. The main points are:

a) The equation explains the system behaviour of the difference equations and not the differential equations.

b) The analysis is carried out in the 'z' domain and not the 's' domain.

c) The stability region is inside the unit disk, and not the left half s-plane.

d) The controllers are described by the difference equations.

e) A digital control system has an added design variable called the sampling time.

f) The output from the digital controller is held constant over the sampling time.

The performance of the system decreases by increasing the sampling time.

## OBJECTIVES:

The objectives of the experiment are:

a) Obtain a continuous time transfer function of the DC servo.

b) Convert the transfer function in to discrete time form.

c) Design a digital proportional control system using the root loci design technique, for a gain margin of four.

d) Investigate through simulation, the effect of the sampling time on control system behaviour.

e) Implement the digital controller and compare with the simulated results.

f) Design a digital proportional plus derivative controller using the transient response tuning technique, for a good transient.

g) Implement the digital controller and compare with the simulated results.

## Theory:

In the digital control system, basically we have a process that is obtained in the system which is used to control the output response of the system. The closed loop system is designed from the output to the reference input so that the error is obtained between the two signals. The technique for the conversion of the continuous state equations to the discrete state equations can be utilized in the discrete state model for the closed loop control system.

For the conversion of g(s) to g(z), the following steps to be proceed,

a) Taking the transfer function of the g(s).

b) And convert the transfer function in to the state space equation with the state space formula,

Where

'A' is the matrix of the transfer function which is obtained from the given function g(s).

'B' is the partial derivative of the transfer function g(s).

'C' is the which is taken as [1 1].

c) After obtaining the state space equations find out the values of A, B, C. And choose the sampling time which is given.

d) Now convert the differential equation g(s) of the transfer function into the discrete transfer function g(z) with the formula of Z= esT.

e) The discrete transfer function formula g(z) is

Where and

Contruction of the Root locii:

The root locus is the locus of the roots of the characteristics equation of the closed loop system. By using the root locus method, the design can effects on the location of the closed-loop poles of varying the gain value or adding the open loop poles/zeros. To facilitate the application of the root locus method for the systems of higher order than 2nd rules can be established.

For the closed loop transfer function, the loop gain that is obtained is in the interval from 0 to infinty whn the roots are obtained from the transfer function. The root locus is a process, which is used for the stability and transient response of the system. It may also used to calculate the damping ratio and also undamped natural frequency.

For the stability of the digital closed loop transfer function can be examined by using the Jury's criteria. For the stability of the closed loop transfer function can be varied within the interval of (-1,1) from the s-plane to z-plane. For a system to be stable, the poles or zeros should lie within the unit circle. And if the poles/zeros lies outside the unit circle then the system is said to be unstable.

X represents the pole which is located inside the unit circle.

O represents the zero which is located inside the unit circle.

Digital PID controller:

One of the most widely used controllers in the design of continuous data control systems is the PID controller, where PID stands for proportional-integral and derivative control.

The proportional controller simply multiples the error signal by constant Kp.

The integral controller multiplies the integral of e(t) by constant Ki. And the derivative controller generates a signal which is proportional to the time-derivative of the error signal.

The PID controller is mostly used in the feedback control design. The controller is used for the operation of the error signal to produce the control signal.

## Proportional (P) control:

This is the one type of action performed and used in the PID controllers is the proportional control. It is the simplest form of continuous control system that can be used in the closed loop system. Proportional control is used to minimize the fluctuation in the process, but it does not allow to bring back to the required set point. P-only controller provides the faster response than other controllers. The system first allows the P-only controller in order to get the system a few seconds/minutes faster. The main advantage of the P-only controller is the faster response time, it produces the deviation from the set point and this deviation is called offset.

## Mathematical Equations:

P-only controller linearly correlates the controller output (actuating signal) to the error (difference between measured signal and set point). In the mathematical form, the p-controller is given below

Y(t) = Kc e(t) + b

Where

Y(t)= controller output

Kc = controller gain

e(t)= error

b= bias

In the above equation the controller gain and bias are constant to each controller. The controller gain is the change in the controller output per change in the controller input. Bias is simply a controller output, when the error is zero. In the PID controller, when the signals are transmitted then the controller gain relates the changes in the output voltage to the changes in the input voltage. Thus, the gain ultimately changes in the input and output properties. If the controller output changes more than the input, Kc is greater than one.

If the change in the input is greater the controller output, Kc is less than one. Ideally, Kc is equal to infinity then the error will be reduced to zero. Exact equalities cannot be achieved in the control logic. In this, the error will be allowed up to certain range of the system.

## Integral (I) Control:

This is another type of action performed in the PID controllers is the integral control. Integral control is the second form of feedback control system. It is obtained used to remove the deviations that may exit. Thus the system moves to the steady state and original settings. A positive error will cause the signal to be increase and whereas a negative error will cause the signal to be decrease the system. However, I-only controller is much slower in response time than the P-controller. Thus, the slower response time will be reduced by combining with another form such as P or PD controller. It is often used to measure the required variables to remain within a narrow range and also require a fine tuning control.

## Mathematical Equations

I-controller correlates the controller output to the integral of error. The integral of error is taken with respect to time within a specified interval. In the mathematical form, the I-controller equation can be represented as

Where

C(t)= controller output

Ti = integral time

e(t)= error

c(t0)= controller output before integration.

## Derivative (D) Control:

This is another type of action performed in the PID controllers is the derivative control. I-control and D-control are a form of a feed forward control. D-control anticipates the process conditions by analyzing the change in error. It main function is to minimize the change in error, thus keeping the system in a consistent setting. The main benefits of the D-controller is to resist change in system, the most important of these being is oscillations.

The mathematical equation is,

Where

c(t) = controller output

Td = derivative time constant

de = change in error

dt = change in time

## Equipment:

The computer control system is relatively more complex in nature. A digital control system includes the central processing unit (CPU), input-output units and a memory unit. The size and power of the computer depends upon the speed, size of the CPU. Small computers, called microcontrollers, which is most commonly used. In order to get the accurate results we use a 16-bit word or 32-bit word. The system uses the microprocessor as a CPU. The size of the computer and the cost for the active logic devices used to construct both the declined exponentially.

To control a process using the digital control system, the compensator must have the

a) Analog to Digital convertor.

b) To send the signal from A/D to the other control system which affect the actuator and plant. But the controller is in digital form.

c) D/A convertor.

d) Receive the measured results from the system and process them. Sensor is used to monitor the controlled variable for feedback.

The signal v(t) that is passed through the summation and then to the compensator of the control system to pass it CPU in order to convert the signal from digital to analog convertor. In the schematic of digital control system, the digital control system include both continuous and discrete portion. For the design of the digital control system, we require to find out the discrete corresponding of the continuous, so that we need to deal with discrete function.

The time that is connected to the D/A and A/D convertor supplies a pulse for every T second and each of the D/A and A/D sends the signal when the pulse arrives. The purpose of having the pulse in the input is to require Hzoh(z) have only the samples u(k) to work on and produce only the samples of output y(k). Where the Hzoh(z) is zero order hold.

The zero order hold signal goes through the s-domain and pass it to the A/D to produce the output y(k). Now placing the zero order hold, the digital control can be design with the discrete transfer function.

The transfer function for the DC servo is of the form

G(s)=k/s(1+ps)

Where

k is the static gain and p is time constant

Because for the open loop system, it has an integer value (1/s) will affect the servo to run with a constant speed.

## MATLAB Code:

The code for the open loop transfer function that were obtained from the graph is and placing the values of K= 2.355 and Tp= 0.2186.

The code that determine the plotting response of the open loop system is,

hold on

xlabel('Time')

ylabel('Input (blue), Output (red)')

title('System response to a step input')

plot(t,x,'b')

plot(t,y,'r')

grid on

The code that determine the plotting response of digital root locus system is

%Plant Parameters

K=2.355; % DC Gain

Tp=0.2186; % Time Constant

Ts=1 ; % Sampling time

%s-domain Tranfer Function

num=[K];

den=[Tp 1 0];

disp('s-domain Transfer Function :')

sysc=tf(num,den)

%z-domain Transfer Function

disp('z-domain Transfer Function :')

sysd=c2d(sysc,Ts,'zoh')

%Plot z-plane root locus

scrsz = get(0,'ScreenSize');

figure('name','Discrete Time Root Locus','NumberTitle','off','Position',[20 20 scrsz(3)/2 scrsz(4)/2]);

rlocus(sysd)

%Draw unit disk

zgrid([],[])

%Set plot axis limits

axis([-2.75 1.25 -2.0 2.0])

Str=[K Tp Ts];

txt=sprintf('Discrete Time Root Locus for G(s)= %5.3f/s(1+%5.3fs) with Ts=%3.2f',Str);

title(txt)

%Tidy up Command Window output

disp(' ');

disp('**************************')

disp(' ');

The code to simulate the DC servo of the PID controller is

%Plant Parameters

K=2.355; % DC Gain

Tp=0.2186; % Time Constant

%Controller Parameters

Kp=0.3725;

Kd=0.3;

Ki=0.0;

Ts=1.0;

DCServo_Dig_PID:

The simulation of the DC servo diagram is shown below is

## Results:

The sampling time of T=0.1 second is considered and simulate the code for the plot response root loci and keeping the k= 2.355 and Tp= 0.2186 values. The below figure shows the root loci response is

The results that were obtained for the sampling time of ts=0.1, in the matlab command is

result for the transfer function:

s-domain Transfer Function :

Transfer function:

2.355

## --------------

0.2186 s^2 + s

z-domain Transfer Function :

Transfer function:

0.04651 z + 0.03994

## ----------------------

z^2 - 1.633 z + 0.6329

Sampling time: 0.1

The sampling time of T=0.5 second is considered and simulate the code for the plot response root loci and keeping the k= 2.355 and Tp= 0.2186 values. The below figure shows the root loci response is

The results that were obtained for the sampling time of ts=0.5, in the matlab command is

s-domain Transfer Function :

Transfer function:

2.355

## --------------

0.2186 s^2 + s

z-domain Transfer Function :

Transfer function:

0.715 z + 0.343

## ----------------------

z^2 - 1.102 z + 0.1015

Sampling time: 0.5

The sampling time of T=1.0 second is considered and simulate the code for the plot response root loci and keeping the k= 2.355 and Tp= 0.2186 values. The below figure shows the root loci response is

The results that were obtained for the sampling time of ts=1.0, in the matlab command is

Result:

s-domain Transfer Function :

Transfer function:

2.355

## --------------

0.2186 s^2 + s

z-domain Transfer Function :

Transfer function:

1.846 z + 0.4852

## ----------------------

z^2 - 1.01 z + 0.01031

Sampling time: 1

After finding the root loci, now calculate the overall gain for all the sampling time ts and the gain must be divided by the 4.

For t=.1 sec:

Gain is: 9.61

Divided by 4:

2.4025

for t=0.5 sec

gain=2.64

divided by 4 : 0.66

t=1 sec

gain =1.49

divided by 4

0.3725

After obtaining of the root loci. Now check the PID simulation of DC servo and execute the program for the sampling time of t=0.1. Then the graph shows below is

The closed loop step response of system is

After getting the sampling time t=0.1 then next change the sampling time t=0.5 and then change the t and kpto get the kp= 0.66. Now check the PID simulation of DC servo and execute the program for the sampling time of t=0.5. Then the graph shows below is

The closed loop step response of the system is:

After the completion for the sampling time t=1 and repeat the process to execute the PID and after that go to the plot response of the system and execute the program for the plotting response.

The closed loop step response of the system is

After obtaining the open loop and closed loop, now change the value of t= 0.1 and kp=2.4025 and kd=0.400123 (P-D). After that execute the simulation then the graph obtain is

The closed loop step response of the system is,

## Discussion:

The open loop and closed loop step response of the system are observed in the different sampling time. From the open loop response the results that were obtain can measure the value of k and tp. For the different sampling time of t= 0.1, 0.5 and 1.0 is stable. The PD controller for the sample time of t=0.1 with the different values are obtained. So, the digital control systems are very accurate from the analogue control system and the error that is produced is feedback to the input of the controller.

## Conclusion:

The experiment informs the accuracy of the transfer function was stable and effect of the sampling time on the controller stability was not proportional. But the accuracy of the digital control is very reliability. The performance of the digital control system affects the system. The effectiveness of the digital proportional controller and also the proportional plus derivative is high-quality performance.