Kegconnection Complete Starter Kit and More Giveaway!


Home Brew Forums > Home Brewing Beer > DIY Projects > Recirculation infusion mash system library for Arduino

Reply
 
LinkBack Thread Tools
Old 08-13-2013, 05:26 PM   #51
franckgaga
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jun 2013
Location: Quebec, QC, Canada
Posts: 41
Liked 5 Times on 5 Posts
Likes Given: 8

Default

After a lot of tests with PID filtering, I choose to modify my library...

I will replace PID Output filter by a derivative filter (filtering applied on derivative block only and not all PID)

PID Output filter combined with saturation worked great but causes a lag and, hence, a weird and brief overshoot just before reaching set point temperature. This weird overshoot is completely removed is filtering is applied only on derivative block.

For filtering value, it can be the same as PID Output filter value. It can be setted to :

tauFilter = Kd/10

Bye !

__________________
franckgaga is offline
 
Reply With Quote Quick reply to this message
Old 08-13-2013, 06:57 PM   #52
atoughram
Feedback Score: 0 reviews
Recipes 
 
Join Date: May 2013
Location: Puyallup, Washington
Posts: 943
Liked 115 Times on 101 Posts
Likes Given: 173

Default

Error compiling...











RIMS\utility\PID_v1mod.cpp.o: In function `PID::Compute()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:53: multiple definition of `PID::Compute()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:47: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetTunings(double, double, double)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:88: multiple definition of `PID::SetTunings(double, double, double)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:83: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetSampleTime(int)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:110: multiple definition of `PID::SetSampleTime(int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:105: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetOutputLimits(double, double)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:135: multiple definition of `PID::SetOutputLimits(double, double)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:125: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetMode(int)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:156: multiple definition of `PID::SetMode(int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:146: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::Initialize()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:170: multiple definition of `PID::Initialize()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:160: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetControllerDirection(int)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:184: multiple definition of `PID::SetControllerDirection(int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:174: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetKp()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:200: multiple definition of `PID::GetKp()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:190: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetKi()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:201: multiple definition of `PID::GetKi()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:191: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetKd()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:202: multiple definition of `PID::GetKd()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:192: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetMode()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:203: multiple definition of `PID::GetMode()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:193: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetDirection()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:204: multiple definition of `PID::GetDirection()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:194: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:21: multiple definition of `PID::PID(double*, double*, double*, double, double, double, int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:21: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:21: multiple definition of `PID::PID(double*, double*, double*, double, double, double, int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:21: first defined here

__________________
Clover Creek Brewery, Puyallup WA
Planning - FS90 Amber Ale
Fermenters - Air
On tap
Ichter Hill IPA OG 1.058
Carbon River Hefe OG 1.049
atoughram is offline
 
Reply With Quote Quick reply to this message
Old 08-13-2013, 09:51 PM   #53
franckgaga
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jun 2013
Location: Quebec, QC, Canada
Posts: 41
Liked 5 Times on 5 Posts
Likes Given: 8

Default

Quote:
Originally Posted by atoughram View Post
Error compiling...











RIMS\utility\PID_v1mod.cpp.o: In function `PID::Compute()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:53: multiple definition of `PID::Compute()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:47: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetTunings(double, double, double)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:88: multiple definition of `PID::SetTunings(double, double, double)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:83: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetSampleTime(int)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:110: multiple definition of `PID::SetSampleTime(int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:105: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetOutputLimits(double, double)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:135: multiple definition of `PID::SetOutputLimits(double, double)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:125: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetMode(int)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:156: multiple definition of `PID::SetMode(int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:146: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::Initialize()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:170: multiple definition of `PID::Initialize()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:160: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::SetControllerDirection(int)':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:184: multiple definition of `PID::SetControllerDirection(int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:174: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetKp()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:200: multiple definition of `PID::GetKp()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:190: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetKi()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:201: multiple definition of `PID::GetKi()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:191: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetKd()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:202: multiple definition of `PID::GetKd()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:192: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetMode()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:203: multiple definition of `PID::GetMode()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:193: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID::GetDirection()':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:204: multiple definition of `PID::GetDirection()'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:194: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:21: multiple definition of `PID::PID(double*, double*, double*, double, double, double, int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:21: first defined here
RIMS\utility\PID_v1mod.cpp.o: In function `PID':
C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1mod.cpp:21: multiple definition of `PID::PID(double*, double*, double*, double, double, double, int)'
RIMS\utility\PID_v1.cpp.o:C:\Program Files (x86)\Arduino\libraries\RIMS\utility/PID_v1.cpp:21: first defined here
Delete PID_v1.cpp and PID_v1.h in your utility folder.

I've modify Arduino pid library and change the name to PID_v1mod to keep those libraries separated
__________________
franckgaga is offline
 
Reply With Quote Quick reply to this message
Old 08-14-2013, 11:21 PM   #54
franckgaga
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jun 2013
Location: Quebec, QC, Canada
Posts: 41
Liked 5 Times on 5 Posts
Likes Given: 8

Default

New version available (v1.6) :

Added :
- Filter on derivative only
- Integration clamping (better than integration static saturation)

Lot of bugfixes
__________________
franckgaga is offline
 
Reply With Quote Quick reply to this message
Old 08-15-2013, 05:25 PM   #55
franckgaga
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jun 2013
Location: Quebec, QC, Canada
Posts: 41
Liked 5 Times on 5 Posts
Likes Given: 8

Default

Found a bug in integrator clamping anti-windup stopping integral action when needed. I will post an update soon.

edit : New version available (v1.6.1) :

bugfixe :

- Integrator clamping anti-windup is now functional and work pretty well ! Zero temperature overshoot on my RIMS !

__________________
franckgaga is offline
Brumateur Likes This 
Reply With Quote Quick reply to this message
Old 08-18-2013, 11:59 PM   #56
atoughram
Feedback Score: 0 reviews
Recipes 
 
Join Date: May 2013
Location: Puyallup, Washington
Posts: 943
Liked 115 Times on 101 Posts
Likes Given: 173

Default

OK - Got that one to compile

__________________
Clover Creek Brewery, Puyallup WA
Planning - FS90 Amber Ale
Fermenters - Air
On tap
Ichter Hill IPA OG 1.058
Carbon River Hefe OG 1.049
atoughram is offline
franckgaga Likes This 
Reply With Quote Quick reply to this message
Old 12-10-2013, 06:20 PM   #57
franckgaga
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jun 2013
Location: Quebec, QC, Canada
Posts: 41
Liked 5 Times on 5 Posts
Likes Given: 8

Default

So I did not post for a while and it's mainly for 2 reasons :

  • University
  • I brewed about 5-6 batches with my RIMS and this library and it works pretty well ! I had scorching problems with my first 2 batches only because I was restricting the flow at 5 L/min. It was not enough for me, i needed a full-power flow at 8-9 L/min (with my Chugger pump and a 1700 W LWD element). I just called setInterruptFlow() with 8 and 11 L/min and it works pretty well ! My succeeded batches are : 1 farmhouse Ale, 1 English Pale Ale and 1 Amber Ale.

I don't think there is debugging left on this library. For me, i consider it "complete". If anyone need auto-tunning functionalities, you can express it (by liking this post or commenting) and I could find time to work on that...
I thought of adding a Serial-NOR flash chip (1 MB or more could be sufficient) to aquires datas without having to connect a computer on Arduino USB Port. It's not that essential but I'm willing to work on that if it's needed by anybody else than me...
__________________
franckgaga is offline
 
Reply With Quote Quick reply to this message
Old 12-27-2013, 11:04 PM   #58
AveB_Brewer
Feedback Score: 0 reviews
Recipes 
 
Join Date: Dec 2013
Posts: 3
Default

Thanks for posting your code, I am working on my own arduino controlled RIMs setup and this has been an excellent resource. I have a few questions after I read through the code.

1) You ask for the mash water volume but that doesn't appear to be taken into any of the calculations. Is this correct or am I missing it?
2) Did you determine the PID coefficients experimentally? Or was there a process you used?
3) You never ask for the water heater element wattage. Isn't this required? It seems like the PID equation should be based on the total energy in x liters of water at y temperature and then you use the element to add energy at a certain rate.

I am an electrical engineer but I did not take a controls class so maybe there is a gap in my understanding here. I will continue to do more research but I thought you might be able to help point me in the right direction.

__________________
AveB_Brewer is offline
 
Reply With Quote Quick reply to this message
Old 12-28-2013, 02:46 PM   #59
franckgaga
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jun 2013
Location: Quebec, QC, Canada
Posts: 41
Liked 5 Times on 5 Posts
Likes Given: 8

Default

Quote:
Originally Posted by AveB_Brewer View Post
Thanks for posting your code, I am working on my own arduino controlled RIMs setup and this has been an excellent resource. I have a few questions after I read through the code.

1) You ask for the mash water volume but that doesn't appear to be taken into any of the calculations. Is this correct or am I missing it?
2) Did you determine the PID coefficients experimentally? Or was there a process you used?
3) You never ask for the water heater element wattage. Isn't this required? It seems like the PID equation should be based on the total energy in x liters of water at y temperature and then you use the element to add energy at a certain rate.

