thermferm/pid.h

Thu, 10 Jan 2019 16:33:42 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 10 Jan 2019 16:33:42 +0100
changeset 569
9c69d43bfb06
parent 495
712984fdd26b
permissions
-rw-r--r--

Version 0.9.0. Implemented DCMD via mqtt to set stage, mode, setpoint low and high. Implemeted DCMD via mqtt to set heater, cooler, fan and light state. Implemented DCMD via mqtt to set product code and name. Set the PID's in fridge mode without idle range offset, that was an old leftover setting that was obsolete.

#ifndef	PID_H
#define	PID_H

#define	PID_MODE_NONE		0	/* Process control off				*/
#define	PID_MODE_AUTO		1	/* Process control auto				*/
#define	PID_MODE_BOO		2	/* Process control Bang On/Off			*/

#define	PID_TYPE_HEAT		0	/* PID is used for heating			*/
#define	PID_TYPE_COOL		1	/* PID is used for cooling			*/



typedef struct _pid_var {
	double		iMax;		/* Maximum allowable integrator state		*/
	double		iGain;		/* Integral gain				*/
	double		pGain;		/* Proportional gain				*/
	double		dGain;		/* Derivative gain				*/
	double		idleRange;	/* Idle range					*/

	double		Input;		/* Input value					*/
	double		Err;		/* Error, diff between input and set point	*/
	double		InputLast;	/* Input from last pass				*/
	double		iState;		/* Error from next last pass			*/
	double		SetP;		/* Set point					*/
	double		OutP;		/* Output of PID algorithm			*/
	int		Mode;		/* Value is 'PID_AUTO' if loop is automatic	*/
	int		Type;		/* Value is 'HEAT' or 'COOL'			*/
} pid_var;


void InitPID( pid_var *, int);
void UpdatePID( pid_var *);

#endif

mercurial