I have a weird problem with my old 3D printer, it is a Prusa/Mendel type. When I print a 20 mm cube, X and Y are correct, Z is resulting 16 to 17 mm. I have cheched the correctness of the movement on Z using the manual controls and there are no issues.
I played a bit with the layer tickness, I have a 0,4 mm nozzle, setting it to 0,12 (normally is on 0,16) but no changes in the result. I am printing PLA on a cold bed at 180 Degres C without any other particular defect.
I would appreciate some direction on how to solve such problem.
You should check that the steps per mm for your Z-axis are set correctly. This depends on the pitch of the leadscrews/threaded rods driving the axis and parameters of your steppers (microstepping and raw steps/revolution). This Calculator.
Make sure that your layer height is a multiple of a full step of the Z-stepper. The Z-stepper may be disabled intermittently, and when re-enabled it may "snap" to the nearest full step position. If your layer height requires microstepping, you may notice it getting rounded down or up due to this.
For instance, if a full step were 0.08mm, then 0.16mm layers would require 2 full steps, printing fine. 0.12mm layers would require 1 full step and a half microstep. Due to rounding, some layers might be reduced to 0,08mm instead. This might account for the height discrepancy you're seeing (though 0.08mm is quite a high, unrealistic amount for a full-step).