Anti-Sway Capstone 1.0
Loading...
Searching...
No Matches
discrete-lib.h File Reference

Discrete Control Law Implementation Library Header. More...

#include <float.h>
Include dependency graph for discrete-lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Biquad
 Biquad. More...
 
struct  Integrator
 Control Block: Integrator. More...
 
struct  Differentiator
 Control Block: Differentiator. More...
 

Macros

#define POS_INF   DBL_MAX
 Positive Infinity.
 
#define NEG_INF   (-DBL_MAX)
 Negative Infinity.
 

Typedefs

typedef float Proportional
 Control Block: Proportion.
 

Functions

void IntegratorInit (Proportional gain, double timestep, Integrator *result)
 
void DifferentiatorInit (Proportional gain, double timestep, Differentiator *result)
 
double Cascade (double input, Biquad sys[], int size, double lower_lim, double upper_lim)
 
double Integrate (double input, Integrator *term, double lower_lim, double upper_lim)
 
double Differentiate (double input, Differentiator *term, double lower_lim, double upper_lim)
 
double PID (double input, Proportional *p, Integrator *i, Differentiator *d, double lower_lim, double upper_lim)
 

Detailed Description

Discrete Control Law Implementation Library Header.

Author
Anti-Sway Team: Nguyen, Tri; Espinola, Malachi; Tevy, Vattanary; Hokenstad, Ethan; Neff, Callen)
Version
0.1
Date
2024-06-03

Typedef Documentation

◆ Proportional

typedef float Proportional

Control Block: Proportion.

A proportional constant

Function Documentation

◆ Cascade()

double Cascade ( double input,
Biquad sys[],
int size,
double lower_lim,
double upper_lim )
inline

Executes a dynamic, discrete time system by using its biquad decomposition.

Parameters
inputThe input to the system
sysThe system, as an array of biquads
sizeThe size of sys
lower_limThe lower saturation limit of the system
upper_limThe upper saturation limit of the system
Returns
The output of the system given the input
Precondition
The input is the next sampled value of the input to the system
Postcondition
The system is updated with current/past calculated values
Here is the call graph for this function:

◆ Differentiate()

double Differentiate ( double input,
Differentiator * term,
double lower_lim,
double upper_lim )
inline

Timesteps a Differentiation

Parameters
inputThe input to the differentiator
termA pointer to an differentiator term
lower_limThe lower saturation limit of the system
upper_limThe upper saturation limit of the system
Returns
The output of the differentiator given the input
Precondition
The input is the next sampled value of the input to the system
Postcondition
term is updated with current/past calculated values

◆ DifferentiatorInit()

void DifferentiatorInit ( Proportional gain,
double timestep,
Differentiator * result )

Initializes a Differentiator

Parameters
gainThe gain to assign the differentiator
timestepThe timestep to approximate the differentiator
resultA return parameter, which becomes the differentiator with the gain and timestep
Returns
result, which will be an differentiator with a gain gain, and the timestep

◆ Integrate()

double Integrate ( double input,
Integrator * term,
double lower_lim,
double upper_lim )
inline

Timesteps an Integration

Parameters
inputThe input to the integrator
termA pointer to an integrator term
lower_limThe lower saturation limit of the system
upper_limThe upper saturation limit of the system
Returns
The output of the integrator given the input
Precondition
The input is the next sampled value of the input to the system
Postcondition
term is updated with current/past calculated values

◆ IntegratorInit()

void IntegratorInit ( Proportional gain,
double timestep,
Integrator * result )

Initializes an Integrator

Parameters
gainThe gain to assign the integrator
timestepThe timestep to approximate the integrator
resultA return parameter, which becomes the integrator with the gain and timestep
Returns
result, which will be an integrator with a gain gain, and the timestep

◆ PID()

double PID ( double input,
Proportional * p,
Integrator * i,
Differentiator * d,
double lower_lim,
double upper_lim )
inline

Timesteps a PID Controller

Parameters
inputThe input to the PID Controller
pA pointer to the proportional term
iA pointer to the integrator term
dA pointer to the differentiator term
lower_limThe lower saturation limit of the system
upper_limThe upper saturation limit of the system
Returns
The output of the PID Controller given the input
Precondition
The input is the next sampled value of the input to all non-NULL Control Blocks
If p, i or d is NULL, then those NULL terms don't contribute
if p, i and d are all NULL, then the output is 0.0
Postcondition
i and d are updated with current/past calculated values
Here is the call graph for this function: