-
Notifications
You must be signed in to change notification settings - Fork 0
/
pid.h
38 lines (29 loc) · 819 Bytes
/
pid.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Guard
*/
#ifndef PID_H_DEF
#define PID_H_DEF
typedef struct
{
float K; //K-Anteil
float I; //I-Anteil
float D; //D-Anteil
float errorSum; //Integrierter Fehler
float errorOld; //Abgeleiteter Fehler
uint8_t activateLimit; //Obere und untere Grenzwerte aktivieren
int32_t upperLimit; //Oberer Grenzwert
int32_t lowerLimit; //Unterer Grenzert
int32_t vorsteuerung;
float samplingTime; //Abtastzeit in ms
//Input, Outputscale?
}PID_PIDConfig;
/*
* Initialisiert eine PID_PIDConfig-Struktur um sie anschließend zu verwenden.
*/
void PID_Init(PID_PIDConfig *config);
/*
* Berechnet aus einem Ist- und einem Sollwert den Stellwert anhand eines in
* config definierten PID-Reglers.
*/
float PID_Control(float ist, float soll, PID_PIDConfig *config);
#endif