College of Engineering: Department of Mechanical Engineering MENG232L: Control Systems Laboratory Experiment 2: Block Diagrams Reduction Instructor: Arij Hawary March 20, 2023 Noella Hasna 201901393 Aya Ataya 202002305 1 Table of Content List of Figures ............................................................................................................................. 3 Abstract ........................................................................................................................................ 4 Introduction .................................................................................................................................. 5 Methods and Materials ................................................................................................................. 7 Problem 0 .....................................................................................................................................8 - MATLAB Code ...............................................................................................................8 - Results ..............................................................................................................................8 Problem 1 .....................................................................................................................................11 - MATLAB Code ...............................................................................................................11 - Results ..............................................................................................................................12 - Discussion ........................................................................................................................15 Problem 2 ....................................................................................................................................16 - MATLAB Code ...............................................................................................................16 - Results ..............................................................................................................................16 - Discussion ........................................................................................................................18 Problem 3 .....................................................................................................................................19 - Simulink Design...............................................................................................................19 - Results ..............................................................................................................................20 - Discussion ........................................................................................................................21 Conclusion ...................................................................................................................................22 References ....................................................................................................................................23 2 List of Figures Figure 1: Pole-Zero Map of Problem 0 ........................................................................................ 11 Figure 2: Pole-Zero Map of Problem 1 ........................................................................................ 14 Figure 3: Pole-Zero Map for Problem 2 ..................................................................................... 18 Figure 4: Simulink Design for Problem 3 ................................................................................... 20 Figure 5: Step Response of Simulink Design ............................................................................. 20 3 Abstract Experiment 2 aims to study the wide world of block diagrams and studies how to implement them using the transfer functions. Furthermore, MATLAB is an essential tool for designing codes and systems, and MATLAB matrix calculations and plotting can aid in calculations and provide a better view of the experiment. Simulink is a modeling and simulation tool for dynamic systems that includes a graphical editor, customizable block libraries, and solvers. Conjointly, transfer functions can be demonstrated as either continuous-time or discrete-time functions, and block diagrams are a significant topic in control engineering. These transfer functions will be utilized to implement and design block diagrams. 4 Introduction Knowing more about MATLAB in the control lab will help with a lot with future experiments and projects. As mentioned in the previous labs, MATLAB is a very essential tool to work on to design codes and systems. Matrix calculations can provide a quick but accurate approximation to much more complicated calculations. Plotting on MATLAB can help with calculations and provide a better view of the experiment in the control lab. In addition to that, Simulink was introduced in this experiment. Simulink is a dynamic system modeling and simulation tool that includes a graphical editor, customizable block libraries, and solvers. It is MATLAB-integrated, allowing you to incorporate MATLAB algorithms into models and export simulation results to MATLAB for further analysis. We worked on block diagrams; the block diagram is made up of unidirectional operational blocks that represent the transfer function of the variable of interest. The block diagram of a given system's representation can frequently be reduced to a simplified block diagram with fewer blocks than the original block diagram. Furthermore, transfer functions are an important subject in control engineering because they define the relationship between a system's input and output in the frequency domain[1] . Transfer functions in MATLAB can be expressed as either continuous-time or discrete-time functions. A continuous-time transfer function is expressed as a ratio of polynomials in the Laplace domain, with the numerator representing the system's output and the denominator representing the system's input. 5 Syntax used: conv(): Convolution of two input signals is performed by the conv() function. The conv() function may be utilized to calculate the overall transfer function of a system made of many sub-systems or blocks by convolving their respective transfer functions. tf(): To generate a transfer function object from a collection of numerator and denominator coefficients, use the tf() function. The transfer function object that results can be used to assess the system's behavior and performance, as well as to construct controllers or filters to optimize the system's responsiveness. pzmap(): The pzmap() function is utilized to map the transfer function poles and zeros on a complex plane, resulting in a useful graphical tool for understanding the system's stability and behavior. pole(): The pole() function computes the poles of the transfer function which are the values of the system's characteristic equation that define the system's stability and behavior. zero(): The zero() function is utilized to estimate the zeros of the transfer function, which are the input frequency values at which the system output is zero. sys=feedback (sys1, sys2, sign): The feedback command is employed to generate a closed-loop transfer function by linking a specified system to a feedback loop. The resultant closed-loop transfer function captures the system's total reaction. In which "sys1" is the system in control, "sys2" is the feedback system, and "sign" determines the feedback loop's sign (1 for negative feedback and -1 for positive feedback). 6 Methods and Materials In this lab we will utilize MATLAB to understand the grounds of block diagrams. MATLAB is a high-performance programming language used in technical computing. It combines computing, visualization, and programming in a user-friendly environment in which problems and answers are expressed in common mathematical notation. MATLAB is an active system with an array as its basic data unit that does not need dimensioning. This enables us to tackle many technical computing issues, particularly those using matrix and vector formulations, in a fraction of the time required to build a program in a scalar noninteractive language. It is the standard teaching tool for introductory and advanced mathematics, engineering, and science courses. MATLAB is the global norm for efficient research, production, and analysis. Simulink is a graphical programming environment that may be used to model, simulate, and analyze dynamic systems. It is frequently utilized for the design and simulation of control systems, signal processing systems, communication systems, as well as other difficult technical systems. Simulink simulates and analyzes the model's behavior under various conditions, such as altering inputs or settings. Simulink is broadly applied in industries like as automotive, aerospace, defense, and electronics, and it is also used for educational purposes in research and education. 7 Problem 0: 1. MATLAB Code: %Introduce the matrices according to our university IDs %Aya: 202002305 %Noella:201901393 %The first part of the ID will be the numerator whereas the second part will be the denominator. %The block diagrams are in series, so we need to multiply the two cascaded blocks numA=[2 0 2 0] denA=[2 3 0 5] numN=[2 0 1 9] denN=[1 3 9 3] %We need to use the convolution function in order to multiply two functions in the s domain numH=conv(numA, numN) denH=conv(denA, denN) %the transfer function is the H=output/input H=tf(numH,denH) %Then we want to find the zero-pole map of the transfer function using pzmap pzmap(H) P=pole(H) Z=zero(H) 2. Results: numA = 2 0 2 0 3 0 5 denA = 2 8 numN = 2 0 1 9 3 9 3 0 6 18 2 18 0 9 27 38 24 45 15 denN = 1 numH = 4 denH = 2 H = 4 s^6 + 6 s^4 + 18 s^3 + 2 s^2 + 18 s ---------------------------------------------------2 s^6 + 9 s^5 + 27 s^4 + 38 s^3 + 24 s^2 + 45 s + 15 Continuous-time transfer function. 9 P = -1.3129 + 2.5087i -1.3129 - 2.5087i -2.0786 + 0.0000i 0.2893 + 1.0578i 0.2893 - 1.0578i -0.3742 + 0.0000i Z = 0.0000 + 0.0000i -1.5501 + 0.0000i 0.7751 + 1.5173i 0.7751 - 1.5173i 0.0000 + 1.0000i 0.0000 - 1.0000i 10 Figure 1:Pole-Zero Map of Problem 0 Problem 1: 1. MATLAB Code: %Introduce the matrices according to the two block diagrams num1=[1 1] den1=[1 2] num2=[1] den2=[200] %The two blocks are cascaded, meaning that in order to find the transfer function we need to multiply the numerator and denominator of the first block with the corresponding numerator and denominator of the second block (done using the convolution function) num=conv(num1,num2) den=conv(den1,den2) 11 % After simplifying the blocks into one single block we can now find the transfer function of the simplified block using the tf() command. sys1=tf(num,den) %We have a closed-loop and we set the feedback to 1 sys=feedback(sys1,1) %We plotted the zero-pole map to find the zeros ad poles of the system pzmap(sys) P=pole(sys) Z=zero(sys) 2. Results: num1 = 1 1 den1 = 1 2 num2 = 1 den2 = 200 num = 1 1 den = 200 400 sys1 = 12 s + 1 ----------200 s + 400 Continuous-time transfer function. sys = s + 1 ----------201 s + 401 Continuous-time transfer function. P = -1.9950 Z = -1 13 Figure 2: Pole-Zero Map of Problem 1 Figure 2 characterizes the Zero-Pole Map of two cascaded blocks. As a result, feedback control systems can be analyzed and designed using the zero-pole map of a cascaded block diagram with unity feedback. We can produce superior closed-loop performance characteristics by adjusting the zero locations in the open-loop transfer function. This is a key concept in control system engineering, where the goal is to create a system that satisfies specific requirements. 14 3. Discussion: Cascaded block diagrams are a sort of control system diagram that depicts the cascaded connection of various control systems. In other words, the blocks are connected in series. The output of one control system is utilized as the input for the next control system in a cascaded system, resulting in a succession of nested feedback loops. The cascaded block diagram generally depicts the system's individual blocks, with arrows illustrating the flow of information between them. The inputs to the first block in the system are normally the system's external inputs, and the output of the last block is frequently the system's output. Moreover, to simplify cascaded blocks we multiply the functions of these blocks, and then find the transfer function of their result (See MATLAB Code). Consequently, obtaining the final transfer function. A cascaded block diagram with unity feedback is a sort of control system diagram in which a sequence of individual blocks are connected, with the output of each block feeding into the input of the next block. The system's final output is obtained from the output of the last block and fed back into the first block's input. Because the feedback link has a gain of one, it is referred to as "unity feedback." When unity feedback is maintained, the closed-loop transfer function of the system can be calculated by dividing the product of the individual block transfer functions by the quantity (1 + the product of the individual block transfer functions). To assess and build the system, use the zero-pole map of a cascaded block diagram with unity feedback. To illustrate the system's behavior, plot the zeros and poles of the transfer function on a complex plane. The location of the poles of the closed-loop transfer function can be utilized to identify the system's stability and transient response characteristics. The location of the zeros of the transfer function can be utilized for creating the system's closed-loop response in cascaded 15 block diagrams with unity feedback. The placement of the transfer function's zeros, in particular, can be exploited to produce desirable performance characteristics. Problem 2: 1. MATLAB Code: %Introduce the matrices according to the two block diagrams % now we find the transfer function using the tf() command. num1=[1] den1=[200 0 0] A=tf(num1,den1) num2=[1 1] den2=[1 2] N=tf(num2,den2) % Now we can find the overall function of the system using the sys=feedback() command sys=feedback(A,N,1) %We plotted the zero-pole map to find the zeros ad poles of the system pzmap(sys) P=pole(sys) Z=zero(sys) 2. Results: num1 = 1 den1 = 200 0 0 A = 16 1 ------200 s^2 Continuous-time transfer function. num2 = 1 1 den2 = 1 2 N = s + 1 ----s + 2 Continuous-time transfer function. sys = s + 2 ------------------------200 s^3 + 400 s^2 - s - 1 Continuous-time transfer function. P = -2.0012 0.0506 -0.0494 Z = -2 17 Figure 3: Pole-Zero Map of Problem 2 3. Discussion: A feedback connected block diagram (FCBD) is a graphical illustration of a system with feedback loops. It is made up of a series of blocks that depict the various system elements. One or more of the blocks in a feedback connected block diagram are connected in a loop, with the output of one block fed back to the input of another. This feedback loop enables the system to modify its behavior in response to its output, making it more suitable to changing conditions. Feedback connected block diagrams are widely used in control system engineering to help designing engineers see the interactions between various components and predict the behavior of the system. 18 The closed-loop transfer function can be achieved by linking the plant's output to the controller's input and the controller's output to the plant's input. To create the zero-pole map, we must first determine the closed-loop transfer function. We could then divide it into a numerator and a denominator. The zeros of the transfer function are the numerator's roots, and the poles are the denominator's roots. The zeros and poles' positions can provide valuable information about the closed-loop system's performance. To illustrate more, if there are any zeros in the right half of the plane, it indicates that the closed-loop system is unstable. However, if there are poles in the right half of the plane, the system is undoubtedly unstable. If the poles are closer to the imaginary axis, the system responds slowly, whereas if they are closer to the origin, the system responds quickly. Because the blocks are connected in series, the overall system's poles and zeros are simply the sum of the poles and zeros of each individual block in a cascaded block diagram. As a result, by adding the pole-zero maps of each individual block, the pole-zero map of a cascaded block diagram can be obtained. In a feedback connected block diagram, the feedback loop influences the overall system's poles and zeros, which can bring in new poles and zeros that are not present in the individual blocks. The roots of the characteristic equation, which would be acquired by establishing the denominator of the transfer function to zero, determine the poles of a feedback system. The roots of the numerator of the transfer function ascertain the zeros of a feedback system. Problem 3: 1. Simulink Design: The below figure illustrates the built block diagram on Simulink. The second and third block are cascaded together and feedback to -1. 19 Figure 4:Simulink Design 2. Results: Figure 5: Step Response of Simulink Design Figure 5 depicts the step response of the Simulink design in figure 4. The step response can be found by pressing on the scope. 20 3. Discussion: A step response is a control engineering measurement that evaluates the behavior of a system responding to a sudden change in its input signal. It measures a system's output when the input signal begins to change from one constant value to another. The step response can be used to assess the functionality of a system. Customarily, the step response is plotted on a graph that depicts how the system responds over time, with the input step on the x-axis and the output response on the yaxis. In figure 5, we can see that the response began at a value of 2, and then decreased to reach a constant value of 1. Since the step function, which is the system's input signal, has a value of 1 for all times greater than or equal to 0, the step response of a block diagram usually starts as high and then reaches a constant value of 1. The step response is the output of a control system when the input is a step function. The step response measures the system's ability to react to changes in input. When the step function is applied to the system, it responds quickly at first and the output rises to a high value. This is due to the system attempting to modify to the input modification. The system's response slows over time until it remains stable at a constant value of 1. The time it takes for the system to stabilize is determined by system characteristics such as gain, time constant, and damping. A well-designed system will quickly stabilize and track changes in input. 21 Conclusion As a conclusion, this experiment aimed to achieve several goals. Some of were to explore block diagrams, examine transfer functions, and plot the zero-pole plot. Acknowledging transfer functions in MATLAB is critical for a variety of reasons. Transfer functions are required for the design and analysis of control systems. You can utilize transfer functions in MATLAB to simulate a system's behavior and then develop a controller that fulfills certain performance standards. Transfer functions are also useful for analyzing linear systems. In addition to that, SIMULINK was used to design block diagrams and find their step responses. Block diagrams are an effective tool for modeling illustrating complex systems, particularly those with many interconnected components. A cascaded block diagram is a collection of interconnected blocks in which the output of one block is fed into the input of the next. The cascaded system's overall transfer function is the sum of the transfer functions of each individual block. However, a feedback block diagram, contains a loop in which the system's output is fed back into the input. The overall feedback system transfer function is more complicated and can be ascertained using tools. 22 References [1] Introduction. What is Matlab. (n.d.). Retrieved March 12, 2023, from https://cimss.ssec.wisc.edu/wxwise/class/aos340/spr00/whatismatlab.htm [2] MathWorks Help Center. (n.d.). Pole and Zero. MATLAB & Simulink. Retrieved March 12, 2023, from https://www.mathworks.com/help/control/ug/pole-and-zero-locations.html [3] University of Ansariyah. (2017). Transfer function and block diagram of control system . Retrieved March 20, 2023, from https://uomustansiriyah.edu.iq/media/lectures/5/5_2018_11_05!11_10_37_PM.pdf 23