topbanner.gif
February 20, 2018 12:35:22
Login
Username

Password




Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Navigation
bullet2.gif HOMEROASTERS.ORG
bullet2.gif Active Forums
bullet2.gif FORUM INDEX
bullet2.gif Downloads
bullet2.gif News
bullet2.gif Facebook Connect
bullet2.gif Forum FAQ
bullet2.gif Photo Gallery
bullet2.gif Search
bullet2.gif User's Voice
bullet2.gif Videos
Forum Threads
Newest Threads
bullet2.gif Comparing the Quest ...
bullet2.gif Hello from Northern ...
bullet2.gif 3d Printed Fluid Bed...
bullet2.gif 1 to 3 lb roaster build
bullet2.gif Arduino, modbus, art...
Hottest Threads
bullet2.gif TC4 with aArtisan... [276]
bullet2.gif Bobby M15's drum [121]
bullet2.gif Dereks 1-2Kg drum... [93]
bullet2.gif Looking for TC4C ... [64]
bullet2.gif 3d Printed Fluid ... [41]
Users Online
bullet2.gif Guests Online: 2

bullet2.gif Members Online: 0

bullet2.gif Total Members: 5,274
bullet2.gif Newest Member: spacelooper
BotSlap Panel
bullet2.gif Last check: 02.20.18
bullet2.gif Slap count: 0
bullet2.gif Last checked ID: 6495
View Thread
Homeroasters.org » DATALOGGERS - CONTROLLERS - RATE OF RISE METERS » Dataloggers/Controllers/Rate of Rise Meters
Who is here? 1 guest(s)
 Print Thread
PID TUNING HELP - Artisan
keving
I just uploaded version 1.0 Artisan and decided to try out it's PID controller. It worked but in a wild and crazy kind of way. Need some tuning suggestions. Please see attached graph. Temp deviating WAY to much as seen by ET. Power goes from 0 up to 99 each cycle and I don't think or should or needs to. Also seems like only PID adjusting a couple of times per minute (calling this a cycle). Seems like I need to increase sampling / PID reaction time, limit the amount of temperature swing allowed, etc... but haven't a clue.
I am using my home made air roaster with 270 gram batches.

I used:
Background Follow (which it did)
P = 15
I = 0.04
D = 0.0
Look ahead was set to 10 seconds
Artisan Sampling was set at 3 seconds
I set Target Positive to "power" and Target Negative to "none".

Any suggestions appreciated. thanks
keving attached the following image:
pid_auto_roast_1.jpg
 
greencardigan
Try making the sample rate quicker? Temps in a small air roaster can change a lot in 3 seconds.

And I'm fairly certain you will have to decrease the values. Maybe try halving both P and I values.
 
keving
Thanks Greencardigan!

So I cut the sampling to 1 second and changed PID parameters to the following:
P = 0.6
I = 0.01
D = 6.0

This is not completely FINE tuned, but it is giving a pretty good overlay of the original curve. Drying is lagging a little bit but once into dry stage following within a few degrees.

For those with a fluid bed roaster that plan on using PID to control a roast, this might be a good starting point. I started with everything at zero and increased P until it began to oscillate then backed off a tenth. At this point response was sluggish. I increased D and saw better response. Finally I increased I and saw it doing pretty good getting to temp at charge from ambient. So that is what I did, right, wrong, or indifferent. No two machines will be exact.

Plot is attached
 
keving
Plot
keving attached the following image:
pid_auto_tuned_pid_roast_2.jpg
 
PhilH
Suggest leaving "D" till last or just leaving it at zero

- Increase P till it oscillates, then back off a little
- add small increases to I until you get satisfactory control
if temperature variable is at all noisy then Derivative will probably be more troublesome than helpful
Dalla Corte Mini, Compak K10F, 1.2kg FB LPG/PID FB, 5kg FB LPG/PID
 
keving
Reposting plots of after and before - not showing in my browser in above posts.
Currently PID set as P=0.7 I=.01 and D=6.0 Working well.
keving attached the following images:
pid_auto_tuned_pid_roast_2.jpg pid_auto_roast_1.jpg
 
PhilH
Hi Kevin
I assume Grey line is target profile / Setpoint, What is green line ?
The title on the "after" graph says autotune ?? - Is there an autotune algorithm active on your controller?

With "I" set to 0.01 you are getting virtually no Integral component in the PID algorithm
Suggest you increase "I" value from 0.01 to something like 0.1 - 0.2 range which will incrementally increase/decrease heater output until there is no "error" the higher the value the faster it will increment the heater output. Start 0.1-0.2 and evaluate results.
"D" responds to rate of change of error and will greatly contribute to instability if there is any noise on BT measurement signal