I am an electrical engineer but I did not take a controls class so maybe there is a gap in my understanding here. I will continue to do more research but I thought you might be able to help point me in the right direction.
For 1) :

Mash water qty is the water quantity that you used in the process identification (see after) and with the current associated PID (manually calculated by you). It's useful if you brew simple and double beers that need about twice mash water and is twice slower to heat up. In that case, 2 process identification should be done and 2 PIDs should be calculated. Having said that, it's really not mandatory. If, for exemple, you brew 10L (simple) and 20L (double) batches, you can run process identification at 15 L and the associated PID should work pretty well with 10 L and 20 L (with a little bit of overshoot).

For 2) and 3)

All your questions can be answered with one systematic method applied every time in Control : PROCESS/SYSTEM IDENTIFICATION

That main objective is to find the equation (transfer function) that describes our physical process/system (in our case : water, pump and element input:heater power output: temp.). One of the most easy and trusted method is the step response (maybe you already studied that with first and second order filter)

I've included a tool that test your RIMS system (runned under normal condition) and put all necessary datas on the Serial Monitor of Arduino IDE, so that part should be easy.

A basic example of process identification would be :
  1. You start at 0 % of power on the element and you monitor the temperature per sec.
  2. At t = 1 sec, you put 50 % of power on the elements (2500 in my lib because it's 2500 mSec ON 2500 mSec OFF and so on, with time proportioning control) and you monitor the temperature.

With these 3 informations, input (heater power), output (temperature) and time (in sec) you can find the equation that describe your thermal system. It can be done manually or automatically with tools like Ident in MATLAB toolkit. After you can manually or automatically calculate your associated PID values (with that can regulate this mathematical function. There is a ton of method for that, if you're using MATLAB you can look at : PID Controller Tuning

edit : The Process Identification procedure (or step response) is mandatory if you want to know the "speed" of your thermal system. Manually managing mathematical equation and PID calulcation is not. You can try PID autotune algorithm at : http://playground.arduino.cc/Code/PIDAutotuneLibrary
__________________
franckgaga is offline
 
Reply With Quote Quick reply to this message
Old 02-07-2014, 01:32 AM   #60
franckgaga
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jun 2013
Location: Quebec, QC, Canada
Posts: 41
Liked 5 Times on 5 Posts
Likes Given: 8

Default

So I had some new interesting idea for my RIMS and i'll find the time to work on it soon :

  1. ALARM IF 0 V ON HEATER With a cheap 5V DC power supply I can detect if there is a voltage on the heater. Pretty usefull if my breaker is triggered or if I manually shut it off by an external switch. I will add an alarm on the speaker if 0 V is detected.
  2. 8 MBIT FLASH MEMORY BREW DATAS (SPI) I will add functionalities to store brew datas in a flash memory (I will use winbond W25Q80BV ~1$). It will be possible to dump brew datas on USB at the startup of the Arduino.
  3. SPEAKER ALARMS DISTINCTION There will be 4 possible speaker alarms so I will find a way to distinguish all possible alarms (maybe with different frequencies)...

As I said, if anyone need PID AUTOTUNE feature, express it (PM or anything), i will find time to work on that...
__________________
franckgaga is offline
 
Reply With Quote Quick reply to this message
Reply


Quick Reply
Message:
Options
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy Steam Infusion Mash System FlyGuy DIY Projects 225 06-07-2014 03:24 PM
Arduino Based Beer Monitor System brewn00b4 DIY Projects 40 12-06-2013 09:15 PM
For Sale - Steam Infusion Mash System Douglefish For Sale 4 10-17-2011 03:17 PM
For Sale - Recirculating Infusion Mash System RIMs jm427 For Sale 0 05-12-2011 10:28 PM
MASHING. Water recirculation instead of the mash recirculation albertf Equipment/Sanitation 2 12-27-2007 12:20 AM