ESPHome  2022.1.2
Public Member Functions | Data Fields | Protected Member Functions
esphome::pid::PIDSimulator Class Reference

#include <pid_simulator.h>

Inheritance diagram for esphome::pid::PIDSimulator:
esphome::PollingComponent esphome::output::FloatOutput esphome::Component esphome::output::BinaryOutput

Public Member Functions

 PIDSimulator ()
 
float delta_t (float power)
 
float update_temp ()
 
void setup () override
 
void update () override
 
- Public Member Functions inherited from esphome::PollingComponent
 PollingComponent ()
 
 PollingComponent (uint32_t update_interval)
 Initialize this polling component with the given update interval in ms. More...
 
virtual void set_update_interval (uint32_t update_interval)
 Manually set the update interval in ms for this polling object. More...
 
void call_setup () override
 
virtual uint32_t get_update_interval () const
 Get the update interval in ms of this sensor. More...
 
- Public Member Functions inherited from esphome::Component
virtual void loop ()
 This method will be called repeatedly. More...
 
virtual void dump_config ()
 
virtual float get_setup_priority () const
 priority of setup(). More...
 
float get_actual_setup_priority () const
 
void set_setup_priority (float priority)
 
virtual float get_loop_priority () const
 priority of loop(). More...
 
void call ()
 
virtual void on_shutdown ()
 
virtual void on_safe_shutdown ()
 
uint32_t get_component_state () const
 
virtual void mark_failed ()
 Mark this component as failed. More...
 
bool is_failed ()
 
virtual bool can_proceed ()
 
bool status_has_warning ()
 
bool status_has_error ()
 
void status_set_warning ()
 
void status_set_error ()
 
void status_clear_warning ()
 
void status_clear_error ()
 
void status_momentary_warning (const std::string &name, uint32_t length=5000)
 
void status_momentary_error (const std::string &name, uint32_t length=5000)
 
bool has_overridden_loop () const
 
void set_component_source (const char *source)
 Set where this component was loaded from for some debug messages. More...
 
const char * get_component_source () const
 Get the integration where this component was declared as a string. More...
 
- Public Member Functions inherited from esphome::output::FloatOutput
void set_max_power (float max_power)
 Set the maximum power output of this component. More...
 
void set_min_power (float min_power)
 Set the minimum power output of this component. More...
 
void set_zero_means_zero (bool zero_means_zero)
 Sets this output to ignore min_power for a 0 state. More...
 
void set_level (float state)
 Set the level of this float output, this is called from the front-end. More...
 
virtual void update_frequency (float frequency)
 Set the frequency of the output for PWM outputs. More...
 
float get_max_power () const
 Get the maximum power output. More...
 
float get_min_power () const
 Get the minimum power output. More...
 
- Public Member Functions inherited from esphome::output::BinaryOutput
void set_inverted (bool inverted)
 Set the inversion state of this binary output. More...
 
void set_power_supply (power_supply::PowerSupply *power_supply)
 Use this to connect up a power supply to this output. More...
 
virtual void turn_on ()
 Enable this binary output. More...
 
virtual void turn_off ()
 Disable this binary output. More...
 
bool is_inverted () const
 Return whether this binary output is inverted. More...
 

Data Fields

float surface = 1
 
float mass = 3
 surface area in m² More...
 
float temperature = 21
 mass of simulated object in kg More...
 
float efficiency = 0.98
 current temperature of object in °C More...
 
float thermal_conductivity = 15
 heating efficiency, 1 is 100% efficient More...
 
float specific_heat_capacity = 4.182
 thermal conductivity of surface are in W/(m*K), here: steel More...
 
float heat_power = 500
 specific heat capacity of mass in kJ/(kg*K), here: water More...
 
float ambient_temperature = 20
 Heating power in W. More...
 
float update_interval = 1
 Ambient temperature in °C. More...
 
std::vector< float > delayed_temps
 The simulated updated interval in seconds. More...
 
size_t delay_cycles = 15
 storage of past temperatures for delaying temperature reading More...
 
float output_value = 0.0
 how many update cycles to delay the output More...
 
sensor::Sensorsensor = new sensor::Sensor()
 Current output value of heating element. More...
 

Protected Member Functions

void write_state (float state) override
 
- Protected Member Functions inherited from esphome::Component
virtual void call_loop ()
 
virtual void call_dump_config ()
 
void set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a unique name. More...
 
void set_interval (uint32_t interval, std::function< void()> &&f)
 
bool cancel_interval (const std::string &name)
 Cancel an interval function. More...
 
void set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult()> &&f, float backoff_increase_factor=1.0f)
 Set an retry function with a unique name. More...
 
void set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult()> &&f, float backoff_increase_factor=1.0f)
 
