Scenarios » History » Version 9
Janez Barbic, 18.01.2011 16:02
1 | 1 | Janez Barbic | h1. Scenarios |
---|---|---|---|
2 | 1 | Janez Barbic | |
3 | 5 | Janez Barbic | (XML - values are in attributes just because of some issues with XML parser, should be fixed in future) |
4 | 5 | Janez Barbic | |
5 | 2 | Janez Barbic | Scenarios are defined in xml format in scenarios.xml file. |
6 | 2 | Janez Barbic | |
7 | 2 | Janez Barbic | Example for one device: |
8 | 2 | Janez Barbic | <pre><code class="xml"> |
9 | 2 | Janez Barbic | <scenariotree> |
10 | 6 | Aleksander Bešir | <scenario id="scenario_01"> |
11 | 6 | Aleksander Bešir | <inDevice id="thermometer_01" /> |
12 | 6 | Aleksander Bešir | <outDevice id="air_cond_01" /> |
13 | 6 | Aleksander Bešir | <reaction func="linear" /> |
14 | 6 | Aleksander Bešir | <check_idle val="600" /> |
15 | 6 | Aleksander Bešir | <check_active val="60" /> |
16 | 9 | Janez Barbic | <params val="--lazy=true" /> |
17 | 9 | Janez Barbic | <inDevAalues minval="20" maxval="28" optval="24" tolerance="0.5"/> |
18 | 9 | Janez Barbic | <action act="testAction_1"/> |
19 | 9 | Janez Barbic | <param par="testParam_1"/> |
20 | 6 | Aleksander Bešir | <conditions> |
21 | 6 | Aleksander Bešir | <and> |
22 | 6 | Aleksander Bešir | <greater inDeviceId="barometer_01" val="80" /> |
23 | 6 | Aleksander Bešir | <lower_or_equal inDeviceId="lightSensor" val="50" /> |
24 | 6 | Aleksander Bešir | <or> |
25 | 7 | Aleksander Bešir | <greater inDeviceId="time" val="15:00" /> |
26 | 7 | Aleksander Bešir | <smaller inDeviceId="time" val="10:00" /> |
27 | 6 | Aleksander Bešir | </or> |
28 | 6 | Aleksander Bešir | </and> |
29 | 6 | Aleksander Bešir | </conditions> |
30 | 6 | Aleksander Bešir | </scenario> |
31 | 6 | Aleksander Bešir | </scenariotree> |
32 | 6 | Aleksander Bešir | </code></pre> |
33 | 2 | Janez Barbic | |
34 | 2 | Janez Barbic | Controlled device unique id: |
35 | 2 | Janez Barbic | <pre><code class="xml"> |
36 | 2 | Janez Barbic | <name nam="Air Conditioner"/> |
37 | 2 | Janez Barbic | </code></pre> |
38 | 2 | Janez Barbic | |
39 | 2 | Janez Barbic | Device name, for logging purposes only: |
40 | 2 | Janez Barbic | <pre><code class="xml"> |
41 | 2 | Janez Barbic | <name nam="Air Conditioner"/> |
42 | 2 | Janez Barbic | </code></pre> |
43 | 2 | Janez Barbic | |
44 | 2 | Janez Barbic | Boundaries which define interval which is used by logics. |
45 | 2 | Janez Barbic | <pre><code class="xml"> |
46 | 2 | Janez Barbic | <minvalue minval="18"/> |
47 | 2 | Janez Barbic | <maxvalue maxval="27"/> |
48 | 2 | Janez Barbic | </code></pre> |
49 | 2 | Janez Barbic | |
50 | 2 | Janez Barbic | Optimal value of our interval: |
51 | 2 | Janez Barbic | <pre><code class="xml"> |
52 | 2 | Janez Barbic | <optimal_value optVal="23"/> |
53 | 2 | Janez Barbic | </code></pre> |
54 | 2 | Janez Barbic | |
55 | 2 | Janez Barbic | 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. |
56 | 2 | Janez Barbic | <pre><code class="xml"> |
57 | 2 | Janez Barbic | <tolerance_value tolVal="0.5"/> |
58 | 2 | Janez Barbic | </code></pre> |
59 | 2 | Janez Barbic | |
60 | 2 | Janez Barbic | Frequency of checks preformed by logics if the controlled device is +idle+ (in seconds): |
61 | 2 | Janez Barbic | <pre><code class="xml"> |
62 | 2 | Janez Barbic | <idle_check_interval ici="600"/> |
63 | 2 | Janez Barbic | </code></pre> |
64 | 2 | Janez Barbic | |
65 | 2 | Janez Barbic | Frequency of checks preformed by logics if the controlled device is +active+ (in seconds): |
66 | 2 | Janez Barbic | <pre><code class="xml"> |
67 | 2 | Janez Barbic | <active_check_interval aci="600"/> |
68 | 2 | Janez Barbic | </code></pre> |
69 | 2 | Janez Barbic | |
70 | 2 | Janez Barbic | 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. |
71 | 2 | Janez Barbic | 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. |
72 | 2 | Janez Barbic | |
73 | 3 | Janez Barbic | Devices (sensors) whose readings influence current controlled device: |
74 | 3 | Janez Barbic | Caution, these devices (sensors) should +always+ be defined in +devices.xml+! |
75 | 2 | Janez Barbic | <pre><code class="xml"> |
76 | 3 | Janez Barbic | <sensors chk_dev1="thermometer_01" chk_dev2="dummydevice_01"/> |
77 | 2 | Janez Barbic | </code></pre> |
78 | 2 | Janez Barbic | |
79 | 2 | Janez Barbic | Function type used by logic to calculate parameter to send to controlled device. |
80 | 2 | Janez Barbic | Options are _static (ON/OFF), linear, logarithmic_ ... TBD |
81 | 2 | Janez Barbic | <pre><code class="xml"> |
82 | 2 | Janez Barbic | <reaction_function fr="linear"/> |
83 | 2 | Janez Barbic | </code></pre> |
84 | 2 | Janez Barbic | |
85 | 2 | Janez Barbic | Location of action program with additional parameters: |
86 | 2 | Janez Barbic | <pre><code class="xml"> |
87 | 2 | Janez Barbic | <action act="testAction_1"/> |
88 | 1 | Janez Barbic | <param par="testParam_1"/> |
89 | 1 | Janez Barbic | </code></pre> |
90 | 1 | Janez Barbic | |
91 | 1 | Janez Barbic | |
92 | 1 | Janez Barbic | |
93 | 3 | Janez Barbic | Example: |
94 | 1 | Janez Barbic | |
95 | 3 | Janez Barbic | ID: ac_01 |
96 | 3 | Janez Barbic | Name Air Conditioner |
97 | 3 | Janez Barbic | Temperatures: 18 - 27 |
98 | 3 | Janez Barbic | Optimal temperature: 23 |
99 | 3 | Janez Barbic | Tolerance: 0.5 |
100 | 3 | Janez Barbic | Idle check interval: 10 min (600s) |
101 | 3 | Janez Barbic | Active check interval: 1 min (60s) |
102 | 3 | Janez Barbic | Sensors: thermometer_01 |
103 | 3 | Janez Barbic | Function type: linear |
104 | 3 | Janez Barbic | Action path: ../turnACon |
105 | 3 | Janez Barbic | Parameters: none |
106 | 1 | Janez Barbic | |
107 | 3 | Janez Barbic | 1. Current buffer average temperature 23.3 - within tolerance boundaries, logic takes no action. |
108 | 3 | Janez Barbic | 2. In the next 10 minutes, buffer average temperature rises to 25. |
109 | 4 | Janez Barbic | Function is linear, logic calculates linear increase in power: 1-(27-23)/(26-23) = 0.75 (75%); power = 1-(maxT - optimalT)/(currT-optimalT) |
110 | 3 | Janez Barbic | Logic executes action turnACon with parameter -75 |
111 | 3 | Janez Barbic | Device ac_10 is active, logic checks its sensors after 1 min. |
112 | 3 | Janez Barbic | 3. Current buffer average temperature 22.8 - within tolerance boundaries, logic takes no action. |
113 | 3 | Janez Barbic | Device ac_10 is inactive, logic checks its sensors after 10 min. |