-
Notifications
You must be signed in to change notification settings - Fork 0
/
PIDparameters.h
82 lines (72 loc) · 4.04 KB
/
PIDparameters.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once
#ifndef PIDPARAMETERS_H
#define PIDPARAMETERS_H
struct PIDparameters
{
/* The gain K is set to a positive value if the measured value goes in the same
* direction as the control signal, otherwise negative.
* An increase in the gain K means that the gain curve is raised for all frequencies while the
* phase curve remains unchanged. The increased gain at low frequencies means that any
* stationary errors are reduced. Increasing the gain will increase the cutoff frequency ωc of
* the compensated system. The increased cutting frequency means that the speed of the closed
* system increases. Because now the phase margin must be read at a higher frequency
* the gain increase will also mean that the phase margin decreases and
* the robustness becomes worse.
*/
float proportionalGain;
/* The integration time in seconds.
* A reduction in Ti means an increase in integral action. A reduction in Ti causes the gain to increase
* for low frequencies, while the phase decreases. The increased gain at low
* frequencies mean that any stationary errors are reduced.
* The increased gain causes the speed of the closed system to increase.
* Because the phase margin must now be read at a higher frequency, at the same time as the phase
* decreased, the robustness of the closed system becomes worse.
*/
float integrationTimeSecond;
/* The derivative time in seconds.
* An increase in Td means that the gain increases for high frequencies,
* while the phase increases. The increase in gain means that the cutoff frequency
* ωc increases.
* The increased cutting frequency means that the system becomes faster. The fact that
* the phase margin must now be read at a higher frequency gives a poorer robustness, but
* since we have simultaneously raised the phase, we cannot draw this conclusion. There actually is
* a possibility that one can achieve both an increase in speed and an improved robustness by raising Td.
* However, this only applies within certain limits. Then gives an increase in Td impaired robustness.
*/
float derivateTimeSecond;
/* Time constant in seconds that controls how quickly the integral part should
* be restored after a limitation of the control signal. Tt is referred to as "tracking time
* constant". The time constant Tt should be greater than Td but less than Ti.
* A rule of thumb is to choose Tt according to Tt = sqrt(Ti * Td) for a PID controller and
* for a PI controller Tt = 0.5 * Ti.
*/
float trackingTimeConstantSecond;
/* The time constant of the analogue measured value filter in e.g. seconds.
* To avoid the alias effect, the filter must eliminate any frequencies higher than half the
* sampling rate. The time constant Tanalogue f shall be chosen so that the
* frequencies above half the sampling frequency are attenuated, e.g. 16 times.
*/
float filterTimeConstantSecond;
/* The time constant of the derivative filter in seconds. This filter filters the measured value
* before the D-part. The filter is necessary for the prediction of the D-part to be reliable even if the
* measurement signal contains noise.
* Rule of thumb for the D filter Tf = Td / 10 is a good rule.
* Tf can be chosen according to Tf = Td/N, where typical
* values of N are between 2 and 20.
* The disadvantage of filtering is that the filter causes a delay
* or, more precisely, a phase shift of the signal. A delay negatively affects the D-part
* prediction function, which is not desirable. It is important to find a balance between
* how hard you want to filter and how much delay you can allow.
*/
float derivateFilterTimeConstantSecond;
/* Setpoint weighting factor, value 0-1.
*/
float setpointWeightingFactor;
/*
* The sampling time is the time in e.g. seconds between each execution of the
* regulator algorithm. Sampling rate = 1/h. A rule of thumb is to choose the sampling
* time shorter than one-fifth of the process's time constant T.
*/
float sampleTimeSecond;
};
#endif // PIDPARAMETERS_H