topbanner.gif
Login
Username

Password




Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Shoutbox
You must login to post a message.

renatoa
03/25/2024 12:38 PM
coffee drink, Ramper?

allenb
03/24/2024 12:10 PM
Siam3D Welcome

renatoa
03/23/2024 3:02 PM
welcome cup, andrewg

allenb
03/21/2024 5:10 PM
TRH629 Welcome

allenb
03/21/2024 5:08 PM
marimohead Welcome

In Memory Of Ginny
Donations

Latest Donations
dmccallum - 10.00
JackH - 25.00
snwcmpr - 10.00
Anonymous - 2.00
Anonymous - 5.00
Users Online
Guests Online: 4

Members Online: 0

Total Members: 8,165
Newest Member: Ramper

View Thread

Who is here? 1 guest(s)
 Print Thread
aArtisanQ_PID thermocouple jumps when active PID channel
sebiiksbcs
I am having a strange issue with my thermocouple readings and (I suspect) aArtisanQ_PID or TC4+ shield.

When I use the firmware PID the thermocouple readings of the active PID channel start to jump up and down. I've attached a screenshot. You can see in the active profile how the BT (dark blue) jumps up and down and the PID starts to chatter while MET (red) stays quite stable.

Now in the background profile (dimmed) I set MET as active PID channel, and you can see MET starts to jump up and down while BT stays stable.

I've ruled out any hardware issues as best as I could, e.g.:
- made sure roaster and control box are properly grounded
- installed 100n and 10n filter caps on each TC channel which reduced the jumps a bit (probably due to hysteresis)
- I repeatedly turned heater to full and off with a roughly the speed of the PID chatter to see if it's a mains voltage problem but TC readings are stable.
- tried the most recent version of aArtisanQ_PID as well as an older one

Did anyone have a similar issue? Since only the active TC channel starts jumping about, can I assume that there is something going on either on the TC4+ or in the firmware's PID calculation that may cause this?
sebiiksbcs attached the following image:
thermocouple_pid.jpg
 
renatoa

Quote

or in the firmware's PID calculation that may cause this?


Indeed, could be PID oscillations, is the PID tuned somehow ?
What are your PID coefficients?
 
mg512
Agreed that this looks very much like PID fluctuations, i.e. everything is fine with the temperature measurements, it really is oscillating up and down. So as per renatoa's comment, tuning the PID parameters would be the thing to do.

It's kind of odd though that in one roast MET is oscillating while BT is stable, and then the opposite way on the other roast.
What exactly is MET measuring, i.e. where is that probe placed in the roaster? (And what kind of roaster is this, actually?)
What exactly do you mean by "in the background profile you set MET as the active channel" - do you mean the background profile was already recorded during a PID-controlled roast, but the PID was running on MET as opposed to BT?
 
sebiiksbcs
Guys, sorry for not being clear enough.

Roaster is Quest M3S with two 1.5mm k-type thermocouples. MET is measured at the top screw of the bean chute, same as many Quest users here on this forum. BT is at the position where the stock thermometer used to be, near the trier.

I have a TC4+ (with a ZCD connected) running aArtisanQ_PID in PAC mode and one SSR (fotek 40DA, switching the heating element via OT1 in what I believe is ICC control, not PAC)

I've turned the PID quite extensively using various methods. In the end I settled with
P 5.2, I 0.011, D 32.0.

P gain starts oscillating at around 10.5 so I set gain to 5.2 which works quite alright with the I and D values.

Oscillation period is around 72 seconds (not that I base any values on that, just good to be aware of it). I tweaked D between 28.0-36.0 which lets it dampen nicely without chatter.

Then of course I. A value between 0.01 and 0.015 seems to work well for I, not much overshoot, even though the value takes quite long to get close to the setpoint. But in a coffee roaster the setpoint changes constantly so I guess it doesn't matter as long as one knows how the PID/setpoint behaves.

As to the screenshot, yes, the background profile was recorded earlier during a PID-controlled roast, but the PID was running on MET as opposed to BT. In other words I did two test recordings. In the first the PID controlled MET. In the second the PID controlled BT (though the values are tuned to MET. I just wanted to show how BT jumps when driven by the PID). I set the first recording as background profile of the second, just to see if they have anything in common.
Edited by sebiiksbcs on 06/09/2021 9:09 AM
 
