| LightHub v4.0.0 Smarthome controller firmware

out_pid.h
Go to the documentation of this file.
1 #pragma once
2 #include "options.h"
3 #ifndef PID_DISABLE
4 #include <abstractout.h>
5 #include <item.h>
6 #include <PID_v1.h>
7 #include "itemCmd.h"
8
9 #define OUTPUT_TRESHOLD 1.0
10
11 class pidPersistent : public chPersistent {
12 public:
13 PID * pid;
14 double output;
15 double input;
16 double setpoint;
17 float prevOut;
18 int driverStatus;
19 uint32_t alarmTimer;
20 bool alarmArmed;
21 uint16_t alarmTimeout; //in sec
22 };
23
24
25
26 class out_pid : public abstractOut {
27 public:
28
29 out_pid(Item * _item):abstractOut(_item){store = (pidPersistent *) item->getPersistent();};
30 int Setup() override;
31 int Poll(short cause) override;
32 int Stop() override;
33 int Status() override;
34 int isActive() override;
35 int getChanType() override;
36 int getDefaultStorageType(){return ST_FLOAT;};
37 int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true) override;
38 void alarm(bool);
39
40
41 protected:
42 pidPersistent * store;
43 bool getConfig();
44 };
45 #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