Also, I found another source (different than above link), that gives all the calculations for the following auto tune diagram...however they do calculations quite differently to get the final PID values. however, they give a long explanation of how they do it with an example.

This is the diagram they calculate from:

Is your " (an)other source (different than above link)" a secret?

Posted by avrcandies: Mon. May 11, 2020 - 06:27 PM

1

2

3

4

5

Total votes: 0

Looks like in large oven, our formula some how fails.

Do you know what they do with the PID values? Since the output is always full on/off it can only be emulating PID..are you assuming (or do you know) the PID is being converted to PWM?

When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

Since the output is always full on/off it can only be emulating PID

54 posts and am I the only one who gets it? The bang-bang approach is only used during the auto-tune phase. Once PID values are derived, surely the system operates via PWM or similar.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience. Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast. Cheap. Good. Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

Posted by avrcandies: Mon. May 11, 2020 - 09:03 PM

1

2

3

4

5

Total votes: 0

Once PID values are derived, surely the system operates via PWM or similar

That's a question...what does it do to get from PID values to its output since it can only be on/off...so any calcs are then transformed by some unstated method to some form of on/off.

It's likely to be a simple linear conversion to duty cycle, but might have other factors, even stepping based on some discrete thresholds of some sort, possibly adding hysteresis, deadbands, etc.

Any of these would be part of the control "calcs".

Since the output is always full on/off it can only be emulating PID

I think this is a correct interpretation, if they are using a solid state relay.

When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

@ joeymorin yes, during autotuning it follow relay method( as pointed by @ N.Winterbottom ), once its done it gives variable PWM cycle and then maintain temperature to +-1C for heating.

We tested on 10second pulse also, proportional band still holds this formula for 2*[(+peak) - (-peak)]

i.e if during second cycle of tuning, max temerature goes to 94C & min is 87C, then P = 2[94-87] = 14

Although we are calcuating by Ku=4*d/(pi * a)

Today will try with our formula & check how far we are.

meanwhile sideways also try to understand abt Delta PID algorithm.

@ avrcandies can you point to your other source, might be this is what is being used in Delta controller PID?

Posted by avrcandies: Tue. May 12, 2020 - 08:45 AM

1

2

3

4

5

Total votes: 0

once its done it gives variable PWM cycle

Examin that in detail to determine exactly (mathematically) what it is outputting. For example, it might display numbers scaled differently than some other system does. For all you know it could take the PID numbers, calc, apply them to some fuzzy logic & then you see some on/off patten coming out to drive the heating. More than likely, it just varies the duty cycle linearly, but that is somewhat guessing as to what probably does.

-------------

You need to find the article by

It shows calculations and has many details. Temperature Control in a Plastic Extruder Control System

When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

Surely you are "close enough" with your understanding of the Delta Electronics controller by now. You are probably wasting time now trying to exactly match the Pb, Ti, Td calculated by their PID Autotuner. Especially as you/we don't know the inner details of their PID controller algorithm, or any tweaks they may do to improve performance in a particular area.

I've forgotten what exactly the scope of your project is. Please re-iterate.

I tried to write code for calculating the output 0 to 100% from below function, but value is always greater than 100 to system is always clampled and high.

Posted by avrcandies: Wed. May 13, 2020 - 07:16 PM

1

2

3

4

5

Total votes: 0

You will have a very long road if you are doing all this coding & hoping to simply compare waveforms.

Just one number or implementation differing slightly & means the switching cycle will differ a slight bit, which will propagate into the next cycle & cascade/buildup & effect the next cycle.

If you compare raindrops falling in two areas of the field you might say these waveforms of raindrops barely match at all, yet the same amount of rain fell in both areas & were delivered from the same cloud.

Ultimately, you just want to ensure that the temperature is maintained to your satisfaction....but it is not apparent you have defined what satisfactory is!

When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

Posted by avrcandies: Thu. May 14, 2020 - 06:58 AM

1

2

3

4

5

Total votes: 0

Need to normalize this output in range 0-100%. Dont understand how to do it.

The output stage is like a gas pedal, the PID makes it press more or less. You might have some system where 0 to 25 driver input volts means zero to full power, some other system might use 0 to 4V, or 0 to 1V. The PID adjusts itself & also the tuning takes into account the range (the pid values are just 3 more gain settings). Of course all that means nothing if the output can only turn on/off....so you fake it using percent on.....for example, you might set it so a value of 5 means full on 100% of the time, then 2.5 cycles on/off 50% of the time, 1 means it's on 20% & off 80%...the freq is typically "slow", depending on the system (in some cases might want faster). Or you might set things so 1 means on 100%. The doesn't matter, per se,, it will just affect the scaling of the PID values---they work together to give the desired output.

