![]() |
flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
|
#include "pid_controller.h"#include <math.h>#include <stdlib.h>#include <string.h>#include <flexptp_options.h>Go to the source code of this file.
Macros | |
| #define | K_P (0.5 * 0.476) |
| Default Kp parameter value. | |
| #define | K_I (0) |
| Default Ki parameters value. | |
| #define | K_D (3.0) |
| Default Kd parameter value. | |
Functions | |
| void | pid_ctrl_init () |
| void | pid_ctrl_deinit () |
| void | pid_ctrl_reset () |
| float | pid_ctrl_run (int32_t dt, PtpServoAuxInput *pAux) |
Variables | |
| static bool | logInternals = false |
| Decides if servo's internal operation shoud be reported or not. | |
| static bool | firstRun = true |
| Indicates if first run did not occur yet. | |
| static float | Kp = (0.5 * 0.476) |
| Proportional factor. | |
| static float | Ki = (0) |
| Integrating factor. | |
| static float | Kd = (3.0) |
| Differentiating factor. | |
| static double | rd_prev_ppb |
| relative frequency error measured in previous iteration | |
| static double | integrator_value |
| value stored in the integrator | |
| #define K_D (3.0) |
Default Kd parameter value.
Definition at line 22 of file pid_controller.c.
| #define K_I (0) |
Default Ki parameters value.
Definition at line 18 of file pid_controller.c.
| #define K_P (0.5 * 0.476) |
Default Kp parameter value.
Definition at line 14 of file pid_controller.c.
| void pid_ctrl_deinit | ( | ) |
Deinitialize PID controller.
Definition at line 112 of file pid_controller.c.
| void pid_ctrl_init | ( | ) |
Initialize PID controller.
Definition at line 104 of file pid_controller.c.
| void pid_ctrl_reset | ( | ) |
Reset PID controller.
Definition at line 118 of file pid_controller.c.
| float pid_ctrl_run | ( | int32_t | dt, |
| PtpServoAuxInput * | pAux | ||
| ) |
Run the PID controller.
| dt | time error in nanoseconds |
| pAux | auxiliary synchronization cycle context data |
Definition at line 123 of file pid_controller.c.
|
static |
Indicates if first run did not occur yet.
Definition at line 28 of file pid_controller.c.
|
static |
value stored in the integrator
Definition at line 43 of file pid_controller.c.
|
static |
Differentiating factor.
Definition at line 38 of file pid_controller.c.
|
static |
Integrating factor.
Definition at line 37 of file pid_controller.c.
|
static |
Proportional factor.
Definition at line 36 of file pid_controller.c.
|
static |
Decides if servo's internal operation shoud be reported or not.
Definition at line 27 of file pid_controller.c.
|
static |
relative frequency error measured in previous iteration
Definition at line 42 of file pid_controller.c.