rims-arduino-library  v3.1.1
Recirculation infusion mash system library for Arduino
Public Member Functions | Protected Member Functions | List of all members
RimsIdent Class Reference

Toolkit for process identification to manually calculate PID tuning. More...

#include <RimsIdent.h>

Inheritance diagram for RimsIdent:
Rims

Public Member Functions

 RimsIdent (UIRims *uiRims, byte analogPinTherm, byte ssrPin, double *currentTemp, double *ssrControl, double *settedTemp)
 Consructor. More...
 
void setFlowSensor (byte pinFlow, float flowFactor, float lowBound=-1, float upBound=100, float critalFlow=-1)
 Same as Rims::setFlowSensor. More...
 
- Public Member Functions inherited from Rims
 Rims (UIRims *uiRims, byte analogPinPV, byte ssrPin, double *currentTemp, double *ssrControl, double *settedTemp)
 Constructor. More...
 
void setTempProbe (byte probeType, float probeCoefs[], float res1)
 Set temperature probe (RTD, thermistor or custom) parameters. More...
 
void setPinLED (byte pinLED)
 Set pin for heater LED indicator. More...
 
void setFlowSensor (byte pinFlow, float flowFactor, float lowBound=DEFAULTFLOWLOWBOUND, float upBound=DEFAULTFLOWUPBOUND, float criticalFlow=DEFAULTFLOWLOWBOUND)
 Set pin for flow sensor and parameters. More...
 
void setHeaterPowerDetect (char pinHeaterVolt)
 Set pin to detect if there is voltage applied on heater. More...
 
void setTuningPID (float Kp, float Ki, float Kd, float tauFilter, int mashWaterQty=-1)
 Set tuning for PID object. More...
 
void setMemCSPin (byte csPin)
 Set pin for flash memory chip select. More...
 
void checkMemAccessMode ()
 Check if enterring in USB memory access mode. More...
 
void run ()
 Start and run Rims instance. More...
 
float getTempPV ()
 Get temperature from temperature probe (RTD, thermistor or custom). More...
 
float getFlow ()
 Get flow from hall-effect flow sensor. More...
 
bool getHeaterVoltage ()
 Check if heater is powered or not. More...
 
void stopHeating (bool state)
 Stop heater no matter what PID output. More...
 

Protected Member Functions

void _initialize ()
 Initialize RimsIdent before iterations.
 
void _iterate ()
 Iterations for RimsIdent instance. More...
 
- Protected Member Functions inherited from Rims
void _initSession ()
 Init all attributes and I/O for starting a brew session.
 
void _endSession ()
 Attributes treatments for ending a brew session.
 
void _refreshTimer ()
 Refresh time related values. More...
 
void _refreshDisplay ()
 Refresh display used by UIRims instance.
 
void _refreshSSR ()
 Refresh solid state relay. SSR will be refreshed in function of _controlValPtr (duty-cycle in percentage) and SSRWINDOWSIZE (mSec) values.
 
void _serialPrintBrewData ()
 Print current data points values to the Serial logger. Serial port (UART) need to be initialized in the main sketch with Serial.begin()
 
unsigned int _memCountSessions ()
 Count how many brew sessions were saved in flash mem. More...
 
unsigned long _memCountSessionData ()
 Count how many data point were taken. More...
 
void _memInitSP ()
 Initialize flash memory. More...
 
void _memAddBrewData ()
 Add data point to the flash memory. More...
 
void _memDumpBrewData ()
 Dump brew session data on USB serial port.
 
void _memFreeSpace ()
 Show free memory on flash mem via USB serial port.
 
void _memClearAll ()
 Clear all memory via USB serial port.
 

Detailed Description

Toolkit for process identification to manually calculate PID tuning.

It sends differents values to the SSR and monitors the resulting temperature on the serial monitor. Open the serial monitor before stating identification. If flash memory is correctly connected, the data will be stored in the flash mem too. It last IDENTLENGTH mSec (90 minutes). Since heating processes (like a RIMS) have very large time constant, the identification tests need to be long enough.

Author
Francis Gagnon
Examples:
rimsIdentBasic.ino.

Constructor & Destructor Documentation

◆ RimsIdent()

RimsIdent::RimsIdent ( UIRims uiRims,
byte  analogPinTherm,
byte  ssrPin,
double *  currentTemp,
double *  ssrControl,
double *  settedTemp 
)

Consructor.

Parameters
uiRims: UIRims*. Pointer to UIRims instance
analogPinTherm: byte. Analog pin to temperature probe
ssrPin: byte. Pin to control heater's solid state relay.
currentTemp: double*. Pointer to a double that will be used for current temparature
ssrControl: double*. Pointer to a double that will use to control SSR
settedTemp: double*. Pointer to a double that will be use to store setted temperature

Member Function Documentation

◆ _iterate()

void RimsIdent::_iterate ( )
protectedvirtual

Iterations for RimsIdent instance.

Identification process will last IDENTLENGTH mSec. It starts at STEP0VALUE % long enough for temperature stabilization in steady-state. The tested bumps are :

  1. STEP1VALUE % at t = STEP1TIME mSec. It should be long enough for a correct estimation of process static gain with a positive CV (over STEP0VALUE).
  2. STEP2VALUE % at t = STEP2TIME mSec. This bump test is for estimating negative CV (under STEP0VALUE) behavior on process.
  3. STEP3VALUE % at t = STEP3TIME mSec. This bump test should be short to estimate process behavior at higher frequencies.
  4. end at IDENTLENGTH mSec, back at STEP0VALUE %

All information for process identification is printed in the Serial monitor of the Arduino IDE. If flash memory is correctly connected, the data will be stored in the flash mem too.

I won't explain here how to identify process model and how to tune PID with that information but there's a lot on information here : http://tinyurl.com/pu99b6n

Reimplemented from Rims.

◆ setFlowSensor()

void RimsIdent::setFlowSensor ( byte  pinFlow,
float  flowFactor,
float  lowBound = -1,
float  upBound = 100,
float  critalFlow = -1 
)

Same as Rims::setFlowSensor.

Redefinied to force criticalFlow at -1 and default bounds are fixed at -1 and 100 so you can identify a process model at any flowrate.


The documentation for this class was generated from the following files: