drbitboy, everything can be calculated. That includes the PID gains. There is no excuse for 100% overshoot or any overshoot if it is not desired.
Are you sure you are controlling the second derivative of the PV? Usually that is very "noisy" due to quantizing error and sample jitter
The second-derivative property is a fundamental characteristic of the OP control scheme; it is not not due to quantization or sampling.
To first order, the pressure in the enclosure is linear with the quantity of air in the enclosure (Ideal Gas Law: PV = nRT); V, R and T are constant (to first order), and n is proportional with volume of Air, so P ~ Air; so pressure (a proxy for quantity) is the "zero-th" derivative.
Each rotation of the fan moves a quantity of air into the modeled enclosure. The speed of the fan is linear with RPM or RPS, so speed is thus linear(-ish) the rate of air moving into the enclosure, so dPressure/dt ~ dAir/dt ~ FanSpeed: first derivative.
The PID (P only; Reverse-(re-)Acting; Ti = Td = 0) executes about once per second (~1001ms, if the free-running clock of my MicroLogix 1100 is to be trusted); each time it executes the 0-100% PID CVs's difference from 50% is assigned as the ramp of the fan speed, and that assigned value of the ramp of the fan speed is scaled by the delta time and that product added (accumulated in) to the fan speed, so PID output ~ ramp value ~ dFanSpeed/dt ~ d2Air/dt2 ~ d2Pressure/dt2, so yes, I am controlling something that is in effect the second derivative of the PV (pressure).
I am modeling the process, so there is no measurement noise or jitter
per se, other than possible issues in the Implicit Euler convergence, which I am not seeing.
There is some non-linearity in the response because as the pressure changes the leak rate changes, so dPressure/dt ~ (FanFlow(Pressure,Speed) - LeakRate(Pressure)) / Volume, but those are all smooth functions and the absolute pressure is modeled as constant, which it is to first order, so the basic behavior is consistent.
So it is an accumulating (integrating) PV being controlled
in effect by an accumulating (Integral-only) control of fan speed, the latter via the P term controlling the fan speed ramp.
It's as if I told someone to turn a car initially going east on a parallel 1minute south of the equator (~ 1 nautical mile) to move to the equator by rotating the steering wheel CCW by the magnitude of their current south latitude (turning left initially) once per 10 minutes (of time), and vice versa after they cross the equator: they would continue turning harder and harder to the left until they hit the equator, at which which point they would be going north and east but still turning left. So they would cross equator and start turning less left to remove the accumulated turning-left "wind up" in the system - they have been only turning the wheel more and more CCW because they were always south of the equator. As long as the car never ends up going directly north, the same thing happens even if the gain value is different i.e. if I twiddle the steering linkage, or change the period of adjustments.
The Integral (Reset; I in PID) of the PID algorithm is for dealing with change in system offset; it cannot be used on its own, i.e. without P, to control a system that is itself integrating.
In the OP's situation, with not the fan speed itself, but with fan speed
ramp as the CV of a PID to control pressure, the P term of the PID effectively becomes an Integral control of fan speed, and there is no Proportional action in the [fan speed vs. pressure] system.
If I reduce the ramp gain*, that reduces the rate at which the system will approach the new setpoint, so the duration of wind up accumulation will be longer, so the wind up will be about the same, and will also be un-wound more slowly, which is probably why I am seeing very little change in overshoot across various gain values.
No amount of math or calculation is going to fix a fundamentally flawed system.
* or increase the update time, which is in effect the same thing as reducing the gain