When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

Posted by avrcandies: Thu. May 14, 2020 - 04:29 PM

1

2

3

4

5

Total votes: 0

If the temperature keeps climbing due to the heater being on all the time (too much), then the integrator term (too hot) will build & build towards infinity until you pass your turn off threshold...so it will turn off at some point, even if badly adjusted or your scaling is messed up.

You do have to have numeric polarities correct...if too hot it must turn off, if too cold turn must turn on. If backwards it will lock up (you have positive feedback, want negative). If you are driving too slow & get further off the gas you will go slower & get more off the gas & go slower yet....that is a backwards polarity. Likewise, if you go too fast and apply more gas you go faster and apply more gas & crash.

When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

Defination sats: " It is amount of change in input (or deviation), as a percent of span, required to cause the control output to change from 0% to 100% "

For example in our test, with set point 70C, max goes to 78.6, minimum goes to 69.0,

Posted by avrcandies: Sat. May 16, 2020 - 04:42 PM

1

2

3

4

5

Total votes: 0

Meanwhile will also try to test other PID controllers from OMRON also.

WHY??? You are supposed to be spending your time making your controller work....Are you pretending to be quality control for Omron? Just making your own control system work well seems to be enough of a task.

PID has been around for a long time, since opamps. WIth a processor, you do not even need PID to control temperature, there are many ways to do it.

sensor span is -200C to + 600C

How to calculate it?

is it : (78.6-69.0)*100/(600+200C) ??

After 67 posts now you say you're not sure about reading the sensor? How much time is wasted!!.. Did you not verify the temperature readings before you started?

Now ask yourself why do you need to make this control in the first place?...can you just use the one(s) you have?

Have written below code, but outout is very fluctating and then clamped to either zero or highest.

That means very little...what does the final temperature look like? Why forget to post your results??

Turn your KD down to zero & make your KI very small...what temperature do you get

When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

@ avrcandies 1. By reading different established products just trying to see what they are working on, almost all on them have Proprotional band , intergral time and derivative time

Parallel we are trying to get our code working with calculated values of Kp,Ki & Kd.

2. I know how to read temperature sensor reading, this is how to calculate proportional band. Different pdf give different answers on this.

Kp, proportional gains is know how to calculate.

3. I have kept set point at 40C, and sensor is connected, right now its not in oven, so reading only room temperature.

compute_pid_duty_cycle() is called every 1 second, and output is limited to -100 to +100.

Since sensor is reading room temperature, so error is almost same. I recorded 100 reading and check "error" is same alsmost, while "output_duty_cycle" pid duty cycle vary a lot from 10% to 100% almost.

In that, the author provides the discrete or digital form for PID:

Notice he calculates the differential using y which I think is the measured process value not the error.

Notice also, there is a Kp factor around each term. This effectively results in a Kp factor around the whole controller.

In my #24 I referred to the Wikipedia article: https://en.wikipedia.org/wiki/PID_controller . In that same article I find a section titled "Reciprocal gain, a.k.a. proportional band"

I shall copy & paste:

Reciprocal gain, a.k.a. proportional band

In many cases, the manipulated variable output by the PID controller is a dimensionless fraction between 0 and 100% of some maximum possible value, and the translation into real units (such as pumping rate or watts of heater power) is outside the PID controller. The process variable, however, is in dimensioned units such as temperature. It is common in this case to express the gain K_{p} not as "output per degree", but rather in the reciprocal form of a proportional band 100 / K_{p}, which is "degrees per full output": the range over which the output changes from 0 to 1 (0% to 100%). Beyond this range, the output is saturated, full-off or full-on. The narrower this band, the higher the proportional gain

I think this goes a long way to explain your problems.

BTW: A cycle time of 1s seems very fast for a standard temperature control loop. 10 or 20s seems more reasonable. Having said that; I have seen a 1s cycle time controller but that was on a laboratory temperature bath; a precision piece of equipment holding temperature to within 0.02Â°C. Obviously a specialised controller was used here.

Posted by avrcandies: Sun. May 17, 2020 - 04:31 PM

1

2

3

4

5

Total votes: 0

Don't get too hung up on the names or scaling, you simply have 3 weighted adjustments (variables) to make

For example, either of these can give the EXACT same effect

Y =Ae+Be+Ce A=2, B=3, C=4

Y= ABCe+BCe+Ce C=4, B=3/4, A=2/3

