Here you can find how MSTS is doing it in equations.
Hold right mouse button and choose "Save target as...", or click on image to open it bigger in new window.
Tractive force
Diesel-eletric loco
Eletric loko
Compressor & reservoir pressure
Specimen for CD loco
What about Boyle's law?
This behaviour doesn't correspond to physical laws and compressor characteristics.