MathWorks - Mobile View
  • Melden Sie sich bei Ihrem MathWorks Konto anMelden Sie sich bei Ihrem MathWorks Konto an
  • Access your MathWorks Account
    • Eigener Account
    • Mein Community Profil
    • Lizenz zuordnen
    • Abmelden
  • Produkte
  • Lösungen
  • Forschung und Lehre
  • Support
  • Community
  • Veranstaltungen
  • MATLAB erhalten
MathWorks
  • Produkte
  • Lösungen
  • Forschung und Lehre
  • Support
  • Community
  • Veranstaltungen
  • MATLAB erhalten
  • Melden Sie sich bei Ihrem MathWorks Konto anMelden Sie sich bei Ihrem MathWorks Konto an
  • Access your MathWorks Account
    • Eigener Account
    • Mein Community Profil
    • Lizenz zuordnen
    • Abmelden

Videos und Webinare

  • MathWorks
  • Videos
  • Videos Homepage
  • Suche
  • Videos Homepage
  • Suche
  • Vertrieb kontaktieren
  • Testsoftware
  Register to watch video
  • Description
  • Full Transcript
  • Code and Resources

PID Controller Design in Simulink

Arkadiy Turevskiy, MathWorks

Design a PID controller for a DC motor modeled in Simulink®. Create a closed-loop system by using the PID Controller block, then tune the gains of PID Controller block using the PID Tuner.

In this demonstration you will see how to quickly tune the PID controller for a planned model in Simulink.

In this particular case, we model the DC motor. In this block dialog are the parameters that define the behavior of the motor: damping, inertia, back EMF, resistance, and inductance.

Working on their block mask we see Simscape and Simutronics blocks. We use the model as a motor. We will not design the digital control systems that will control the rotation speed of the motor shaft. The controller will calculate the error signal between the desired speed and the measured speed, and it uses our signal to calculate the voltage request to command to the motor.

Notice that we are modeling sensor noise in the measurement channel, and because our control system is digital, they are also modeling an A to D converter is a sampling time off 0.02 seconds, using a zero order over the whole block.

You now need to add the compensator. To do that, we go to Simulink Library Browser and just create sub library. Take discrete PID controller block and add it to our model. Let's now connect this block to the rest of our model and open the block dialog.

Here we can specify the type of controller we want to use: PID, PI, PD, proportional, or simply integral. We will stay this at PID. We can specify the sampling time. In this case we'll use the same one as we used in our A to D converter. And if you know the gains of the PID controller, we can type them in here. In this case, we don't know what the gain should be yet, so let's apply the sampling time changes and try running the simulation as default gain values. Let's also add voltage to our scope.

Running the simulation, we see that our control system was not doing all that well. Blue lines show the desired speed, and a red line shows actual measured speed. As we see, our control system is not tracking very well. Let's try to improve that performance. To do that we'll go back to the block dialogue and press the Tune button.

This launch has paired the tuner, which linearizes a plan, calculates PID gains, and opens a graphical user interface. In the graphical user interface we see two lines. The dashed line shows a closed loop step response of our system for the current gain values. And solid lines show the same response for calculated gain values.

So let's simply accept the gains to calculate it for us. When we do that, we see that our block parameters, PID gains, get updated. Let's press OK, go back to our simulation, and rerun it. As we see, we indeed improve the performance of our control system. It is now tracking very well with zero steady state error. It's relatively fast and has relatively little overshoot.

If you want to improve the performance of our control system, we can come back to the PID tuner graphical user interface and, for example, try to make the overshoot a little lower, if you want that. Or if you want faster response, we could try to use a slider here to move it to the right to make the system response faster.

For example, let's try this design. We now go back to our model and we run the simulation with this design. We see that we indeed get much faster response, but at the expanse of much noisier and much higher voltage request signal, so we are probably sacrificing actuator life to achieve this faster response.

Now, this is a trade-off you can decide on as an engineer, but you now have this tool at your disposal that lets it quickly design and tune PID controllers for plans modeled in Simulink. This concludes the demo.

Download Code and Files

Download Example Files

Related Products

  • Simulink Control Design

Learn More

PID Control with MATLAB and Simulink
EE Journal Chalk Talk: Simulation-Based Tuning of Power Electronics Controllers (21:43)
Boost Converter Simulation Resources
Join the Power Electronics Control Design Community
How to Automatically Tune PID Controllers (6:00)

DOWNLOAD CODE

Get the example files used in this video

Feedback

Featured Product

Simulink Control Design

  • Request Trial
  • Get Pricing

Up Next:

5:40
PID Controller Tuning for a Model with Discontinuities

Related Videos:

29:01
Design and Optimize MEMS Devices with Coventor MEMS+ and...
19:54
Time-Delay Systems: Analysis and Design with MATLAB and...
2:02
What Is Simulink Control Design?
4:51
Gain Scheduling of PID Controllers

View more related videos

MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web site

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Vertrieb kontaktieren
  • Testsoftware

Produkte

  • MATLAB
  • Simulink
  • Software für Studierende
  • Hardware-Unterstützung
  • File Exchange

Testen oder Kaufen

  • Downloads
  • Testsoftware
  • Vertrieb kontaktieren
  • Preise und Lizenzierung
  • Store

Lernen

  • Dokumentation
  • Tutorials
  • Beispiele
  • Videos und Webinare
  • Schulungen

Support

  • Hilfe zur Installation
  • Antworten
  • Consulting
  • License Center
  • Support kontaktieren

Über MathWorks

  • Jobs & Karriere
  • Newsroom
  • Social Mission
  • Vertrieb kontaktieren
  • Über MathWorks

MathWorks

Accelerating the pace of engineering and science

MathWorks ist der führende Entwickler von Software für mathematische Berechnungen für Ingenieure und Wissenschaftler.

Entdecken Sie…

  • Select a Web Site United States
  • Patente
  • Handelsmarken
  • Datenschutz
  • Datendiebstahl verhindern
  • Status von Anwendungen

© 1994-2021 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Folgen Sie uns

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic.  By continuing to use this website, you consent to our use of cookies.  Please see our Privacy Policy to learn more about cookies and how to change your settings.