Project

General

Profile

Scenarios » History » Version 10

Janez Barbic, 18.01.2011 16:03

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