Implementing a PID Controller in Simulink

[meteor_slideshow slideshow="slide1"]

TITLE TABLE OF CONTENTS PAGE

OBJECTIVE………………………………………………………………………..2

PROCEDURE………………………………………………………………………2

RESULTS AND CALCULATIONS……………………..…..……………………..3

DISCUSSION……………………………………………………………..………..8

CONCLUSION………………………………………………………….……………9

QUESTIONS……………………………………………………………………….9

APPENDIX A……………………………………………………………………….10

Objective:

The main purpose of this laboratory exercise was to use Simulink modeling to represent and simulate a mathematical model that represented a physical system. In this lab, a toy train was considered, which consisted of an engine and a car. Control to the train was applied so that it started and stopped smoothly in addition to tracking a constant speed command with minimal error in steady state. In week one, a Simulink model of the toy train was constructed and ran in Simulink to examine the velocity output. In week two, Simulink was employed for generating the linearized model and MATLAB was employed for designing the controller, which allowed control to the train engine to start and stop smoothly.

Procedure:

Week 1: Introduction to Simulink Modeling

In week one of the experiment, a toy train was considered for employing control over starting and stopping the train smoothly, in addition to tracking a constant speed with minimal error in steady state. The mass of the engine and the car (M1 and M2 respectively) were connected through a coupling with a stiffness k. The force represented the force generated between the wheels of the engine and the track, while represented the coefficient of rolling friction. A free body diagram was most appropriate in deriving the mathematical equations that govern the physical system. (Refer to Appendix A) Applying Newton’s second law in the horizontal direction based on the free-body diagram, two equations were derived for the train system. (See Appendix A) These specific sets of equations were represented graphically without further manipulation. Lastly, two copies were constructed (one for each mass) of the general expression . (Please refer to lab guide, “Laboratory Exercise 5: Simulink Modeling-Train System: Week 1,” for a complete step-by-step procedure to examine the velocity output of the train)

Week 2: Implementing a PID Controller in Simulink

In week two of the experiment, the main goal was to apply control to the train engine so that it started, and came to a stop smoothly. A linear approximation of the train was generated and the linearized model was used to design a controller using analytical techniques. Simulink was then employed to simulate the performance of the controller when applied to the full nonlinear model. In addition, Simulink was employed for generating the linearized model and MATLAB was employed for designing the controller. (Please refer to lab guide, “Laboratory Exercise 5: Implementing a PID Controller in Simulink: Week 2,”for a complete step-by-step procedure)

Results and Calculations:

Week 1: Introduction to Simulink Modeling

Results of the week 1 experiment showed how the velocity output of Figure 2 represented the train velocity given by the model portrayed in figure 1. It was important to note that the input was a square wave with two steps: one positive and one negative. This represented that the engine first went in the forward direction, and then backward. The velocity output of Figure 2 clearly represents the engines movement.

Matthew Meyer, Jaffer Alkubaish, Muhanad Almunami, Assem Shaikh

Figure 1: A mathematical Simulink model that was constructed and simulated to demonstrate how to employ Simulink in order to design and simulate the control system for the train. The “x1_dot”scope was used to examine the velocity output of the train engine.

Figure 2: A schematic representation of the velocity output with a two-step square wave portraying the movement of the engine in the forward and backward direction.

Week 2: Implementing a PID Controller in Simulink

In week two of the experiment, a linear approximation of the train engine was generated and the linearized model was used to design a controller. Figure 3 depicts the velocity output of the closed-loop system. Results show that the closed-loop system was unstable for the controller and therefore needed to be redesigned. Figure 4 shows the redesign of the Simulink model with a step response of the linearized model which was automatically generated. Figure 5 shows that once the LTI object was exported into the MATLAB workspace, all of the facilities that MATLAB had to offer could be employed for control design. For example, referring to Figure 5, the closed-loop system in its current state had poles with positive real parts, concluding that it was unstable. In order to stabilize the response, the controller needed to be tuned by identifying the input and outputs of the closed-system that needed to be analyzed. MATLAB was ultimately employed to design this new controller. Figure 6 shows that with a large gain, the result is an unstable response due to the root locus gain in Figure 7. Once the loop gain was reduced sufficiently however, the system was eventually stabilized. Figure 9 shows that if the gain was reduced to approximately 0.1, the response eventually stabilized depicted in figure 8. While the response appeared to be stable, the steady-state error was quite large.

Figure 3: A schematic showing the results of the velocity output (x1_dot) of the engines closed loop system. Since the performance achieved is unsatisfactory, the controller needed to be redesigned.

Figure 4: A step response of the linearized model portion performed in Simulink.

Figure 5: A command employed in MATLAB to analyze the closed loop system that reflected the Simulink model created in Figure 4.

Figure 6: The step response portraying instability within the system due to the root locus plot.

Figure 7: A root locus plot portraying the closed-loop pole locations of the train system plant under simple proportional control.

Figure 8: A step response portraying stability with a large steady state error due to a gain of approximately 0.1 on the root locus plot shown in Figure 9.

Figure 9: A root locus plot portraying a loop gain of 0.103 used to stabilize the system.

Discussion:

I: Week 1: Introduction to Simulink Modeling

In this laboratory exercise, two separate portions of the lab were conducted to analyze a control system of a model train. In week one, a model was constructed in Simulink to examine, and analyze the velocity output of the plant. This was done by using the Simulink library to construct the model shown in figure 1 and assigning numerical values to each of the variables used in the model. Once the simulation was processed, the “x1_dot” scope was examined for the velocity output. According to Figure 2, the input was a square wave with two steps, one positive, and one negative resulting in the forward and backward motion of the engine.

