thermocouple logic