Scenarios » History » Revision 7
Revision 6 (Aleksander Bešir, 18.01.2011 14:15) → Revision 7/11 (Aleksander Bešir, 18.01.2011 14:15)
h1. 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: <pre><code class="xml"> <scenariotree> <scenario id="ac_01"> <name nam="Air Conditioner"/> <minvalue minval="18"/> <maxvalue maxval="27"/> <optimal_value optVal="23"/> <tolerance_value tolVal="0.5"/> <idle_check_interval ici="600"/> <active_check_interval aci="60"/> <sensors chk_dev1="thermometer_01"/> ...additional options, waiting for your input :) <reaction_function fr="linear"/> <action act="testAction_1"/> <param par="testParam_1"/> </scenario> </scenariotree> </code></pre> Version 2: <pre><code class="xml"> <scenariotree> <scenario id="scenario_01"> <inDevice id="thermometer_01" /> <outDevice id="air_cond_01" /> <minvalue val="20" /> <maxvalue val="35" /> <optvalue val="28" /> <tolerance val="0.5" /> <check_idle val="600" /> <check_active val="60" /> <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> </code></pre> Controlled device unique id: <pre><code class="xml"> <name nam="Air Conditioner"/> </code></pre> Device name, for logging purposes only: <pre><code class="xml"> <name nam="Air Conditioner"/> </code></pre> Boundaries which define interval which is used by logics. <pre><code class="xml"> <minvalue minval="18"/> <maxvalue maxval="27"/> </code></pre> Optimal value of our interval: <pre><code class="xml"> <optimal_value optVal="23"/> </code></pre> 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. <pre><code class="xml"> <tolerance_value tolVal="0.5"/> </code></pre> Frequency of checks preformed by logics if the controlled device is +idle+ (in seconds): <pre><code class="xml"> <idle_check_interval ici="600"/> </code></pre> Frequency of checks preformed by logics if the controlled device is +active+ (in seconds): <pre><code class="xml"> <active_check_interval aci="600"/> </code></pre> 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+! <pre><code class="xml"> <sensors chk_dev1="thermometer_01" chk_dev2="dummydevice_01"/> </code></pre> Function type used by logic to calculate parameter to send to controlled device. Options are _static (ON/OFF), linear, logarithmic_ ... TBD <pre><code class="xml"> <reaction_function fr="linear"/> </code></pre> Location of action program with additional parameters: <pre><code class="xml"> <action act="testAction_1"/> <param par="testParam_1"/> </code></pre> 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.