CK
Just a thought, but shouldn't your PID be tracking ET (environment temperature) as opposed to MET which is a final reading for the highest temperature the roaster reached during a roast?

On the transparent roaster and Artisan, this is done by device assignment TC4 (number 2 for ET in my case) and then select 2 as the source for the PID to follow in the PID control window...
 
renatoa
D is awfully high and could be a good reason for oscillations. In most processes that aren't seriously critical D should be left 0, at least in the PI tuning phase.
Also I is unusually low. Especially because during the roast the setpoint changes permanently, the main factor that ensures the proper following is I term !
Let's do some math for an average middle of profile rate of rise.
I am using 10 C / min as the most usual value when doing such computations.
This means every 6 seconds the temperature increases by one C degree.
A typical roaster ultimate gain is a unit computed during PID tuning, having a typical value something around 3. You should read this value as: "for every % of power change (input), the temperature change is about 3 C degrees (output)" For example 240 C degrees when heater is at 80%.
Why are these things important... well, let's put them all together.
First, we have a process that needs to be pushed up one degree every 6 seconds.
Then, the unit of power change is one percent at a time, we can't change power finer than this.
The ultimate gain value of 3 tells us that every % of power increase brings us another 3 degrees, sooo... we need to increase power one percent every 3 * 6 = 18 seconds.
Again, this is an average value, at the middle of profile, just for exemplification !
Now, back to I term... again, this is the main factor in the equation that led to power control driving. In order to be capable to accomplish this task, the I term must have a value able to accumulate one percent during 18 seconds for an average error of... write here your desired precision to follow the profile.
For one degree average error, the I term should be 1/18 = 0.055
For your value of 0.011 the error will be five times bigger = five degrees, or the correction time will be five times longer = 18 * 5 = 90 seconds !
In real life the I term value is bigger, for example 0.12 on my machine, because the I term must be able to follow also the much faster increases that occurs immediately after turning point, about 20 C/min as average

Wait a moment, this is not all... Grin
Let's see what is the effect of that ludicrous high D value... as the PID theory and code show us, the D term has a braking action depending of the input/error variation speed. Which as we recall is one degree every 6 seconds.
So, every 18 seconds, when the accumulation of one percent occurs due to I term action, the D term jump and brake the process with a value of 32 * 1/6 = about 5 percents !!! opposite of the one percent added by the I term !!!
Would be marvelous to NOT have oscillations with such setup ! Shock

So my take would be to to zero the D term, try again with an I term around 0.1 and tell us what is the outcome.

And forget about D term for now, if it is damping something, surely not the oscillations ... conversely, the bigger the D term in a PID process, the bigger is the noise amplified in the output.
As a wise man wrote, ?D? in PID Stands for: Do Not Use Grin
controlstation.co...sometimes/

Actually, all the above are valid for hot air machines driven by hot air streams, with relative constant airflow, and having significantly lower thermal inertia than your drum.
In your case is difficult to give an advice "how to follow a profile" because the drum machines are using a third variable, the airflow, which is not under the control of PID, nor of profile follow logic of Artisan.
Would be more useful to have a power profile feature instead temperature profile. A feature that is lacking to both TC4 and Artisan.
 
greencardigan
Also, could you confirm if you are using Proportional on Measurement or Proportional on Error mode for the PID. Parameters will be different for the different modes.
 
sebiiksbcs

Quote

CK wrote:

Just a thought, but shouldn't your PID be tracking ET (environment temperature) as opposed to MET which is a final reading for the highest temperature the roaster reached during a roast?

On the transparent roaster and Artisan, this is done by device assignment TC4 (number 2 for ET in my case) and then select 2 as the source for the PID to follow in the PID control window...


Well it's the Quest M3S so the 'traditional' ET is rather useless as it's just very similar to BT. As I mentioned I have two thermocouples, one measuring 'traditional' BT and the other one measuring what people usually call 'MET' near the heating elements, going in via the bean chute screw. In the Quest, this MET is a good way of tracking how much heat is available in/around the drum and can tell you where BT will be going and how fast. Thus when I roast manually I watch both BT and MET and sort of have a good feeling how MET should progress during the roast, which is why I am trying to PID-control it.