My Hot Air Roaster settings currently around P=10.0, I=0.5, D=0.1
Obviously your roaster will be different and settings will vary

Hope this is helpful

regds Phil
Dalla Corte Mini, Compak K10F, 1.2kg FB LPG/PID FB, 5kg FB LPG/PID
 
RedAce
I will chime in with my recent PID-tuning experience that seems to worked great so it could serve as a "tutorial" for others (with no guaranties of course).

First I tried to use settings I found here or somewhere else on the internet with no luck. I was constantly getting oscilating line with over/undershooting temperature.

Today I found some "scientific" methods of PID tuning and used the simplest one. Wikipedia article on PID tuning helped me a lot - especially the animated GIF showing effects of P, I and D variables.

For testing I bought some beans (navy beans) that let me run the roaster continuously without ruining coffee and the need to work in actual roasting cycles. I set the SV to 100°C and let the TC4 do its thing. This temperature lets you roast without any smell of burning beans and without straining the roaster too much.

First you set I and D to zero and increase P until you get a small overshoot of the first peak and then the temp drops under the SV and slowly oscilates there. I ended up using value of 5.
Then you increase the I (good starting point is half of the P value) until you get the temp to oscilate in shorter period around the SV. I tried value of 2.5 and it worked fine.
Then you add the D to dampen the oscilations and smooth the line to (theoreticaly) copy the SV. This was a big surprise for me as I read in several places that this should be set very low or left at 0. I started at 0.1 and started slowly increasing the value from there. First positive effect showed at value 15 and I finally settled with value 165.0!!! I would never try such a high value on my own but this seems to work fine (see the "test roast" - still with navy beans and a simple background profile). It will need some tweaks for actual roast with coffee but this is a good starting point.

Hope this helps.
RedAce attached the following image:
test_profile.png
 
greencardigan
Thanks. This is essentially the same method I used. But I never ended up playing with the D as it was following the profile OK with it set on 0. I might have to have a play again.
 
RedAce
I tried first actual roast today and it worked OK - I was roasting actual coffee instead of beans, I was outside instead of inside and the batch was also larger. This resulted in a curve that was approximately 5°C under the background profile throughout the whole roast. Adjusting the PID parameters (increasing P and I and decreasing D) to increase the response resulted in near-perfect second roast (see the graph). The last issue is the period around the FC - I have to find out to what degree is the drop after FC just an artifact caused by the crack and to what degree I have to tweak the PID/profile.
RedAce attached the following image:
panama_pid.png
 
renatoa
Does the TC4 PID values works for Artisan PID when a non TC4 setup is used ?
 
Will2
Renato,
I do not know what P, I, d values will be best for the case you mention.
Right now I have a pretty big supply of roasted coffee.
I have stored the last roast data when PID firmware from TC4 was used.
Now, if it is needed tomorrow, for comparison, I can make roasting with the same P, I, d values when using PID of Artisan Roaster Scope, they will definitely be worse, so far, all attempts have been really worse.
Then we can try to find new and better values for this case, but I'm skeptical, they'll probably always get worse. But now I do not know such values.
Viliam
 
BenKeith
I have an aluminum heat sink thing I turned on the lathe and fitted a thermocouple in it to take the place of beans. Took of few tries to get the right amount of mass and the right size cooling fins but it works pretty good now. I've spent many hours playing with the TC4 with RoastLoggerTC4 loaded and RoastLogger on the computer. Mine tracks like a laser, and hits my setpoints within a few seconds everytime. Call it the moon phase or planet alignment, but every now and then I have to go back in a tweek again. A setting I'll run for months may start to oscillate just slightly.
Now, all roasters are different, but I've never been able to run the kind of numbers being mentioned here. A" P" of 2 is the lowest, "I" in the tenths and "D" never over 20. I Think if one is using big numbers in one place, it's because things are off in another.
I also had a coffee roaster tell me you can't use a PID to control a roast because a PID will only maintain a steady state and will not work on rising or falling temps. So, that broke up my discussing PID and coffee roasters.
I just wanted to say, I guess you numbers are working if you are happy, but I've never had any luck getting things that far out of balance.
GreenBean asked me about doing up a video and guide on how I setup of my Roaster because he was amazed at the consistency and control it had, but not now.
 
renatoa
Wondering how unified are these coefficients in the world of PIDs...

I can do autotune for that machine with an industrial box, then use the PID from AT for Artisan... :)
 
Will2
Here are 2 charts with the same roasting to compare.
This result could be expected.
Interference on the I2C bus until the 2nd alarm I will deal later.

up.picr.de/31737487vt.jpg
Viliam
 
