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

Autotuning of PID Algo in 8 bit Microcontroller
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cmengnr



Joined: 28 Dec 2012
Posts: 12

View user's profile Send private message

PostPosted: Tue Jan 01, 2013 5:42 am     Reply with quote

Also how many hit and trial the controller have to applied on value of kp and in what factor it increase it.

And how kp relates to o/p voltage. What is the relationship b/w changing kp and voltage applied (Overshoot during voltage app;ied and undershoot during zero voltage applied).
cmengnr



Joined: 28 Dec 2012
Posts: 12

View user's profile Send private message

PostPosted: Tue Jan 01, 2013 6:21 am     Reply with quote

I think now i am clear.

When temp reaches set point, the P only controller comes into action. So o/p of PID becomes kp(S-P). Here by changing different values of kp, the controller changes its o/p and due to this overshoot and undershoot also changes.

The values of kp keeps on changing until sustained oscillation will not reach (i.e. 5% of set point).

At this point controller will easily get ultimate gain and period by calculations.

Only single point which is not clear to me is how many values of kp is changing and with what resolution.

Please suggest me whether i am going in right direction or not
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue Jan 01, 2013 7:00 am     Reply with quote

Hi,

This is a forum for supporting the CCS 'C' compiler. The forum often helps
with problems like yours, but only in the context of developing a solution
using a CCS compiler. So far, all your questions have been general in nature,
and not specifically related to the subject matter of the forum. I think the
next step here is for you to show us the (CCS) 'C' code you've already
written, and we can go from there. If you aren't using the CCS compiler, then
I think you need to find another place to ask your questions, such as the
suggestions I already offered.

Happy New Year!

John
cmengnr



Joined: 28 Dec 2012
Posts: 12

View user's profile Send private message

PostPosted: Tue Jan 01, 2013 7:11 am     Reply with quote

Hello John

I am using PIC16 with CCS compiler.

But till now i dont have C code for PID. Before clearing all concepts of PID how can i write a code for PID.

After completely understanding the logic, i will be able to write a code.
temtronic



Joined: 01 Jul 2010
Posts: 9321
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 01, 2013 7:28 am     Reply with quote

comment
I have to agree with John.It sounds like you want to 'engineer' the PIC autotune PID controller without doing any R&D with a real PLANT.Can't easily be done.Well, it can...if you have Matlab and a day or so..
I suggest you get your 'plant' up and running,interfaced to a PIC and take as long as necessary to acquire the data needed to design the PIC code.You do NOT need to create an 'autotune' program, that will come after you've got a basic PIC program working.
Simple PID code will easily be less than 10Kb on a 16F877 PIC.The ones i did 15 years ago had dual encoder feedback,PC interface, so really maybe 2Kb was the actual 'controller'.
Since no one here has your plant, we can't cut appropriate code for you,you'll have to 'learn by doing'.
Once you show us a schematic of your hardware and some preliminary code, we'll be able to help,until then ,it's all on your shoulders.

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19631

View user's profile Send private message

PostPosted: Tue Jan 01, 2013 10:06 am     Reply with quote

Yes.
I think it is important to understand that you can't generically tune a 'universal' PID algorithm. If you could, there would have been just one PID written, and posted for every possible processor. PID, _needs_ different update rates according to what you are trying to control etc.. You can tune to optimise once you have a workable range, but you need to start from a working PID. You need to select the overall gain and maths ranges to match the range of numbers involved for _your_ hardware. Even companies marketing 'semi universal' controllers have different versions for different target 'audiences', or jumper selection of the working ranges....
You need to start by getting a PID to work, and then design the tuning to help this cover the likely values.

Best Wishes
cmengnr



Joined: 28 Dec 2012
Posts: 12

View user's profile Send private message

PostPosted: Tue Jan 01, 2013 10:38 pm     Reply with quote

Thanks all for your reply. I will test PID practically and then comes ther if still face any problem
cmengnr



Joined: 28 Dec 2012
Posts: 12

View user's profile Send private message

PostPosted: Fri Jan 11, 2013 3:55 am     Reply with quote

Hello all,

after studying some documents and doing some practicals i could able to write a code of autotuning.

I am using Relay feedback approach for autotuning. Everything is clear but only one point which is not clear to me is how to select height/amplitude of relay in relay based autotuning method.

Could anyone help me in understanding the concept of amplitude of relay. Is it related to duty cycle which is applied to process during undershoot to reach system to set point or something else.
temtronic



Joined: 01 Jul 2010
Posts: 9321
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jan 11, 2013 5:56 am     Reply with quote

Since you're not presenting any CCS related code, this thread will soon be locked.
Temperature control using PID can be as simple as a dozen lines of CCS C for a 16 series PIC or 1000s of line depending on methodology.
A simple googling of 'relay feedback PID' listed over 750,000 hits and in the first page were several PDFs of papers written on the subject.
I strongly suggest you need to do more research in that area,this forum is dedicated to helping those who need help in cutting CCS C code,none of which you've shown us.It sounds like you want someone here to 'hand you the code' for your thesis and none of the regulars have the time to do that, no one here has your 'plant' and therefore cannot possibly cut the code for you.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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