You simply have a certain amount of proportional gain, integral gain and derivative gain added together, perhaps with some filtering & limiting.

Why do you keep messing with PID, you can do a lot of other ways more effectively. Since you have a processor rather than fixed PID circuitry, you can make it adaptive to the situation.

You fail to show a graph of your temperature results--why? Do it for several adjustments...what do you see. Keep the derivative term low, add just a little integral....what do you get as a temperature result?

When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

Edit: Noticed this strange relation between Detla controller PID values, not sure why is that so?

All calculated values of P are:

P = 2*[(+peak) - (-peak) ] i.e twice of difference between max and min values.

This holds true for all the graphs in post#50.

Delta PID controller have WPM timer period set = 20 seconds, tommorow will do more test on different times like 10,5,2 etc

- Log in or register to post comments

Topavrcandies wrote:Ross McKenzie ValuSoft Melbourne Australia

- Log in or register to post comments

TopDo you know what they

dowith the PID values? Sincethe output is always full on/offit can only be emulating PID..are you assuming (or do you know) the PID is being converted to PWM?When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

- Log in or register to post comments

Topavrcandies wrote:"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience. Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast. Cheap. Good. Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

- Log in or register to post comments

TopThat's a question...what does it do to get from PID values to its output since it can only be on/off...so any calcs are then transformed by some unstated method to some form of on/off.

It's likely to be a simple linear conversion to duty cycle, but might have other factors, even stepping based on some discrete thresholds of some sort, possibly adding hysteresis, deadbands, etc.

Any of these would be part of the control "calcs".

I think this is a correct interpretation, if they are using a solid state relay.

When in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

- Log in or register to post comments

Top@ joeymorin yes, during autotuning it follow relay method( as pointed by @ N.Winterbottom ), once its done it gives variable PWM cycle and then maintain temperature to +-1C for heating.

We tested on 10second pulse also, proportional band still holds this formula for 2*[(+peak) - (-peak)]

i.e if during second cycle of tuning, max temerature goes to 94C & min is 87C, then P = 2[94-87] = 14

Although we are calcuating by Ku=4*d/(pi * a)

Today will try with our formula & check how far we are.

meanwhile sideways also try to understand abt Delta PID algorithm.

@

avrcandiescan you point to your other source, might be this is what is being used in Delta controller PID?- Log in or register to post comments

TopExamin that in detail to determine exactly (mathematically) what it is outputting. For example, it might display numbers scaled differently than some other system does. For all you know it could take the PID numbers, calc, apply them to some fuzzy logic & then you see some on/off patten coming out to drive the heating. More than likely, it just varies the duty cycle linearly, but that is somewhat guessing as to what probably does.

-------------

You need to find the article by

It shows calculations and has many details.

Temperature Control in a Plastic Extruder Control SystemWhen in the dark remember-the future looks brighter than ever. I look forward to being able to predict the future!

- Log in or register to post comments

TopSurely you are "close enough" with your understanding of the Delta Electronics controller by now. You are probably wasting time now trying to

exactlymatch the Pb, Ti, Td calculated by their PID Autotuner. Especially as you/we don't know the inner details of their PID controller algorithm, or any tweaks they may do to improve performance in a particular area.I've forgotten what exactly the scope of your project is. Please re-iterate.

- Log in or register to post comments

Top@ N.Winterbottom

You are right , and i said in post#57 now i am trying to write PWM algo to maintain temperature with whatever we are getting at the moment.

This is very good implementation with some improvement also mentioned.

Will see if i am able to maintain temperature.

1. First PID values are calculated manually & PWM algo is implemented to see how far i am to maintain temperature.

2. Once step 1 is succesful, write autotune code in c also

Meanwhile will also try to test other PID controllers from OMRON also.

- Log in or register to post comments

TopI tried to write code for calculating the output 0 to 100% from below function, but value is always greater than 100 to system is always clampled and high.

The code of lots of tweaks as mentioned in this blog: http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

so its not only Kp,Ki ,kd multiplaction with error.

Parallel we have tested on another advanced Delta PID DTC1000, and below are tuning results.

Ti & Td match exactly as from DElta electronics PID now.

I was reading Pb is actual proportional band and not proportional gain Kp.

I am reading more on it how to calculate.

Another thing is this "I offset" which also calculate after autotuning, dont know what it is.

This Pb gives from 0 to 100%.

- Log in or register to post comments

TopYou will have a very long road if you are doing all this coding & hoping to simply compare waveforms.

