forked from buddhabrot/fusion-zauberstab
18 lines
319 B
C++
18 lines
319 B
C++
#pragma once
|
|
|
|
template<class T>
|
|
struct Pt1 {
|
|
T y_n1;
|
|
T K;
|
|
T T1;
|
|
|
|
/* PT1: y = y_(n-1) + (Ku - y_(n-1)) * dt/T1 */
|
|
Pt1(T K, T T1) : T1(T1), K(K) {};
|
|
|
|
T update(T u, T dt)
|
|
{
|
|
T y = this->y_n1 + (this->K * u - this->y_n1) * dt / this->T1;
|
|
this->y_n1 = y;
|
|
return y;
|
|
}
|
|
}; |