/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
    $TITLE = "ADEI";
    $MODULES = array("config", "download", "graph", "wiki");

    $READER_DB_TEST = array (
	"autogen" => array (
	    "title" => _("Slow Generator"),
	    "reader" => "TESTReader",
	    "database" => array("hourly", "minutely")
	),
	"fastgen" => array (
	    "title" => _("Fast Generator"),
	    "reader" => "TESTReader",
	    "database" => array("10hz", "kHz")
	)
    );


    if (is_array($READER_DB)) $READER_DB = array_merge($READER_DB_TEST, $READER_DB);
    else $READER_DB = $READER_DB_TEST;

    function autogen_start_of_month() {
	$cur = time();
	return  $cur - ((date('j', $cur) - 1) * 86400 + $cur % 86400);
    }


    $test_items = array(
	array(
	    "name" => _("Noisy Line"),
	    "func" => '$y=-8',
	    "noise" => 0.5
	),
	array(
	    "name" => _("Cosinus"),
	    "func" => '$y=cos(deg2rad($x/$period))'
	),
	array(
	    "name" => _("Noisy Cosinus"),
	    "func" => '$y=cos(deg2rad($x/$period))',
	    "noise" => 0.1
	),
	array(
	    "name" => _("Sinus"),
	    "func" => '$y=sin(deg2rad($x/$period))'
	),
	array(
	    "name" => _("Wide Sinus"),
	    "func" => '$y=5*sin(deg2rad($x/86400))'
	),
	array(
	    "name" => _("Combined Sinuses"),
	    "func" => '$y=8 + 5*sin(deg2rad($x/86400)) + sin(deg2rad($x/$period))/3'
	),
	array(
	    "name" => _("Fading Sinus"),
	    "func" => '
		$scale = 345600;
		$coef = 90 * $scale;
		$tmp=((($x/$coef)%2)?($x%$coef):($coef-1-$x%$coef))/$coef;
		$sin=(3600*(sin(deg2rad(270 + (($coef + $x)%(2*$coef)/$scale)))));
		$y=(3 + 12*$tmp)*sin(deg2rad($sin))
	    ',
	    'uid' => 'AG1'
	)
/*	,
	array(
	    "name" => _("Test"),
	    "func" => '$y=-8 + 5*sin(deg2rad($x/86400)) + sin(deg2rad($x/$period))/3'
	),*/
    );
    
    $extra_items = array(
	array(
	    "name" => _("Extra Sinus"),
	    "func" => '$y=0.25*sin(deg2rad(($x + $period/4)/$period))'
	),
	array(
	    "name" => _("Extra Cosinus"),
	    "func" => '$y=0.75*cos(deg2rad(($x + $period/4)/$period))'
	)
    );

    $fast_items = array(
	array(
	    "name" => _("Noisy Cosinus"),
	    "func" => '$y=cos(deg2rad($x/300))',
	    "noise" => 0.1
	),
	array(
	    "name" => _("Combined Cosinus"),
	    "func" => '$y=cos(deg2rad($x/300)) +  cos(deg2rad(2*$x))'
	),
	array(
	    "name" => _("Combined Sinus"),
	    "func" => '$y=5*sin(deg2rad($x/300)) + sin(deg2rad($x/$period))/3'
	)
    );



    $OPTIONS = array_merge ($OPTIONS, array(
	"autogen" => array(
	    "optimize_empty_cache" => true,
	    "cache_config" => array (
		array("min" => 315360000, "res" => 432000), /* 10 * year - 12 hour data, 730 points min */
		array("min" => 31536000, "res" => 43200), /* year - 12 hour data, 730 - 7300 data points */
		array("min" => 2592000, "res" => 3600), /* month - 1 hour data, 720 - 8760 data points */
		array("min" => 604800, "res" => 600), /* week - 10 min data, 1008 - 4320 data points */
		array("min" => 86400, "res" => 60), /* day - 1 min data, 1440 - 10080 data points */
		array("min" => 7200, "res" => 10), /* 2 hours - 10 s, 720 - 8640 data points */
		/* 1 - 7200 data points */
	    )
	),
	"autogen__minutely" => array(
	    "date_limit" => "2013-01-01 00:00:00",
	    "period" => 60,		/* seconds, the data generation period */
	    "maximal_allowed_gap" => 300,
	    "min_resolution" => 600
	),
	"autogen__hourly" => array(
	    "date_limit" => "1900-01-01 00:00:00",
	    "period" => 3600,		/* seconds, the data generation period */
	    "maximal_allowed_gap" => 18000,
	    "min_resolution" => 43200
	),
	"autogen__minutely__default" => array(
	    "items" => &$test_items,
	    "name" => _("Default Group"),
	    "axis" => array(
		"/^AG1$/" => "voltage",
		"*" =>"temperature"
	    )
	),
	"autogen__hourly__default" => array(
	    "items" => &$test_items,
	    "name" => _("Default Group"),
	),
	"autogen__minutely__extra" => array(
	    "items" => &$extra_items,
	    "name" => _("Extra Group")
	),
	"fastgen" => array(
	    "optimize_empty_cache" => true,
	    "maximal_allowed_gap" => 300,
	    "min_resolution" => 10,
	    "date_limit" => date("Y-m-d H:i:s", autogen_start_of_month()),
	    "ignore_subseconds" => false
	),
	"fastgen__10hz" => array(
	    "period" => 0.1,		/* seconds, the data generation period */
	    "items" => &$fast_items
	),
	"fastgen__kHz" => array(
	    "period" => 0.001,
	    "items" => &$fast_items,
	    "disable_caching" => true
	),
	"virtual__autogen" => array(
	    "name" => _("Test Virtual Group"),
	    "srctree" => "autogen__minutely__default(1,3),AG1,autogen__minutely__extra,autogen__minutely__extra__0,autogen__minutely__extra__1"
	)
    ));

    $ADEI_TIMINGS = array (
	_("1 Year") => 31536000,
	_("1 Month") => 2592000,
	_("1 Week") => 604800,
	_("1 Day") => 86400,
	_("6 Hours") => 21600,
	_("1 Hour") => 3600,
	_("30 Min") => 1800,
	_("5 Min") => 300,
    );

?>