Scenarios¶
(XML - values are in attributes just because of some issues with XML parser, should be fixed in future)
Scenarios are defined in xml format in scenarios.xml file.
Example for one device:
<scenariotree>
<scenario id="scenario_01" name="Klima na stropu, w/e">
<inDevice id="thermometer_01" />
<outDevice id="air_cond_01" />
<reaction func="linear" />
<check_idle val="600" />
<check_active val="60" />
<params val="--lazy=true" />
<inDevAalues minval="20" maxval="28" optval="24" tolerance="0.5"/>
<action act="testAction_1"/>
<param par="testParam_1"/>
<conditions>
<and>
<greater inDeviceId="barometer_01" val="80" />
<lower_or_equal inDeviceId="lightSensor" val="50" />
<or>
<greater inDeviceId="time" val="15:00" />
<smaller inDeviceId="time" val="10:00" />
</or>
</and>
</conditions>
</scenario>
</scenariotree>
Controlled device unique id:
<name nam="Air Conditioner"/>
Device name, for logging purposes only:
<name nam="Air Conditioner"/>
Boundaries which define interval which is used by logics.
<minvalue minval="18"/>
<maxvalue maxval="27"/>
Optimal value of our interval:
<optimal_value optVal="23"/>
Tolerance of optimal value, on both sides (+-). No action should be taken within these boundaries. Tolerance value should not exceed min or max value of interval.
<tolerance_value tolVal="0.5"/>
Frequency of checks preformed by logics if the controlled device is idle (in seconds):
<idle_check_interval ici="600"/>
Frequency of checks preformed by logics if the controlled device is active (in seconds):
<active_check_interval aci="600"/>
Note that some devices have the same value on idle and active status. Typically these are devices, which aren't expected to be active all the time, for example an office computer. It gets turned off or turned only a few times per day.
On the other hand there are some devices which should be checked more frequently if logic took action. For example, window blinds should get more attention during sunrise/sunset or weather changes.
Devices (sensors) whose readings influence current controlled device:
Caution, these devices (sensors) should always be defined in devices.xml!
<sensors chk_dev1="thermometer_01" chk_dev2="dummydevice_01"/>
Function type used by logic to calculate parameter to send to controlled device.
Options are static (ON/OFF), linear, logarithmic ... TBD
<reaction_function fr="linear"/>
Location of action program with additional parameters:
<action act="testAction_1"/>
<param par="testParam_1"/>
Example:
ID: ac_01
Name Air Conditioner
Temperatures: 18 - 27
Optimal temperature: 23
Tolerance: 0.5
Idle check interval: 10 min (600s)
Active check interval: 1 min (60s)
Sensors: thermometer_01
Function type: linear
Action path: ../turnACon
Parameters: none
1. Current buffer average temperature 23.3 - within tolerance boundaries, logic takes no action.
2. In the next 10 minutes, buffer average temperature rises to 25.
Function is linear, logic calculates linear increase in power: 1-(27-23)/(26-23) = 0.75 (75%); power = 1-(maxT - optimalT)/(currT-optimalT)
Logic executes action turnACon with parameter -75
Device ac_10 is active, logic checks its sensors after 1 min.
3. Current buffer average temperature 22.8 - within tolerance boundaries, logic takes no action.
Device ac_10 is inactive, logic checks its sensors after 10 min.
Updated by Janez Barbic almost 14 years ago ยท 11 revisions