Simple Control System Design with XCOS - Scilab Tutorial

in #utopian-io6 years ago (edited)

What Will I Learn ? 

  • You will learn how to simulate dynamic systems in Xcos
  • You will learn how to design a simple feedback system with transfer function
  • You will learn Proportional, Integral, Derivative Gains

Requirements 

  • Basic programming knowledge
  • Basic control system design knowledge
  • Scilab 6.0.1 or higher

Difficulty

  • Basic

Tutorial Contents

Xcos is a very powerful tool which provides us building dynamic system with block diagram representation. Instead of just typing codes and check for spelling or other errors this tool uses blocks that are alreadly build and coded

Figure1: Block Representation in Xcos

By the help of Xcos what are we going to design is a feedback control system. Therefore, we should first know what is a feedback control system. It can be showed as in Figure [2];

Figure2: Feedback System

As can be seen from the Figure [2], a feedback system can be defined as; we have a dynamic system which responses to a given input and we are controlling it by the output. This kind of systems are called also Closed-Loop Systems. If we do not feed the output back into input these systems are called Open-Loop Systems. We are now feeding the output back and "Controlling" the system in a way but the important thing is that we need to control the system in a way that the system obeys certain requirements. These requirements can be achieved with different controlling techniques but in this tutorial i will talk about "Classical Control Techniques" Proportional, Derivative, Integral which is called PID controller. A PID controller is;

Figure3: PID Controller Scheme

Setting Up The System and Simulation

We will assume DC-Motor which is represented with a simple transfer function and its input is voltage and output is RPM and we will control the output with a PID controller. The transfer function is;

Figure4: DC-Motor Transfer Function Representation

From the Xcos Palette Browser the transfer function can be found from Continuous time systems/ CLR. Other blocks we need for simulation can be found from Palette Browser and typing search; STEPFUNCTION, SUMf, CMSCOPE, CLOCK_c, PID, GAIN, respectively. They are;

Figure5: Blocks Needed

Open-Loop vs Closed-Loop

Now, check both systems;

Figure6: Open-Loop

Figure7: Closed-Loop First set PID gains as;

Figure8: PID Gains

Responses of both Closed and Open Loop systems to a given step input are;

Figure9: Responses with PID = [1 1 1]
Now by adjusting the PID gains we will try to converge to given input. After several trials, I have found the PID gains as;

Figure10: New PID Gains

With the PID gains given in Figure [10] our Closed Loop response changes as;

Figure11: Response with PID = [28 19 0.5]
As we can see from the Figure [11], our control system works really good with small error we have converged to the given input. We can see the importance of the control system in this example. I hope this tutorial will be helpful for you guys. Thank you :)

Proof of Work

Sort:  

Thank you for your submission.

Submissions in the tutorials category are expected to provide insightful content in order to teach the technical aspects of an open source software with GitHub repository. Therefore, contributors first specify the repository of the project they contribute at the beginning of the submission. And then , as the main point, they should teach about the software.

The submission provides information about design of a control system, and yes it is using an open source software, but contributions in tutorials should provide usage of this kind of software. Providing results and design schemes is more about the science itself, not the software. This is also stated in the Utopian Guidelines even though control systems are not directly specified. I encourage you to read them for your future contributions.

Also, contributors are responsible about the rights of the visual content they use in the submissions. So, every visual in the submissions should be properly referenced and proven to be licensed under a Creative Commons license.

Guideline References:

  • Contributions in this category include technical instructions using text and illustrations to clearly explain and teach significant aspects of an Open Source project.
  • Submissions addressing only circuit design and/or the build of specific electronic modules will be not be considered for potential reward.
  • Images and videos used must be distributed under the Creative Commons license and content source must be cited (when applicable).

Regarding the reasons stated above, the submission is not considered in the voting phase. I hope these instructions are helpful enough to clarify the situation. I wish to see you contribute with better content to the open source community.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @roj
Here's a tip for your valuable feedback! @Utopian-io loves and incentivises informative comments.

Contributing on Utopian
Learn how to contribute on our website.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!