Temperature measurement and control