Programming Language is MATLAB.
OILA Proportional Integral Derivative PD coller is a closed-loop controller that is normally used in many industrial application Forumple, a PID controller can be used in an air-conditioner (AC) to control the room temperature Let us assume that we have a PID controller.be Aant. The desired temperature set by the user is called the set-point (while the current room temperature is called the process-variable (V). The difference between the Sund the is called the creat time t. (1) - 5(E) - VE) F The PID controller will produce and to replate the Semperature by driving the cooling compressora variable rate. The pur is the combination of three components, the proportional the integral th) and the derivative D given by E420 E94. KK.Kare constants and at the sampling time Eq2 P) = 6,4) 160 - etesse SEEE SKEE 1022 e(t)-(-1) D(t)- Eq4 (a) The operation of the AC wit is as follows The initial state of the AC OFF 2 The wetums On the AC The meet) is zeto, and K.K.Ka 1.5, 1.0, respectively 3 The ser enters the spottement (5 The AC unit starts its operation and repeated following steps every second, that is at 1 The AC units the room tempe The PID with a Compute the ene between SV called e(t) and multiply it with the constant, El ii. Compute the integral (1) stich is the sum of error since the AC unit was started pled with the constant Kiste E92) i. Compute the Derivative, D(t), which is the difference between current emot (t) and the previous measured error et - 1) dinvaded by the sample time, at multiplied with Ke se 3) The output of the controller is the of Pt). (t) and (c) d. Check if the user has pressed the OFF button of the AC it. If go to step 3 5. AC Unit is powered down. Dew the flowchart for the operation of the AC 110 marks) (b) Write the MATLAB code to implement this controller. Use input as a means to read the user's set-point, and we disp as a means to show the controller output. The current room temperature can be obtained by calling the function CurrentRoon Tenperature that alle 110 marka Q11. A Proportional-Integral-Derivative (PID) controller is a closed-loop controller that is normally used in many industrial applications. For example, a PID controller can be used in an air-conditioner (AC) unit to control the room temperature. Let us assume that we have a PID controller-based AC unit. The desired temperature set by the user is called the set-point (S), while the current room temperature is called the process-variable (V). The difference between the S and the P is called the error at time t, e(t) = S(t)-V(t) Eq. 1 The PID controller will produce an output to regulate the temperature by driving the cooling compressor at a variable rate. The output is the combination of three components, the proportional (P), the integral (I) and the derivative (D) given by Eq. 2 to Eq.4. K,K, Kd are constants, and At is the sampling time. P(t) = Ke(t) Eq. 2 (t) = K Decy e(t) at Eq. 3 8 SEEE/SKEE1022 e(t)- e(t-1) D(t) = Ka At Eq. 4 (a) The operation of the AC unit is as follows: 1. The initial state of the AC unit is OFF. 2. The user turns ON the AC unit. The error e(t) is zero, and Kp. K.Ka are 1.5, 1.0, 0.5 respectively. 3. The use enters the set-point temperature (S). The AC unit starts its operation and repeats the following steps every 1 second, that is At = 1. a. The AC unit measures the room temperature (V). b. The PID algorithm starts i. Compute the error between S and V called e(t) and multiply it with the constant K, (see Eq.1). ii. Compute the Integral, I(t) which is the sum of error since the AC unit was started multiplied with the constant K (see Eq.2). iii. Compute the Derivative, D(t), which is the difference between current error, e(t) and the previous measured crror et-1) divided by the sample time, At multiplied with Kd. (see Eq. 3) c. The output of the controller is the sum of P(t), I(C) and D(D). d. Check if the user has pressed the OFF button of the AC unit. If no, go to step 3. 5. AC Unit is powered down. Draw the flowchart for the operation of this AC unit. (10 marks) (b) Write the MATLAB code to implement this controller. Use input as a means to read the user's set-point, and use disp as a means to show the controller output. The current room temperature can be obtained by calling the function CurrentRoomTemperature that returns a scalar value. (10 marks) SEEE/SKEE 1022 APPENDIXMATLAB Reference CONY Function Description and example of usage Absolute wa abs(X) is the absolute value of the elements of Convolution and polynomial munication C-conv(A,B) convolves Vectors and Ir A and I are vectors of polynomial coefficients, convolving them is equivalent to multiplying the two polynomials decony Deconvolution and polinomial division 10.R] -decony (B,A) deconvolves vector A out of vector B. The result is returned in vector and the remainder in vector R such tha B - conv (1,0) + R. If A and are vectors of polynomial coelicients, deconvolution is equivalent to polynomial division. The result of dividing by Ais quotient and remainder dir? Differences and approximate derivatives diftix) calculates differences between adjacent elements of X along the first array dimension whose site does not equal I. disp Display array disp (x) displays the array, without printing the array name fprint Write formatted data to text file. fprint (ORMAT, A, ... ) formats data and displays the results on the screen. input Prows for mer input RESULT - input (PROMPT) displays the PROMPT string on the screen, waits for input from the keyboard, evaluates any expressions in the input, and returns the value in RESULT. integral Numerical integration integral (Eun, xnin, xmax) numerically integrates function fun from xmin to xmax using global adaptive quadrature and default error tolerances interpl 1-D data interpolation interpl(x,V,xq, method) specifies an alternative interpolation method: 'linear', 'nearest.next', 'previous'.'pchip!, 'cubic!. 'v5cu bic', 'makima', or 'spline! mean Average or mean value of array mean (A) returns the mean of the elements of A along the first array dimension whose size does not equal 1. num2str Comert numbers to a string I - num2 str(x) converts the matrix X into a string representation T with about 4 digits and an exponent if required. Linear plot plot(X,Y) plots vector y versus vector X. If X or Y is a matrix, then the vector is plotted versus the rows or columns of the matrix, whichever line up prod Product of elements S = prod(X) is the product of the elements of the vector X. roots Find polynomial roots. roots (C) computes the roots of the polynomial whose coefficients are the elements of the Vector C Sort array elemente sort (A, direction) returns sorted elements of A in the order specified by direction using any of the previous syntaxes. 'ascend indicates ascending order (the default) and 'descend indicates descending order, stramp Compare strings strcmp(1,52) compares al and a2 and retums 1 (true) if the two are identical and O (false) otherwise xisread Read Microsoft Excel spreadsheet fille xlstead(filename, sheet, xlRange) reads from the specified worksheet and range. plot Dort OILA Proportional Integral Derivative PD coller is a closed-loop controller that is normally used in many industrial application Forumple, a PID controller can be used in an air-conditioner (AC) to control the room temperature Let us assume that we have a PID controller.be Aant. The desired temperature set by the user is called the set-point (while the current room temperature is called the process-variable (V). The difference between the Sund the is called the creat time t. (1) - 5(E) - VE) F The PID controller will produce and to replate the Semperature by driving the cooling compressora variable rate. The pur is the combination of three components, the proportional the integral th) and the derivative D given by E420 E94. KK.Kare constants and at the sampling time Eq2 P) = 6,4) 160 - etesse SEEE SKEE 1022 e(t)-(-1) D(t)- Eq4 (a) The operation of the AC wit is as follows The initial state of the AC OFF 2 The wetums On the AC The meet) is zeto, and K.K.Ka 1.5, 1.0, respectively 3 The ser enters the spottement (5 The AC unit starts its operation and repeated following steps every second, that is at 1 The AC units the room tempe The PID with a Compute the ene between SV called e(t) and multiply it with the constant, El ii. Compute the integral (1) stich is the sum of error since the AC unit was started pled with the constant Kiste E92) i. Compute the Derivative, D(t), which is the difference between current emot (t) and the previous measured error et - 1) dinvaded by the sample time, at multiplied with Ke se 3) The output of the controller is the of Pt). (t) and (c) d. Check if the user has pressed the OFF button of the AC it. If go to step 3 5. AC Unit is powered down. Dew the flowchart for the operation of the AC 110 marks) (b) Write the MATLAB code to implement this controller. Use input as a means to read the user's set-point, and we disp as a means to show the controller output. The current room temperature can be obtained by calling the function CurrentRoon Tenperature that alle 110 marka Q11. A Proportional-Integral-Derivative (PID) controller is a closed-loop controller that is normally used in many industrial applications. For example, a PID controller can be used in an air-conditioner (AC) unit to control the room temperature. Let us assume that we have a PID controller-based AC unit. The desired temperature set by the user is called the set-point (S), while the current room temperature is called the process-variable (V). The difference between the S and the P is called the error at time t, e(t) = S(t)-V(t) Eq. 1 The PID controller will produce an output to regulate the temperature by driving the cooling compressor at a variable rate. The output is the combination of three components, the proportional (P), the integral (I) and the derivative (D) given by Eq. 2 to Eq.4. K,K, Kd are constants, and At is the sampling time. P(t) = Ke(t) Eq. 2 (t) = K Decy e(t) at Eq. 3 8 SEEE/SKEE1022 e(t)- e(t-1) D(t) = Ka At Eq. 4 (a) The operation of the AC unit is as follows: 1. The initial state of the AC unit is OFF. 2. The user turns ON the AC unit. The error e(t) is zero, and Kp. K.Ka are 1.5, 1.0, 0.5 respectively. 3. The use enters the set-point temperature (S). The AC unit starts its operation and repeats the following steps every 1 second, that is At = 1. a. The AC unit measures the room temperature (V). b. The PID algorithm starts i. Compute the error between S and V called e(t) and multiply it with the constant K, (see Eq.1). ii. Compute the Integral, I(t) which is the sum of error since the AC unit was started multiplied with the constant K (see Eq.2). iii. Compute the Derivative, D(t), which is the difference between current error, e(t) and the previous measured crror et-1) divided by the sample time, At multiplied with Kd. (see Eq. 3) c. The output of the controller is the sum of P(t), I(C) and D(D). d. Check if the user has pressed the OFF button of the AC unit. If no, go to step 3. 5. AC Unit is powered down. Draw the flowchart for the operation of this AC unit. (10 marks) (b) Write the MATLAB code to implement this controller. Use input as a means to read the user's set-point, and use disp as a means to show the controller output. The current room temperature can be obtained by calling the function CurrentRoomTemperature that returns a scalar value. (10 marks) SEEE/SKEE 1022 APPENDIXMATLAB Reference CONY Function Description and example of usage Absolute wa abs(X) is the absolute value of the elements of Convolution and polynomial munication C-conv(A,B) convolves Vectors and Ir A and I are vectors of polynomial coefficients, convolving them is equivalent to multiplying the two polynomials decony Deconvolution and polinomial division 10.R] -decony (B,A) deconvolves vector A out of vector B. The result is returned in vector and the remainder in vector R such tha B - conv (1,0) + R. If A and are vectors of polynomial coelicients, deconvolution is equivalent to polynomial division. The result of dividing by Ais quotient and remainder dir? Differences and approximate derivatives diftix) calculates differences between adjacent elements of X along the first array dimension whose site does not equal I. disp Display array disp (x) displays the array, without printing the array name fprint Write formatted data to text file. fprint (ORMAT, A, ... ) formats data and displays the results on the screen. input Prows for mer input RESULT - input (PROMPT) displays the PROMPT string on the screen, waits for input from the keyboard, evaluates any expressions in the input, and returns the value in RESULT. integral Numerical integration integral (Eun, xnin, xmax) numerically integrates function fun from xmin to xmax using global adaptive quadrature and default error tolerances interpl 1-D data interpolation interpl(x,V,xq, method) specifies an alternative interpolation method: 'linear', 'nearest.next', 'previous'.'pchip!, 'cubic!. 'v5cu bic', 'makima', or 'spline! mean Average or mean value of array mean (A) returns the mean of the elements of A along the first array dimension whose size does not equal 1. num2str Comert numbers to a string I - num2 str(x) converts the matrix X into a string representation T with about 4 digits and an exponent if required. Linear plot plot(X,Y) plots vector y versus vector X. If X or Y is a matrix, then the vector is plotted versus the rows or columns of the matrix, whichever line up prod Product of elements S = prod(X) is the product of the elements of the vector X. roots Find polynomial roots. roots (C) computes the roots of the polynomial whose coefficients are the elements of the Vector C Sort array elemente sort (A, direction) returns sorted elements of A in the order specified by direction using any of the previous syntaxes. 'ascend indicates ascending order (the default) and 'descend indicates descending order, stramp Compare strings strcmp(1,52) compares al and a2 and retums 1 (true) if the two are identical and O (false) otherwise xisread Read Microsoft Excel spreadsheet fille xlstead(filename, sheet, xlRange) reads from the specified worksheet and range. plot Dort