CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

gains of PID controller

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
prayami



Joined: 22 Dec 2004
Posts: 78

View user's profile Send private message

gains of PID controller
PostPosted: Tue Mar 22, 2005 3:24 pm     Reply with quote

Hi...

We are going to develope a Boost(Pressure) Controller for Automobile
engine using 18F4525 and 20MHz crystal.

We need to adjust Duty Cycle supplied to the solenoid valve to control
the pressure. I am not sure that: the output we get from PID formula is the duty cycle we want or some thing else?


Quote:

//Is the following formula is correct to find duty cycle to drive solenoid valve?

desire_duty = (signed int8)(Tp + Td + Ti);


Here is the some portion of the code
I have developed. I have written ISR to get error sum for Integral term.

Quote:

Tp = Kp * error;

// calculate the integral term
//error_sum = error_sum + (signed int32)error;

Ti = Ki * (float)temp_error_sum;

// calculate the differential term
DeDt = prev_error - error;
Td = Kd * (float)DeDt;
prev_error=error;

// calculate the desired duty cycle

//Is the following formula is correct to find duty cycle to drive
//solenoid valve?

desire_duty = (signed int8)(Tp + Td + Ti);


I have also trouble in finding the gains etc. Please explain step by step in detail.

(1) How to find the constants(i.e gain) Kp, Kd and Ki ?
(2) Which is the best method to find these constants for this system?
(3) We have MATLAB, Can we use it some where to find these constants
and how?
(4) Which is the best sampling rate to get better control?
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Mar 22, 2005 4:03 pm     Reply with quote

It looks like you have the makings of a PHD thesis there! This is not an easy task.
The first thing I notice is:
Quote:
desire_duty = (signed int8)(Tp + Td + Ti);

It is nice you recognize that an 8 bit answer will give all the resolution you can use. But why are you using a signed number for duty cycle. Do you expect duty cycle to ever go negative?!?!

In theory you can calculate Kp Kd and Ki, but unless you are really good at modeling you will probably do better with a good test fixture and using lots of trial & error.

1) Try first to calculate a steady state answer and solve for Kp.
2) Then hit the system with a step input and adjust Kd for damping.
3) Next adjust Ki to get better accuracy.
4) Next go to step 1.

Adjusting PID loops is an aquired skill. It requires a good "feel" for how the system behaves. If you don't start with that feel, you will have it by the end!
_________________
The search for better is endless. Instead simply find very good and get the job done.
Guest








PostPosted: Tue Mar 22, 2005 4:12 pm     Reply with quote

Get the last three issues of NUTS & VOLTS magazine to have an good training lesson on PID loops. Rolling Eyes
Guest








PostPosted: Wed Mar 30, 2005 4:36 pm     Reply with quote

There are some methods of adjusting pid constans by hand,
such as Ziegler-Nichols rule, search net there are alot of info about it it is very simple method u can adjust the constants very close to the real mathematical calculations
sseidman



Joined: 14 Mar 2005
Posts: 159

View user's profile Send private message

PostPosted: Tue Jul 19, 2005 6:49 am     Reply with quote

Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group