Project

General

Profile

Scenarios » History » Version 6

Aleksander Bešir, 18.01.2011 14:15

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