Secondly, I am using the (firmware) PID of the TC4+. The whole issue is: why is BT but not MET jumping up and down when I PID BT, and vice versa.
But it's a good idea to check using Artisan's PID if these thermocouple jumps occur, too!
Edited by sebiiksbcs on 06/09/2021 11:51 PM
 
sebiiksbcs

Quote

renatoa wrote:

D is awfully high and could be a good reason for oscillations. In most processes that aren't seriously critical D should be left 0, at least in the PI tuning phase.


I don't think I can agree that any PID setting could be the reason for the actual thermocouple reading to jump like that, and then only the reading that is being PID'd. Not sure if it's clear in the screenshot but the temperature does jumps of up to 10-15 degrees Celsius within a second whenever OT1 value does a jump, then jumps back the next second (actually sampling rate in Artisan is set to 2 seconds but my TC4+ samples per second and I see the jumps on my LCD connected to the TC4+). I am just wondering why OT1 level affects the thermo reading, and only the one that is being PID'd.



Quote


Also I is unusually low. Especially because during the roast [...]


This is all very interesting and may be helpful for me for future tuning, thank you! But as you may know yourself, there's the theory, and the question if it works in your application. In my Quest I usually keep the MET steady during the first half of the roast, then gently let it decrease until I reach drop temperature. It's always the same progression. Which is why I would want to PID it. But with these weird jumps the PID gets out of control and becomes harmful to my roasts and useless if I only wanted to, say, use it to preheat my roaster.

So anyway, in my application I need to prevent the temperature from undershooting && oscillating, which the low I seems to accomplish.


Quote


So my take would be to to zero the D term, try again with an I term around 0.1 and tell us what is the outcome.

And forget about D term for now, if it is damping something, surely not the oscillations ... conversely, the bigger the D term in a PID process, the bigger is the noise amplified in the output.
As a wise man wrote, ?D? in PID Stands for: Do Not Use Grin


In fact I've had usable results with just PD. Despite the temperature was constantly 10 degrees above the set point, but then it was stable even with sudden changes or faster ramps of the set point. Another point for the low I (which just seems to prevent a bit of over-/undershoot).





Quote


Actually, all the above are valid for hot air machines driven by hot air streams, with relative constant airflow, and having significantly lower thermal inertia than your drum.


Agreed, PID is even harder to get right if the user changes the airflow a lot. I use constant full airflow on my quest (except an initial soak right after charge for some bean types) for various reasons:
1. the fan on the Quest isn't very strong to begin with so it seems fan speed doesn't really change much on the Quest except adding one more factor thus enticing the roaster to make constant changes in fan speed and believe that somehow this roast will become better. In reality roasts just become less consistent/repeatable.
2. it clears chaff.
3. I like the cleaner/brighter taste, though this might just be the psychological effect of me knowing I used more fan.

Quote


Would be more useful to have a power profile feature instead temperature profile. A feature that is lacking to both TC4 and Artisan.


I am actually considering to implement that, but then the firmware wouldn't know how hot it really is, so an earlier batch in a less pre-heated roaster might turn out fine while the following batches might get hotter and hotter. Well, maybe you're right, why bother with PID in the first place...


Back to the main topic: how come the temperature readings jump when OT1 changes suddenly due to PID control, and why only one of the temp readings (i.e. the one that is being fed to the PID)?
 
sebiiksbcs

Quote

greencardigan wrote:

Also, could you confirm if you are using Proportional on Measurement or Proportional on Error mode for the PID. Parameters will be different for the different modes.


It's Proportional on Error mode.
 
sebiiksbcs
Due to your replies focusing more on PID tuning than the possible reasons for the temperature jumps, I should have mentioned these jumps don't seem to occur during my tuning sessions. Also as to what some of you mentioned about PID tuning I've done lots of experimentation,

e.g. start with only P gain, watch for reaction time and/or oscillation,
repeatedly change set point, then ramp set point,

then slowly add I from anywhere between 0.01 and 1.0, watch for reaction time, oscillation and/or overshoot,
repeatedly change set point, then ramp set point,


only use PI and no D,
repeatedly change set point, then ramp set point,

slowly add D from anywhere between 0.1 and 64.0, watch for reaction time, oscillation/stability, and/or chatter,
repeatedly change set point, then ramp set point,

only use PD and no I,
repeatedly change set point, then ramp set point,

etc etc.

