It's based on the algorithms from Chapter 6 of "Control System Design" by Karl Joahn Åström, 2002.
I need to find some time to actually explain it, but it works basically as in the kOS KSP mod (which unfortunately I only found afterwards).
So, normally you only adjust K, Ti and Td. But there are also some more options, which I haven't really made use of. The default settings, which I found to somewhat work, are also not really the best. So you are invited to find better settings and share them with us.
This implementation uses the time constant notation for Ti and Td. So, if you want to remove the I and D parts from the controller you have to set Ti very large and Td (and N) very low.
Note, that when you change Ti and already have a somewhat large integral part, it might take some time until it adjusts and the new Ti takes effect. This depends on Tt. If this is around 1 or a bit lower it should wind back the integral part pretty fast.
Here are details from the actual implementation in the C# file, which I use and which mostly follows the design by Åström:
float K = 0.2f; // K - proportional gain
float Ti = 11.0f; // Ti - integral time
float Td = 1.0f; // Td - derivative time
float b = 0.1f; // b - additional parameter for set point weighting
float Tt = 1.0f; // Tt - tracking time constant (integrator reset time for anti wind up)
float N = 11.0f;
//Compute controller coefficients
h = Time.fixedDeltaTime;
bi=K*h/Ti; // integral gain
ad=(2*Td-N*h)/(2*Td+N*h);
bd=2*K*N*Td/(2*Td+N*h); //derivative gain
a0=h/Tt;
// compute output
y = processVariable;
ysp = setPoint;
// controller algorithm
P = K*(b*ysp-y); // compute proportional part
D = ad*D-bd*(y-yold); // update derivative part
v = P+I+D; // compute temporary output
if(manipulateVariableMin!=0) output = Mathf.Clamp(v, manipulateVariableMin, manipulateVariableMax);
else output = v;
I = I+bi*(ysp-y)+a0*(output-v); // update integral
I = Mathf.Clamp(I, -1000000, 1000000); // prevent unreasonably large values for I, which can result from extreme parameter settings
yold = y; // update old process output
return output;