For profiles not associated with either a surface or a room, the default context will provide access to model level variables. These return outside air conditions.
The model item can be accessed from any context item.
Variable
Description
Metric unit
IP unit
context.model.ta
outside air temperature
°C
°F
context.model.twb
outside wet bulb temperature
°C
°F
context.model.rh
outside relative humidity
%
%
The model variable also provides the function “get_space(<id>)”. This function will return the space entity associated with the given 8 character id. The space entity can then be interrogated to access the room data associated with that space in the model.
The use of this function is shown below, on line 11, the model object is used to obtain the space with id “FF000001”. On line 15 the illuminance of the space is used to defined the return value of the profile.
1.import apache
2.
3.
4.class LightingControl(apache.Profile):
5.
6.
7.def evaluate(self):
8.
9.# get space containing the sensor
10.#
11. space = self.context.model.get_space("FF000001")
12.
13.# trigger lights on if illumanance falls below threshold