We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hai...I have a question about P controller for speed control. I have no idea on how to create a P controller for speed. Do I have to find the gain by doing the experiment. I develop it by using the microsoft VC++. The set point is speed of the motor in RPM and a steeping motor is used to control the rotation of the DC Brushless motor.How about the error. Do I need to find the values of error first by doing the experiment. I have no experience on designing the controller. I am waiting for the idea from members. Thank You. Bye...
I develop it by using the microsoft VC++. Then what are you doing in a Keil forum? Erik
agus, There are certainly plenty of methods of self-tuning that would enable you to determine a gain at run-time, but given your level of expertise, I would just try to find a good one experimentally. A P controller (or proportional only) is one that just corrects a specified percentage of the error signal each time. For instance, imagine you have a variable called "DesiredSpeed" that represents the speed you want the motor to spin at, and "ActualSpeed" that represents the real speed of the motor that you've just gotten by some measurement method (an encoder, back-emf, etc.). Also assume you have a variable called "PropGain" that is a float from 0.0 to 1.0 and a variable called "Control" that represents the control signal you're outputting to adjust the motor speed. The error signal is then: Error = DesiredSpeed - ActualSpeed; After each time you check the speed, you would perform an adjustment to the control output like this: Control = Control + (PropGain * Error); So... setting a PropGain of, say, 0.5 means that you will make an adjustment to the control signal that is 50% of the magnitude of the most recent error. That, in a very simplified form, is all there is to a P controller.
Thank You Mr Jay Daniel and Erik for your help. From the equation of the P controller only, Control=Control + (PropGain*Error) by assuming the PropGain is ranging from 0 to 1. I am not really understand about the variable Control. I guess the variable Control here is the input pulse to the motor. It is means that if the error is large or the different of value between desired speed and the present speeed is large, there are a lot of numbers of pulse is produced by the motor controller board until the errror is become zero. When the error is zero, what happen to the numbers of pulse? I guess that the controller board stop producing the pulse numbers. Let take the example in my project. A pulse is given to the motor and a rotary encoder is used to monitor the RPM of it. After doing the experiment I found that by giving 590 pulse it give almost the same value of RPM after doing 4-5 time experiment. The different here is only the rise time to reach the stable RPM. As in my project, can I use P controller to reduce the rise time. After doing many time experiment I found the by giving the pulse number 590 the average of RPM is 30RPM. From your explaination, 30RPM will be a desired speed, I guess. The error here is, Error=(30RPM-Actual Speed). PropGain is assuming from 0-1.0. How about a variable "Control"? It is means that the pulseout. Sorry for asking you with a long question. Thank You.
Agus, Yes... the "control" signal can have something to do with your pulse output, and the speed feedback can be in any units you like (like pulses/second from an encoder). What you would likely do in convert your desired "speed" into a "desired number of encoder pulses per second" and compare that to the "actual number of encoder pulses per second." The equations I gave you aren't quite literal. They're just the basic idea of a proportional controller. You'll have to look at your situation and decide what your control signal is and what feedback you get from your process, etc.
Hai...Erik..I try to search the example of the PID algorithm by Internet but I have not found the algoritm that is made by microsoft VC++ for reference. Most of the example from net is written in C#. I am now still studying on how to understand and write it in VC++. If you have a sample for me to use as a reference, I will appriciate it. My problem is coding the algorithm and I still try to understand the code in VC++. Bye. Agus.
I try to search the example of the PID algorithm by Internet but I have not found the algoritm that is made by microsoft VC++ for reference Most likely becauce VC++ is singularily unfit for real time. I can not, in my wildest imagination, see an application for PID that is not real time. C# is an attempt to make a PC mimic real time. Erik
Erik, I don't think C# does much of anything to make it mimic real-time. It's just Microsoft's invented language for targeting their .NET framework. It's kindof their answer to Java (i.e. you don't "port" code for other machines, you just write another "virtual machine"). It has some advantages, however, in that it's not purely interpreted like Java, but is instead compiled to MSIL (Microsoft Intermediate Language). What makes it much less real-time, however, is that it (like java) includes a garbage collecter which can fire pretty much whenever it feels like it and take up as much time as it finds necessary. In most cases it will actually be significantly slower and less real-time than native Win32 code written in VC+
OK, I stand corrected. I am a member of the cleaning ladies trade union (I do not do windows) and just happened to overhear the other days "we need c# for real time" when some of the users of that wonderful product were talking in a meeting about them interfacing to my stuff. Erik
Good God... that is indeed a scary proposition that that was being made as an argument IN FAVOR of C#. Well... to each his own. I used to be a major Windows programming hater, but have come to enjoy it of late. As for .NET, however, I'm holding out for C++/CLI which will FINALLY give us C++ guys a standardized language syntax for implementing managed code. Because, while it's definitely NOT good for real time, a framework that can stop me from leaking memory, fragmenting memory, and crashing a PC is indeed a good thing.
Well... to each his own. I used to be a major Windows programming hater FYI: I do not "hate" windows programming, just appreciate that someone else does it :) Erik