By default all profiles are evaluated in metric units. IP can be used by explicitly setting the ‘units’ class attribute of the profile.
The following modulating profile demonstrates how unit sets are specified as part the profile class definition.
The class attribute ‘units’ is set to IP on line 8, therefore, all quantities accessed via the profile context item will return values in IP units. In this case, context.ta will represent a temperature value in Fahrenheit.
1.import apache
2.
3.class ThermostatControl(apache.Profile):
4.
5."""
6. All instances of the profile will use IP units
7. """
8. units = apache.IP
9.
10.def evaluate(self):
11.# if room temperature is greater than 72 F turn heating off
12.if self.context.ta > 72:
13.return False
14.else
15.return True
For absolute profiles, the return value must also respect the unit set specified in the profile class