PID Controller in NodeJS for liquids (water, beer, etc.). Simulator, Plots and Tests are included.
Let's go and brew something!
https://npmjs.org/package/liquid-pid
$ npm install liquid-pid
var
liquidPID = require('liquid-pid'),
actualP = 0,
pidController;
pidController = new liquidPID({
temp: {
ref: 67 // Point temperature
},
Pmax: 1000, // Max power (output),
// Tune the PID Controller
Kp: 25, // PID: Kp
Ki: 1000, // PID: Ki
Kd: 9 // PID: Kd
});
actualP = pidController.calculate(66.7); // call with the actual temp
console.log(actualP);
actualP = pidController.calculate(67.0); // call with the actual temp
console.log(actualP);
actualP = pidController.calculate(69.0); // call with the actual temp
console.log(actualP);
For more complex example please check the simulation/ dir.
Configure the PID controller For the details please check http://en.wikipedia.org/wiki/PID_controller
return Number, with the actual ref temperature (what we want to reach/hold)
Set new point temperature.
Call it continuesly to calculate the required power/output for your heater during the time.
Reach and hold 40 °C
http://hekike.github.io/liquid-pid/plot/app/
Tests are included.
The "liquid-pid" is used in our BIAB homebrew installation.
For more info: @slashdotpeter