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