And as I mentioned before, so far P5.2, I0.01, D32.0 seems to work best for my requirements, which are low overshoot/undershoot, and low oscillation. The temp doesn't have to be precisely at the set point as long at it is stable, and ramp up/ramp down speed doesn't have to be as fast as possible, as long as oscillations are prevented.
Edited by sebiiksbcs on 06/09/2021 10:30 PM
 
renatoa
Instead all the experiments above, somewhat empiric, a single open loop test would help a lot to understand the machine behavior, and tune it.

Or, why not, a reading of PID code, and try to understand how it works.
Then make your mind according to code... or change the code according to your mind :D


Also, not sure how you experimented, with empty machine or with beans? Because the behavior is significantly different...

Quote

Back to the main topic: how come the temperature readings jump when OT1 changes suddenly due to PID control, and why only one of the temp readings (i.e. the one that is being fed to the PID)?


Because of the slow relay style on-off drive of the heater (magenta line), which has this shape absolutely due to the D term only.
No other coefficient in your PID triangle has the power to drive heater 1-100% in seconds.

Back to code, the essential is distilled below:


error = *mySetpoint - input;
dInput = (input - lastInput);
...
outputSum += (ki * error);
...
output = kp * error;
...
output += outputSum - kd * dInput;


Let's assume we are in an (almost) stable status, and last heater output was 50%
Because stable means (almost) no error, this 50 output value comes from output sum, because error was near zero, and dInput also very close, thus the P and D terms contribution is very low.
Let's assume that we have now a sudden change of only one degree in setpoint value !
The error will become 1 (*mySetpoint - input), P term will become a contributor to the output, with 5.2 percents added (output = kp * error), the I term (outputSum) remains almost constant, due to the low ki, while kd of 32 will knock down the output with 32%, so the result will be 50+5.2(P)+0.011(I)-32(D) = 23%

So the attempt to drive the setpoint higher by one degree led to 27% heater output drop ! Stability, right ? :o
Obviously this drop in heater output will produce damages significantly bigger than the ONE degree error that started all the mess...

Quote

And as I mentioned before, ...and low oscillation


What low oscillations ? :o
The graph and all the theory you seems to disregard shows exactly the contrary ... even a breathing in the probe will led to oscillations.
That machine is driven as being permanently in a car moose test :D
 
sebiiksbcs
This is P:5.0 I:0.1 D:0.0 (and P:5.0 I:0.01 D:0.0)
.
.
sebiiksbcs attached the following image:
pidd.png
 
sebiiksbcs
But I would like to ask again if anyone has an idea about the thermocouple readings. I've attached a real-life roast I did.

The readings clearly don't correspond to the actual temperature. The Quest has two metal heating rods and the MET probe measures the air temperature between the drum and the outer isolated shell of the drum roaster. There is no way the temperature of the rods nor the air in the chamber can fluctuate this wildly.
.
.
sebiiksbcs attached the following image:
huehue.png
 
renatoa
What about the reason the heater output behave this jumpy way ?
In a normal setup the heater output ramp from the turning point value, which usually is the charge value, or close, using small steps, maximum 5% at a time, up to a maximum value, according to desired profile, stay there for a while, then decrease slowly.
 
sebiiksbcs
sigh, k
 
Jump to Forum:

Similar Threads

Thread Forum Replies Last Post
aArtisanQ_PID and Arduino UNO R4 Dataloggers/Controllers/Rate of Rise Meters 2 03/01/2024 12:13 PM
Thermocouple Woes ROASTING SOFTWARE APPS 19 09/05/2023 7:56 PM
Using aArtisanQ_PID with an old TC4 Dataloggers/Controllers/Rate of Rise Meters 12 02/14/2023 10:50 AM
How do I get the latest aArtisanQ_PID libraries? Dataloggers/Controllers/Rate of Rise Meters 3 02/06/2023 5:44 PM
TC4 with aArtisanQ_PID Dataloggers/Controllers/Rate of Rise Meters 417 07/17/2022 10:42 AM
Homeroasters Association Logo, and all Content, Images, and Icons © 2005-2016 Homeroasters Association - Logos are the property of their respective owners.
Powered by PHP-Fusion Copyright © 2024 PHP-Fusion Inc
Released as free software without warranties under GNU Affero GPL v3
Designed with by NetriX
Hosted by skpacman