bool cancel_retry (const std::string &name)
 Cancel a retry function. More...
 
void set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a unique name. More...
 
void set_timeout (uint32_t timeout, std::function< void()> &&f)
 
bool cancel_timeout (const std::string &name)
 Cancel a timeout function. More...
 
void defer (const std::string &name, std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
void defer (std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
bool cancel_defer (const std::string &name)
 Cancel a defer callback using the specified name, name must not be empty. More...
 
- Protected Member Functions inherited from esphome::output::FloatOutput
void write_state (bool state) override
 Implement BinarySensor's write_enabled; this should never be called. More...
 

Additional Inherited Members

- Protected Attributes inherited from esphome::PollingComponent
uint32_t update_interval_
 
- Protected Attributes inherited from esphome::Component
uint32_t component_state_ {0x0000}
 State of this component. More...
 
float setup_priority_override_ {NAN}
 
const char * component_source_ = nullptr
 
- Protected Attributes inherited from esphome::output::FloatOutput
float max_power_ {1.0f}
 
float min_power_ {0.0f}
 
bool zero_means_zero_
 
- Protected Attributes inherited from esphome::output::BinaryOutput
bool inverted_ {false}
 
power_supply::PowerSupplyRequester power_ {}
 

Detailed Description

Definition at line 11 of file pid_simulator.h.

Constructor & Destructor Documentation

◆ PIDSimulator()

esphome::pid::PIDSimulator::PIDSimulator ( )
inline

Definition at line 13 of file pid_simulator.h.

Member Function Documentation

◆ delta_t()

float esphome::pid::PIDSimulator::delta_t ( float  power)
inline

Definition at line 29 of file pid_simulator.h.

◆ setup()

void esphome::pid::PIDSimulator::setup ( )
inlineoverridevirtual

Reimplemented from esphome::Component.

Definition at line 64 of file pid_simulator.h.

◆ update()

void esphome::pid::PIDSimulator::update ( )
inlineoverridevirtual

Implements esphome::PollingComponent.

Definition at line 65 of file pid_simulator.h.

◆ update_temp()

float esphome::pid::PIDSimulator::update_temp ( )
inline

Definition at line 40 of file pid_simulator.h.

◆ write_state()

void esphome::pid::PIDSimulator::write_state ( float  state)
inlineoverrideprotectedvirtual

Implements esphome::output::FloatOutput.

Definition at line 71 of file pid_simulator.h.

Field Documentation

◆ ambient_temperature

float esphome::pid::PIDSimulator::ambient_temperature = 20

Heating power in W.

Definition at line 22 of file pid_simulator.h.

◆ delay_cycles

size_t esphome::pid::PIDSimulator::delay_cycles = 15

storage of past temperatures for delaying temperature reading

Definition at line 25 of file pid_simulator.h.

◆ delayed_temps

std::vector<float> esphome::pid::PIDSimulator::delayed_temps

The simulated updated interval in seconds.

Definition at line 24 of file pid_simulator.h.

◆ efficiency

float esphome::pid::PIDSimulator::efficiency = 0.98

current temperature of object in °C

Definition at line 18 of file pid_simulator.h.

◆ heat_power

float esphome::pid::PIDSimulator::heat_power = 500

specific heat capacity of mass in kJ/(kg*K), here: water

Definition at line 21 of file pid_simulator.h.

◆ mass

float esphome::pid::PIDSimulator::mass = 3

surface area in m²

Definition at line 16 of file pid_simulator.h.

◆ output_value

float esphome::pid::PIDSimulator::output_value = 0.0

how many update cycles to delay the output

Definition at line 26 of file pid_simulator.h.

◆ sensor

sensor::Sensor* esphome::pid::PIDSimulator::sensor = new sensor::Sensor()

Current output value of heating element.

Definition at line 27 of file pid_simulator.h.

◆ specific_heat_capacity

float esphome::pid::PIDSimulator::specific_heat_capacity = 4.182

thermal conductivity of surface are in W/(m*K), here: steel

Definition at line 20 of file pid_simulator.h.

◆ surface

float esphome::pid::PIDSimulator::surface = 1

Definition at line 15 of file pid_simulator.h.

◆ temperature

float esphome::pid::PIDSimulator::temperature = 21

mass of simulated object in kg

Definition at line 17 of file pid_simulator.h.

◆ thermal_conductivity

float esphome::pid::PIDSimulator::thermal_conductivity = 15

heating efficiency, 1 is 100% efficient

Definition at line 19 of file pid_simulator.h.

◆ update_interval

float esphome::pid::PIDSimulator::update_interval = 1

Ambient temperature in °C.

Definition at line 23 of file pid_simulator.h.


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