yarf 0.1
Yet Another RepRap Firmware
|
The proportional–integral–derivative algorithm controls the amount of power delivered to the nozzle and printbed heaters, in order to keep them at their required temperature, without too much fluctuation. More...
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | pid_t |
Datastructure for an instance of the PID algorithm. More... | |
Functions | |
void | pid_init (pid_t *pid, uint8_t envelope, uint8_t p, uint8_t i, uint8_t d) |
Initializes an instance of the PID algorithm. | |
void | pid_set_target (pid_t *pid, float target_temp) |
Sets the target temperature for a given PID algorithm instance. | |
uint8_t | pid_next (pid_t *pid, float current_temp) |
Returns the next result of a given PID algorithm instance, given the current measured temperature. |
The proportional–integral–derivative algorithm controls the amount of power delivered to the nozzle and printbed heaters, in order to keep them at their required temperature, without too much fluctuation.
Definition in file pid.h.
void pid_init | ( | pid_t * | pid, |
uint8_t | envelope, | ||
uint8_t | p, | ||
uint8_t | i, | ||
uint8_t | d | ||
) |
Initializes an instance of the PID algorithm.
pid | pointer to the instance of the PID algorithm to initialize |
envelope | number of degrees above or below the target temperature, at which the PID algorithm kicks in. Outside of this temperature range, pid_next returns 0 if the temperature is too high and 255 if it is too low. |
p | gain of the proportional component for the given PID instance |
i | gain of the integral component for the given PID instance |
d | gain of the derivative component for the given PID instance |
uint8_t pid_next | ( | pid_t * | pid, |
float | current_temp | ||
) |
Returns the next result of a given PID algorithm instance, given the current measured temperature.
The result indicates the amount of power to apply to heater belonging to the given PID instance. This function should be called at short periodic intervals.
pid | pointer to the PID instance for which to return the next result |
current_temp | the current measured temperature in degrees celsius |