Just one number or implementation differing slightly & means the switching cycle will differ a slight bit, which will propagate into the next cycle & cascade/buildup & effect the next cycle.

If you compare raindrops falling in two areas of the field you might say these waveforms of raindrops barely match at all, yet the same amount of rain fell in both areas & were delivered from the same cloud.

Ultimately, you just want to ensure that the temperature is maintained to your satisfaction....but it is not apparent you have defined what satisfactory is!

- Log in or register to post comments

Top@ avrcandies , I wrote code with whatever values of Kp,Ki and Kd we are getting. Issue is its always clampled to 100%.

Need to normalize this output in range 0-100%. Dont understand how to do it.

need to maintain temperature within +-1%.

Edit: First goal now is to get this running and see what we will get.

This Delta PID test is entirely separate, just to understand what is being done., Thats why in my post I wrote parallel.

- Log in or register to post comments

TopThe output stage is like a gas pedal, the PID makes it press more or less. You might have some system where 0 to 25 driver input volts means zero to full power, some other system might use 0 to 4V, or 0 to 1V. The PID adjusts itself & also the tuning takes into account the range (the pid values are just 3 more gain settings). Of course all that means nothing if the output can only turn on/off....so you fake it using percent on.....for example, you might set it so a value of 5 means full on 100% of the time, then 2.5 cycles on/off 50% of the time, 1 means it's on 20% & off 80%...the freq is typically "slow", depending on the system (in some cases might want faster). Or you might set things so 1 means on 100%. The doesn't matter, per se,, it will just affect the scaling of the PID values---they work together to give the desired output.

- Log in or register to post comments

Top@ avrcandies " The PID adjusts itself & also the tuning takes into account the range (the pid values are just 3 more gain settings). "

This is not happening, my PID out is always more than 100 seems like.

We are keeping 5 second pulse, so if 100% pid output, then full 5 seconds on, 50% PID outout means 2.5second ssr on and 2.5second ssr off.

- Log in or register to post comments

TopIf the temperature keeps climbing due to the heater being on all the time (too much), then the integrator term (too hot) will build & build towards infinity until you pass your turn off threshold...so it

willturn off at some point, even if badly adjusted or your scaling is messed up.You do have to have numeric

polaritiescorrect...if too hot it must turnoff, if too cold turn must turn on. If backwards it will lock up (you have positive feedback, want negative). If you are driving too slow & get further off the gas you will go slower & get more off the gas & go slower yet....that is a backwards polarity. Likewise, if you go too fast and apply more gas you go faster and apply more gas & crash.- Log in or register to post comments

TopHave written below code, but outout is very fluctating and then clamped to either zero or highest.

This is general three gains Kp, Ki and Kd.

I think one reason might be: dimensions dont match on both sides . Though i am not sure of this.

1. kp has unit : (change in output)/celsius.

since Kp is proportional to D/A , where D= change in output which we take 0 to 100, since its relay method.

A= change in temperature.

2. ki = 1.2*Ku/Tu so its units: (change in output)/(celsius * second).

3. ki = 0.075*Ku*Tu so its units: (change in output * second)/(celsius).

4.While on left of equation , which is outout it is dimension less or percentage

I have checked another PID controller from another company they also used porportional band, ; https://web-material3.yokogawa.c...

But i dont get how to caculate it.

Defination sats: " It is amount of change in input (or deviation), as a percent of span, required to cause the control output to change from 0% to 100% "

For example in our test, with set point 70C, max goes to 78.6, minimum goes to 69.0,

sensor span is -200C to + 600C

How to calculate it?

is it : (78.6-69.0)*100/(600+200C) ??

- Log in or register to post comments

TopWHY??? You are supposed to be spending your time making your controller work....Are you pretending to be quality control for Omron? Just making your own control system work well seems to be enough of a task.

PID has been around for a long time, since opamps. WIth a processor, you do not even need PID to control temperature, there are many ways to do it.

After 67 posts now you say you're not sure about reading the sensor? How much time is wasted!!.. Did you not verify the temperature readings before you started?

Now ask yourself why do you need to make this control in the first place?...can you just use the one(s) you have?

That means very little...what does the final temperature look like? Why forget to post your results??

Turn your KD down to zero & make your KI very small...what temperature do you get

- Log in or register to post comments

Top@ avrcandies 1. By reading different established products just trying to see what they are working on, almost all on them have Proprotional band , intergral time and derivative time

Parallel we are trying to get our code working with calculated values of Kp,Ki & Kd.

2. I know how to read temperature sensor reading, this is how to calculate proportional band. Different pdf give different answers on this.

