TTK4155 Ping-pong project
pi.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pi_t
 

Macros

#define SCALING_FACTOR   30
 
#define K_p   12
 
#define K_i   1
 

Functions

void pi_init (int16_t Kp_set, int16_t Ki_set, struct pi_t *regulator_p)
 Initialization of PID controller parameters. More...
 
int16_t pi_controller (int16_t set_point, int16_t measurement, struct pi_t *regulator_p)
 PID control algorithm. More...
 
void pi_reset_integrator (struct pi_t *regulator_p)
 Resets the integrator. More...
 

Macro Definition Documentation

◆ K_i

#define K_i   1

◆ K_p

#define K_p   12

◆ SCALING_FACTOR

#define SCALING_FACTOR   30

Function Documentation

◆ pi_controller()

int16_t pi_controller ( int16_t  set_point,
int16_t  measurement,
struct pi_t regulator_p 
)

PID control algorithm.

Calculates output from setpoint, process value and PID status.

Parameters
set_pointDesired value.
measurementMeasured value.
pi_stPI status struct.
Here is the caller graph for this function:

◆ pi_init()

void pi_init ( int16_t  Kp_set,
int16_t  Ki_set,
struct pi_t regulator_p 
)

Initialization of PID controller parameters.

Initialize the variables used by the PID algorithm.

Parameters
KpProportional term.
KiIntegral term.
regulator_pStruct with PI status.
Here is the caller graph for this function:

◆ pi_reset_integrator()

void pi_reset_integrator ( struct pi_t regulator_p)

Resets the integrator.

Calling this function will reset the integrator in the PID regulator.