This article provides two methods for defining a thermostat based on a temperature difference between two elements.
Using a Thermostat modeling object
Using a thermal load
The second method, however, does not provide the data that a thermostat function provides, such as actuations or average power.