out_pid.h
Go to the documentation of this file.
#pragma once
#include "options.h"
#ifndef PID_DISABLE
#include <abstractout.h>
#include <item.h>
#include <PID_v1.h>
#include "itemCmd.h"
#define OUTPUT_TRESHOLD 1.0
class pidPersistent : public chPersistent {
public:
PID * pid;
double output;
double input;
double setpoint;
float prevOut;
int driverStatus;
uint32_t alarmTimer;
bool alarmArmed;
uint16_t alarmTimeout; //in sec
};
class out_pid : public abstractOut {
public:
out_pid(Item * _item):abstractOut(_item){store = (pidPersistent *) item->getPersistent();};
int Setup() override;
int Poll(short cause) override;
int Stop() override;
int Status() override;
int isActive() override;
int getChanType() override;
int getDefaultStorageType(){return ST_FLOAT;};
int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true) override;
void alarm(bool);
protected:
pidPersistent * store;
bool getConfig();
};
#endif
pidPersistent::alarmTimeout
uint16_t alarmTimeout
Definition: out_pid.h:21
itemCmd.h
itemCmd
Definition: itemCmd.h:153
pidPersistent::prevOut
float prevOut
Definition: out_pid.h:17
pidPersistent::output
double output
Definition: out_pid.h:14
chPersistent
Definition: abstractout.h:7
pidPersistent::pid
PID * pid
Definition: out_pid.h:13
out_pid
Definition: out_pid.h:26
pidPersistent::input
double input
Definition: out_pid.h:15
out_pid::Poll
int Poll(short cause) override
Definition: out_pid.cpp:161
options.h
abstractOut
Definition: abstractout.h:8
out_pid::getChanType
int getChanType() override
Definition: out_pid.cpp:253
pidPersistent::driverStatus
int driverStatus
Definition: out_pid.h:18
out_pid::Setup
int Setup() override
Remove?? Now getChanType used instead.
Definition: out_pid.cpp:111
pidPersistent::alarmTimer
uint32_t alarmTimer
Definition: out_pid.h:19
pidPersistent::alarmArmed
bool alarmArmed
Definition: out_pid.h:20
out_pid::Stop
int Stop() override
Definition: out_pid.cpp:138
Item::getPersistent
chPersistent * getPersistent()
Definition: item.cpp:464
out_pid::Ctrl
int Ctrl(itemCmd cmd, char *subItem=NULL, bool toExecute=true) override
Control unified PID controller item
Definition: out_pid.cpp:264
pidPersistent::setpoint
double setpoint
Definition: out_pid.h:16
out_pid::isActive
int isActive() override
Definition: out_pid.cpp:155
out_pid::out_pid
out_pid(Item *_item)
Definition: out_pid.h:29
out_pid::alarm
void alarm(bool)
Definition: out_pid.cpp:195
out_pid::Status
int Status() override
Definition: out_pid.cpp:148
Item
Definition: item.h:104
abstractout.h
out_pid::getDefaultStorageType
int getDefaultStorageType()
Definition: out_pid.h:36
ST_FLOAT
#define ST_FLOAT
Definition: itemCmd.h:92
out_pid::getConfig
bool getConfig()
Definition: out_pid.cpp:11
pidPersistent
Definition: out_pid.h:11
out_pid::store
pidPersistent * store
Definition: out_pid.h:42
abstractOut::item
Item * item
Definition: abstractout.h:18
item.h