II: Week 2: Implementing a PID Controller in Simulink

In week two of the experiment, a PID controller was implemented in Simulink to stabilize the engine. This was done by creating a Subsystem and employing a PID controller in series with the train subsystem. In order to control the train’s velocity, a feedback loop was constructed by attaching a line from the negative sign of the sum block to the “x1_dot” signal line. The output of the sum block was the velocity error for the train engine and was eventually connected to the input of the PID controller block.

In order for the train to smoothly increase in speed and smoothly come to a rest, a signal builder block was implemented into the system which represented the velocity of the train. A step function was created with a maximum time field of 300 seconds, along with a step up to occur at 10 seconds, and a step down to occur at 150 seconds. For the file to run successfully in MATLAB, a variety of parameters were used in the model for the train system. Once the m-file was executed in the MATLAB command window, results showed a very unstable system according to figure 3. The system was redesigned by extracting a model from Simulink into MATLAB for analysis and design. Comparing the step response shown in Figure 4 to the one generated by the simulation of the open-loop train system, it was concluded that the responses were identical. In addition, the linearization process generated the object linsys1, which is depicted in the Linear Analysis Workspace shown in Figure 4. Once the model was extracted and placed into the MATLAB Workspace, MATLAB was able to employ commands that reflected the Simulink model as shown in Figure 5. By examining Figure 5, the closed-loop system had poles with positive real parts, and therefore, was unstable.

For the controller to gain stability, Simulink was used to tune the controller instead of MATLAB. In order for the controller to be tuned, the input and output signals were first identified. Then, the tune block was initiated and the design plots were chosen for the controller which happened to be root locus plots. The root locus plots displayed the closed-loop pole locations of the train system plant under simple proportional control. Referring to Figure 7, the values of the loop gain were placed such that the response appeared to be unstable in Figure 8. The poles were adjusted such that a gain of approximately 0.1 was achieved in Figure 9 to stabilize the system. Figure 8 shows that after approximately 125 seconds, the system stabilized.

Conclusion:

The Results of the experiment showed how Simulink and MATLAB worked together to represent and simulate a mathematical model which represented a physical system. In this case a train system was used to analyze the velocity of starting and stopping smoothly. In addition, the mathematical equations, governed by Isaac Newton that represent a given system, served as the basis for Simulink modeling a train in this laboratory exercise. Ultimately, the main advantage of using the Simulink modeling for the analysis of dynamic systems was that is allowed for quick analysis for a response of a complicated system that may be much too difficult to solve by hand.

Overall the experiment was successful in determining the response control of the train system. This lab gave a detailed explanation of how to control a dynamic system of a train so that it started and stopped smoothly, in addition to tracking a constant speed command with minimal error in steady state. However, it was somewhat difficult to minimize the error in steady state. The error may have been reduced if the locus points were adjusted closer to a gain of 0.1. This lab gave another great explanation of how control systems work in the real world, and how it corresponds to what is being learned in class.

10

[meteor_slideshow slideshow="slide3"]

Are you looking for a similar paper or any other quality academic essay? Then look no further. Our research paper writing service is what you require. Our team of experienced writers is on standby to deliver to you an original paper as per your specified instructions with zero plagiarism guaranteed. This is the perfect way you can prepare your own unique academic paper and score the grades you deserve.

[meteor_slideshow slideshow="slide2"]

Use the order calculator below and get ordering with idealtermpapers.com now! Contact our live support team for any assistance or inquiry.

[order_calculator]

Purchase Guarantee

Why ORDER at IdealTermPapers.com?

  • Educated and experienced writers.
  • Quality, Professionalism and experience.
  • Original Content writing.
  • Best customer support.
  • Affordable Pricing on orders.
  • Thorough research.
  • Ontime delivery of finished work.
  • 100% plagiarism free papers.

Reasonable Prices

  • To get the best quality papers isn’t cheap so don’t trust extremely low prices.
  • We can’t claim that we have unreasonably low prices because low prices equal to low quality.
  • Our prices are good and they balance with the quality of our work.
  • We have a Moneyback guarantee.

Original and Quality work

  • Our writers are professionals and they write your paper from scratch and we don’t encourage copy pasting.
  • All writers are assessed and they have to pass our standards for them to work with us.
  • Plagiarism is an offence and it’s never tolerated in our company.

Native Writers plus Researchers

  • Our writers are qualified and excellent and will guarantee the best performance in your order.
  • Our team has writers who have master's and PhD qualifications who can handle any assignment
  • We have the best standards in essay writing.

We have been in business for over 7 syears

  • We have always served our customers from all over the world and they have continued to order with us.
  • We value our customers since they have trusted us to do their assignments.
  • We are competent in our writing gained from experience over the years
  • Our company has 24/7 Live Support.

You will get

  •  Custom Admission Essay written by competent professional English writers.
  •  Free revisions according to our revision policy if required
  •  Paper format:  275 words per page, Times New Roman font and size 12, doublespaced text and1 inch margin
  •  On time delivery and direct order download
  •  Privacy guaranteed

We can help you:

  •  acquire a comprehensive professional presentation.
  •  get a unique and remarkable content as per your instructions.
  •  Get an additional portion that can be included to your existing presentation;
  •  turn your work in to an eyecatching presentation with well communicated ideas.
  •  improve your presentation to acquire the best professional standards.