Project

General

Profile

Scenarios » History » Version 9

Janez Barbic, 18.01.2011 16:02

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 6 Aleksander Bešir
  <scenario id="scenario_01">
11
    <inDevice id="thermometer_01" />
12
    <outDevice id="air_cond_01" />
13
    <reaction func="linear" />
14
    <check_idle val="600" />
15
    <check_active val="60" />
16 9 Janez Barbic
    <params val="--lazy=true" />
17
    <inDevAalues minval="20" maxval="28" optval="24" tolerance="0.5"/>
18
    <action act="testAction_1"/>
19
    <param par="testParam_1"/>
20 6 Aleksander Bešir
    <conditions>
21
      <and>
22
        <greater inDeviceId="barometer_01" val="80" />
23
        <lower_or_equal inDeviceId="lightSensor" val="50" />
24
        <or>
25 7 Aleksander Bešir
          <greater inDeviceId="time" val="15:00" />
26
          <smaller inDeviceId="time" val="10:00" />
27 6 Aleksander Bešir
        </or>
28
      </and>
29
    </conditions>
30
  </scenario>
31
</scenariotree>
32
</code></pre>
33 2 Janez Barbic
34
Controlled device unique id:
35
<pre><code class="xml">
36
<name nam="Air Conditioner"/>
37
</code></pre>
38
39
Device name, for logging purposes only:
40
<pre><code class="xml"> 
41
<name nam="Air Conditioner"/>
42
</code></pre> 
43
44
Boundaries which define interval which is used by logics. 
45
<pre><code class="xml">
46
<minvalue minval="18"/>
47
<maxvalue maxval="27"/>
48
</code></pre> 
49
50
Optimal value of our interval:
51
<pre><code class="xml">
52
<optimal_value optVal="23"/>
53
</code></pre> 
54
55
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
<pre><code class="xml">
57
<tolerance_value tolVal="0.5"/>
58
</code></pre> 
59
60
Frequency of checks preformed by logics if the controlled device is +idle+ (in seconds):
61
<pre><code class="xml">
62
<idle_check_interval ici="600"/>
63
</code></pre> 
64
65
Frequency of checks preformed by logics if the controlled device is +active+ (in seconds):
66
<pre><code class="xml">
67
<active_check_interval aci="600"/>
68
</code></pre> 
69
70
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
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
73 3 Janez Barbic
Devices (sensors) whose readings influence current controlled device:
74
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
79
Function type used by logic to calculate parameter to send to controlled device.
80
Options are _static (ON/OFF), linear, logarithmic_ ... TBD
81
<pre><code class="xml">
82
<reaction_function fr="linear"/>
83
</code></pre> 
84
85
Location of action program with additional parameters:
86
<pre><code class="xml">
87
<action act="testAction_1"/>
88 1 Janez Barbic
<param par="testParam_1"/>
89
</code></pre> 
90
91
92
93 3 Janez Barbic
Example:
94 1 Janez Barbic
95 3 Janez Barbic
ID: ac_01
96
Name Air Conditioner 
97
Temperatures: 18 - 27
98
Optimal temperature: 23
99
Tolerance: 0.5
100
Idle check interval: 10 min (600s)
101
Active check interval: 1 min (60s)
102
Sensors: thermometer_01
103
Function type: linear
104
Action path: ../turnACon
105
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
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
   Device ac_10 is active, logic checks its sensors after 1 min.
112
3. Current buffer average temperature 22.8 - within tolerance boundaries, logic takes no action.
113
   Device ac_10 is inactive, logic checks its sensors after 10 min.