Method and system for controlling a freeze drying process