Humidistat
Arduino firmware for a humidistat (humidity controller)
Loading...
Searching...
No Matches
CascadeHumidistat Class Reference

Control humidity using cascade PID: outer PID loop sets setpoints of two inner flow controllers, which drive a solenoid valve each. Adjust the public setpoint variable and call update(). More...

#include <CascadeHumidistat.h>

Inheritance diagram for CascadeHumidistat:
[legend]
Collaboration diagram for CascadeHumidistat:
[legend]

Public Member Functions

 CascadeHumidistat (HumiditySensor *hs, const ConfigStore *cs, etl::span< const FlowSensor, 2 > flowSensors, etl::array< uint8_t, 2 > pins_solenoid, uint8_t pwmRes)
 Constructor.
 
const FlowControllergetInner (uint8_t n) const
 Get a pointer to a inner FlowController instance.
 
void update ()
 
void updatePIDParameters ()
 
- Public Member Functions inherited from Humidistat
 Humidistat (const ConfigStore *cs, HumiditySensor *hs, double Kp, double Ki, double Kd, double Kf, uint16_t dt, double cvMin, double cvMax)
 Constructor.
 
double getHumidity () const
 Read the humidity.
 
double getTemperature () const
 Read the temperature.
 
double getCvMin () const
 
double getCvMax () const
 
- Public Member Functions inherited from Controller
 Controller (const ConfigStore *cs, double Kp, double Ki, double Kd, double Kf, uint16_t dt, double cvMin, double cvMax, double defaultSP, double defaultCV)
 Constructor.
 
void getTerms (double &pTerm, double &iTerm, double &dTerm) const
 Get the three PID terms by reference.
 
void update ()
 Run the controller: Typically reads a sensor, runs a cycle of the PID loop and drives some actuator.
 
void updatePIDParameters ()
 Update the PID parameters from the configStore.
 
const ConfigStoregetConfigStore ()
 Get a pointer to the ConfigStore instance.
 

Private Attributes

FlowController fcs [2]
 

Additional Inherited Members

- Public Attributes inherited from Controller
bool active = false
 
double pv = 0
 Process variable.
 
double sp
 Setpoint.
 
double cv
 Control variable.
 
- Protected Member Functions inherited from Humidistat
void runCycle ()
 Run a cycle of the controller. Reads a sample from the humidity controller and runs PID.
 
- Protected Attributes inherited from Humidistat
HumiditySensor & hs
 
- Protected Attributes inherited from Controller
PID pid
 
const ConfigStorecs
 
unsigned long sensorLastRead = 0
 

Detailed Description

Control humidity using cascade PID: outer PID loop sets setpoints of two inner flow controllers, which drive a solenoid valve each. Adjust the public setpoint variable and call update().

Definition at line 15 of file CascadeHumidistat.h.

Constructor & Destructor Documentation

◆ CascadeHumidistat()

CascadeHumidistat::CascadeHumidistat ( HumiditySensor * hs,
const ConfigStore * cs,
etl::span< const FlowSensor, 2 > flowSensors,
etl::array< uint8_t, 2 > pins_solenoid,
uint8_t pwmRes )

Constructor.

Parameters
hsPointer to a HumiditySensor instance
csPointer to a ConfigStore instance
flowSensorsSpan over 2 FlowSensor instances
pins_solenoidArray of 2 integers corresponding to the solenoid pins
pwmResPWM resolution (bits)

Definition at line 3 of file CascadeHumidistat.cpp.

Member Function Documentation

◆ getInner()

const FlowController * CascadeHumidistat::getInner ( uint8_t n) const
nodiscard

Get a pointer to a inner FlowController instance.

Parameters
nthe index of the FlowController (0 or 1)
Returns
pointer to the FlowController instance.

Definition at line 24 of file CascadeHumidistat.cpp.

◆ update()

void CascadeHumidistat::update ( )

Definition at line 13 of file CascadeHumidistat.cpp.

Here is the call graph for this function:

◆ updatePIDParameters()

void CascadeHumidistat::updatePIDParameters ( )

Definition at line 28 of file CascadeHumidistat.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ fcs

FlowController CascadeHumidistat::fcs[2]
private

Definition at line 17 of file CascadeHumidistat.h.


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