PID Control
1.0
Discrete time implementation of P, PI, PD, PID. Including derivative filter, integral clamping, feed-forward, gain scheduling in standard and parallel form.
Toggle main menu visibility
Loading...
Searching...
No Matches
p.tpp
Go to the documentation of this file.
1
#include "
../../include/proportional/p.h
"
2
3
template
<
typename
T>
4
control_system::proportional::P<T>::P
()
5
{
6
Kp = 0.0;
7
}
8
9
template
<
typename
T>
10
void
control_system::proportional::P<T>::init
(T Kp_, T u_max_)
11
{
12
set_param(Kp_, u_max_);
13
}
14
15
template
<
typename
T>
16
void
control_system::proportional::P<T>::set_param
(T Kp_, T u_max_)
17
{
18
Kp = Kp_;
19
u_max = u_max_;
20
}
21
22
template
<
typename
T>
23
T
control_system::proportional::P<T>::update
(T x_0, T x)
24
{
25
return
saturate
(Kp * (x_0 - x), -u_max, u_max);
26
}
27
28
template
<
typename
T>
29
void
control_system::proportional::P<T>::reset
()
30
{
31
}
32
33
template
<
typename
T>
34
void
control_system::proportional::P<T>::set_Kp
(T Kp_)
35
{
36
Kp = Kp_;
37
}
38
39
template
<
typename
T>
40
void
control_system::proportional::P<T>::set_u_max
(T u_max_)
41
{
42
u_max = u_max_;
43
}
44
45
template
<
typename
T>
46
T
control_system::proportional::P<T>::get_Kp
()
47
{
48
return
Kp;
49
}
50
51
template
<
typename
T>
52
T
control_system::proportional::P<T>::get_u_max
()
53
{
54
return
u_max;
55
}
control_system::proportional::P::init
void init(T Kp_, T u_max_)
Initializes the proportional controller.
Definition
p.h:11
control_system::proportional::P::P
P()
Constructs a proportional controller.
Definition
p.h:5
control_system::proportional::P::set_u_max
void set_u_max(T u_max_)
Sets the maximum controller output.
Definition
p.h:41
control_system::proportional::P::update
T update(T x_0, T x)
Computes the proportional control output.
Definition
p.h:24
control_system::proportional::P::get_Kp
T get_Kp()
Gets the proportional gain.
Definition
p.h:47
control_system::proportional::P::set_param
void set_param(T Kp_, T u_max_)
Sets the controller parameters.
Definition
p.h:17
control_system::proportional::P::get_u_max
T get_u_max()
Gets the maximum controller output.
Definition
p.h:53
control_system::proportional::P::reset
void reset()
Resets the controller.
Definition
p.h:30
control_system::proportional::P::set_Kp
void set_Kp(T Kp_)
Sets the proportional gain.
Definition
p.h:35
p.h
Proportional (P) controller.
saturate
constexpr T saturate(T x, T x_min, T x_max)
Saturates a value within a specified range.
Definition
utility.h:51
src
proportional
p.tpp
Generated by
1.17.0