Kp, proportional gains is know how to calculate.

3. I have kept set point at 40C, and sensor is connected, right now its not in oven, so reading only room temperature.

compute_pid_duty_cycle() is called every 1 second, and output is limited to -100 to +100.

Since sensor is reading room temperature, so error is almost same. I recorded 100 reading and check "error" is same alsmost, while "output_duty_cycle" pid duty cycle vary a lot from 10% to 100% almost.

- Log in or register to post comments

TopProportional mean just what it says,

proportional.example: Vout=300*err the controller output is 300 time the present error, it is

proportionalIf the max 100% useable/allowable, Vout is 600, then err has a max allowable of 2

Or you could just talk about percentage out: Vout (%) = 100/2 * err so P=proportional band = 2

So looking at PWM 600V =100% PWM on at err=2

- Log in or register to post comments

TopI think you're getting confused by textbook examples versus real world practical examples of temperature controller.

In your post #31 you attached:

Resumo Alargado - Auto-tuning de Controladores PID pelo mÃ©todo Relay.pdf

In that, the author provides the discrete or digital form for PID:

Notice he calculates the differential using

ywhich I think is the measured process value not the error.Notice also, there is a Kp factor around each term. This effectively results in a Kp factor around the whole controller.

In my #24 I referred to the Wikipedia article: https://en.wikipedia.org/wiki/PID_controller . In that same article I find a section titled "Reciprocal gain, a.k.a. proportional band"

I shall copy & paste:

I think this goes a long way to explain your problems.

BTW: A cycle time of 1s seems very fast for a standard temperature control loop. 10 or 20s seems more reasonable. Having said that; I have seen a 1s cycle time controller but that was on a laboratory temperature bath; a precision piece of equipment holding temperature to within 0.02Â°C. Obviously a specialised controller was used here.

- Log in or register to post comments

Top@ N.Winterbottom You right, lot of diff in textbook examples and real world practical examples. :)

1. why y(n) - y(n-1) is taken rather than error, here it is explained: http://brettbeauregard.com/blog/2011/04/improving-the-beginner%e2%80%99s-pid-derivative-kick/

2. Kp factor with each term is there as it should be since ki=Kp/Ti & kd=KdTd

3. The wikipedia article is true when only P is used, so it mentions Pb=100/Kp

4. In most of reputed brand PID controller Delta, Omron and many others: they all have:

a) Pb with range : 0.1 to 999.9

b) Ti

c) Td

d) Some have offset also

trying to figure this out.

We aredoing sampling every 1 second, store it in array for 10 samples i.e 10seconds, then avg it & then update the PWM width of10seconds.

- Log in or register to post comments

TopDon't get too hung up on the names or scaling, you simply have 3 weighted adjustments (variables) to make

For example, either of these can give the EXACT same effect

Y =Ae+Be+Ce A=2, B=3, C=4

Y= ABCe+BCe+Ce C=4, B=3/4, A=2/3

You simply have a certain amount of proportional gain, integral gain and derivative gain added together, perhaps with some filtering & limiting.

Why do you keep messing with PID, you can do a lot of other ways more effectively. Since you have a processor rather than fixed PID circuitry, you can make it adaptive to the situation.

https://www.sciencedirect.com/science/article/pii/S147466701641476X

- Log in or register to post comments

TopNow I want to understand what is proportional band in PID context?

We did some PID tuning test from Delta Electronics temperature controller, and after a test, it gives Pb = 40 , Ti = 302 & Td=75

Pb has unit of degree as per manual.

So what does it mean that suppose at any given point, set point is 100C.

So PID formula will only apply during (100 - (40/2)) to (100 + (40/2)) . i.e 80C to 120C.

If measured temperature is current below 80C, then output is 100% on & if above 120C then output is off completey?

Is this it means?

- Log in or register to post comments

Topproportional band is defined as the amount of change in the controlled variable required to drive the loop output from 0 to 100%.So what, WHO CARES? You seem to be going nowhere---are you having good luck when you run

yourprogram? How well does it perform?- Log in or register to post comments

Topposted results in post #69.

PWM keeps on varying very significantly.

- Log in or register to post comments

TopYou fail to show a graph of your temperature results--why? Do it for several adjustments...what do you see. Keep the derivative term low, add just a little integral....what do you get as a temperature result?

- Log in or register to post comments

TopSo in your example the error stays constant therefore the derivative is zero. The integral should wind up to it's peak value and summed with

(kp * error) which is also constant.

This surely is a simple code debugging exercise.

- Log in or register to post comments

Top## Pages