Everywhere I look, be it a PID, lead, lag control or anything else, there are Simulink schematics with transfer functions. This is all nice for system response simulation, however currently I have to implement a PID control with a filtered derivative term into a strictly certified medical device, which is controlled by a microchip with a C++ code controlling it.
Now, if we take the PID controller in its frequency domain as
$$C(s) = k_\mathrm{P} + \frac{k_\mathrm{I}}{s} + k_\mathrm{D}s = \frac{y(s)}{e(s)},$$
we can implement that as
$$y(t) = k_\mathrm{P}e(t) + k_\mathrm{I}\int_{0}^{t}e(\tau)d\tau + k_\mathrm{D}\dot{e}(t), \quad e(0) = 0,$$
which we can write into pseudo code as
integral += error*dt
derivative = (error - prevError) / dt
y = kp*error + ki*integral + kd*derivative
prevError = error
However, now we take the filtered PID control as
$$C(s) = k_\mathrm{P} + \frac{k_\mathrm{I}}{s} + k_\mathrm{D}\frac{sN}{s + N}$$
The best I can think of is to create inverse Laplace as
$$y(t) = k_\mathrm{P}e(t) + k_\mathrm{I}\int_{0}^{t}e(\tau)d\tau + k_\mathrm{D}\left( N\delta(t) - N^2e^{-Nt} \right)e(t), \quad e(0) = 0,$$
but what does that really represent? Integrating via $dt$ is one thing, but all I can see in the $e^{-Nt}$ is the fact that after few seconds, no matter what I do, I am going to have just another proportional constant. Should I reset the time at some point? And we haven't even written that into C++ yet.
What is the correct approach?