chaff
If a PID can hold a setpoint then it can hold a setpoint that changes infinitesimally slowly. The controller's ability to track is determined by things like heat output, thermal inertia at least. PID's are able to accurately track moving setpoints on equipment with much greater time constants than coffee roasters.

Sampling period will affect the perceived response: if you think about the effect of a step change in setpoint immediately after a sampling point then a PID with a 100mSec sampling rate will apply a changed output value for 900mSec longer than a PID with a 1Sec sampling period so the gain depends on sample times.

To correct for this a PID can be coded to scale the error signals by sampling period and integrate the error signal over samples, then it's far less sensitive to sample period variation. It might be instructive to try varying the sampling period on Artisan providing the PID sampling period follows that setting.
 
renatoa
Artisan sampling interval is 1 sec if Oversampling flag is checked, as in my case.

Input data rate is one second also, from Mastech probes.
Somewhat, this is a puzzling design, Mastech send two data packets per second, but both have the same second time stamp...
Because a change of 0.1 degree in 0.5 sec means 12 degrees per minute RoR, which is normal during a roast, I guess that Artisan use the second value that comes with same time stamp as the first.
 
chaff
How are you getting the Artisan PID output to your setup ?

I have selected Device:TC-4 without the PID box checked and I have the Artisan PID target set to burners. Then in Config-Events I have checked the Burner slider and specify the serial command to set duty cycle.

But, watching the serial logging I'm seeing each duty cycle command followed by a serial command setting the duty cycle back to zero so I must be connecting Artisan PID output the wrong way. Is there another way to do it ?

Edit: I changed the Artisan PID target to Positive: Burner Negative:None and the double command went away. I'm seeing decent results with the Artisan PID gains set to Kp = 1.0 Ki = 0.05 and Kd = 0 . I'll try to port my 'software heater / thermocouple' into TC-4 sketch and compare results using the Artisan gains.
Edited by chaff on 02-06-2018 05:16
 
renatoa
Artisan PID target to Power (Positive ), None for Negative.
Similar, in Config-Events checked the Power slider and specified my command line application that get PWM as parameter {} and control the SSR over USB.
It works fine, did good roasts in manual mode, controlling slider myself.

Did again some 4-5 cycles/tests this afternoon and the results are non-sense, to me the algorithm itself seems broken...
Checked the PID program source and the whole process is symmetric, and shouldn't be, imo... heat is not symmetric as an electric oscillation.
Inertia in heating is a lot different than inertia during cooling...
When you come with an increasing BT under the curve (SV), the power should lower as you approach, and cut some seconds before BT match SV, to compensate machine inertia... this doesn't happen, I still have power 2-3 seconds after BT became bigger than SV ! Even for P = 0.1 !
Viceversa, when approaching profile from above, in a cooling process, heat should start second before the curve match, not after, when BT is some degrees below the curve !

Another issue, the temperature limits of SV are not enough, imo.
Must have a separate set of such limits for ET too, how useful is to limit SV (BT) to 249 degrees, if ET can go wild over 300...
 
chaff
Thanks,
Setting Negative:None sorted it for me, too. Now I have fair ( almost OK ) control of a software simulated heat response with either Artisan or my Arduino PID. Since the internals of my PID are different I can't compare Kp, Ki, Kd directly so I'm presently adding the simulated heater into a TC-4 build so the response can be compared to Artisan PID.

You're right about the heat response being asymmetrical, expecting the heat-up to be faster than the cool-down. Usually, though, the PID function is unaware of peculiarities in the target's response, it's often a standard plugin. With Ki == Kd == 0 you should see the output demand vary only with the error signal ( expected vs actual ) . You can still see overshoot: run full heat for a minute then shut down to zero heat: you'd see temps rise due to the inertia in the system. You'll also see overshoots if the Ki term is too high because the I-term keeps accumulating error over time and easily gets into a 'wind-up' leading to oscillation. The I-term assists the controller's response and the D-term opposes, dampens, it. Incorrect gains in either term can cause oscillation, the D-term by causing too much lag leading to overshoot.

There are 'model predictive' controllers out there that will learn the characteristics of the target and do the anticipation that you want but it should be possible to get what you need with the standard PID.

Are you getting anything sensible with Ki, Kd == 0 and a low-ish ( 0.4 ?? ) value for Kp ?
 
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
Arduino, modbus, artisan Building a Coffee Roaster 1 02-19-2018 14:49
How to use Artisan PID function with custom controller? Roasting Coffee 13 02-04-2018 19:53
Poppery 2 and Artisan Popcorn Popper roasting 9 02-03-2018 09:34
Artisan / Modbus Question Dataloggers/Controllers/Rate of Rise Meters 1 01-29-2018 21:54
Auber syl-2381-s and artisan Dataloggers/Controllers/Rate of Rise Meters 23 01-19-2018 22:51