Adding MC-NIB support
[ric-app/mc.git] / mc-core / mc / queries / rrcx_stats.gsql
1 DEFINE{ query_name 'rrcx_stats_neigh_cell'; 
2         max_lfta_disorder '1'; max_hfta_disorder '1';
3         comment 'statistics on ssb RSRP on the beams of nrighboring cells, aggregated by cell ID, computed using rrc transfer';
4 }
5 PARAM{ window uint;}
6 //      rsrp, rsrq, sinr ranges are 0 .. 127
7 //      to convert rsrp to dbm, subtract 157
8
9 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
10         physCellId as CELL_ID,
11         count(*) as cnt,
12         INT(min(rsrp))-INT(157) as min_rsrp,
13         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
14         INT(median_of(rsrp)) - INT(157) as median_rsrp,
15         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
16         sqrt(
17                 sum( (FLOAT(rsrp)-157)*(FLOAT(rsrp)-157))  -
18                 sum( (FLOAT(rsrp)-157) )*sum( (FLOAT(rsrp)-157) )/count(*)
19         ) / count(*) as stddev_rsrp,
20         INT(max(rsrp))-INT(157) as max_rsrp
21 from RRCXFER.neighbor_beam_ssb
22 //where schemaId = 6 and rsrp<128
23 where  rsrp<128
24 group by timestamp_ms/$window as tb, physCellId
25 ;
26
27 DEFINE{ query_name 'rrcx_stats_neigh_gnb'; 
28         max_lfta_disorder '1'; max_hfta_disorder '1';
29         comment 'statistics on ssb RSRP on the beams of nrighboring cells, aggregated by gNB, computed using rrc transfer';
30 }
31 PARAM{ window uint;}
32 //      rsrp, rsrq, sinr ranges are 0 .. 127
33 //      to convert rsrp to dbm, subtract 157
34
35 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
36         gnb_id as GNB_ID,
37         count(*) as cnt,
38         INT(min(rsrp))-INT(157) as min_rsrp,
39         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
40         INT(median_of(rsrp)) - INT(157) as median_rsrp,
41         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
42         sqrt(
43                 sum( (FLOAT(rsrp)-157)*(FLOAT(rsrp)-157))  -
44                 sum( (FLOAT(rsrp)-157) )*sum( (FLOAT(rsrp)-157) )/count(*)
45         ) / count(*) as stddev_rsrp,
46         INT(max(rsrp))-INT(157) as max_rsrp
47 from RRCXFER.neighbor_beam_ssb
48 where  rsrp<128
49 //where schemaId = 6 and rsrp<128
50 group by timestamp_ms/$window as tb, gnb_id
51 ;
52
53
54 DEFINE{ query_name 'rrcx_stats_serv_cell'; 
55         max_lfta_disorder '1'; max_hfta_disorder '1';
56         comment 'statistics on the ssb rsrp of the serving cell, aggregated by cell id, computed using rrc transfer';
57 }
58 PARAM{ window uint;}
59 //      rsrp, rsrq, sinr ranges are 0 .. 127
60 //      to convert rsrp to dbm, subtract 157
61
62 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
63         physCellId as CELL_ID,
64         count(*) as cnt,
65         INT(min(rsrp))-INT(157) as min_rsrp,
66         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
67         INT(median_of(rsrp)) - INT(157) as median_rsrp,
68         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
69         sqrt(
70                 sum( (FLOAT(rsrp)-157)*(FLOAT(rsrp)-157))  -
71                 sum( (FLOAT(rsrp)-157) )*sum( (FLOAT(rsrp)-157) )/count(*)
72         ) / count(*) as stddev_rsrp,
73         INT(max(rsrp))-INT(157) as max_rsrp
74 from RRCXFER.serv_nr_cell
75 where rsrp<128
76 //where schemaId = 1 and rsrp<128
77 group by timestamp_ms/$window as tb, physCellId
78 ;
79
80 DEFINE{ query_name 'rrcx_stats_neighbor_cell'; 
81         max_lfta_disorder '1'; max_hfta_disorder '1';
82         comment 'statistics on the ssb rsrp of the neighbor cells, aggregated by cell id, computed using rrc transfer';
83 }
84 PARAM{ window uint;}
85 //      rsrp, rsrq, sinr ranges are 0 .. 127
86 //      to convert rsrp to dbm, subtract 157
87
88 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
89         physCellId as CELL_ID,
90         count(*) as cnt,
91         INT(min(rsrp))-INT(157) as min_rsrp,
92         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
93         INT(median_of(rsrp)) - INT(157) as median_rsrp,
94         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
95         sqrt(
96                 sum( (FLOAT(rsrp)-157)*(FLOAT(rsrp)-157))  -
97                 sum( (FLOAT(rsrp)-157) )*sum( (FLOAT(rsrp)-157) )/count(*)
98         ) / count(*) as stddev_rsrp,
99         INT(max(rsrp))-INT(157) as max_rsrp
100 from RRCXFER.nr_neighbor
101 //where schemaId = 4 and rsrp<128
102 where  rsrp<128
103 group by timestamp_ms/$window as tb, physCellId
104 ;
105
106
107 DEFINE{ query_name 'rrcx_stats_serv_gnb'; 
108         max_lfta_disorder '1'; max_hfta_disorder '1';
109         comment 'statistics on the ssb srp of the serving cell, aggregated by gNB, computed using rrc transfer';
110 }
111 PARAM{ window uint;}
112 //      rsrp, rsrq, sinr ranges are 0 .. 127
113 //      to convert rsrp to dbm, subtract 157
114
115 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
116         gnb_id as GNB_ID,
117         count(*) as cnt,
118         INT(min(rsrp))-INT(157) as min_rsrp,
119         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
120         INT(median_of(rsrp)) - INT(157) as median_rsrp,
121         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
122         sqrt(
123                 sum( (FLOAT(rsrp)-157)*(FLOAT(rsrp)-157))  -
124                 sum( (FLOAT(rsrp)-157) )*sum( (FLOAT(rsrp)-157) )/count(*)
125         ) / count(*) as stddev_rsrp,
126         INT(max(rsrp))-INT(157) as max_rsrp
127 from RRCXFER.serv_nr_cell
128 //where schemaId = 1 and rsrp<128
129 where  rsrp<128
130 group by timestamp_ms/$window as tb, gnb_id
131 ;
132
133 DEFINE{ query_name 'rrcx_stats_neighbor_gnb'; 
134         max_lfta_disorder '1'; max_hfta_disorder '1';
135         comment 'statistics on the ssb rsrp of the neighbor cells, aggregated by gNB, computed using rrc transfer';
136 }
137 PARAM{ window uint;}
138 //      rsrp, rsrq, sinr ranges are 0 .. 127
139 //      to convert rsrp to dbm, subtract 157
140
141 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
142         gnb_id as GNB_ID,
143         count(*) as cnt,
144         INT(min(rsrp))-INT(157) as min_rsrp,
145         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
146         INT(median_of(rsrp)) - INT(157) as median_rsrp,
147         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
148         sqrt(
149                 sum( (FLOAT(rsrp)-157)*(FLOAT(rsrp)-157))  -
150                 sum( (FLOAT(rsrp)-157) )*sum( (FLOAT(rsrp)-157) )/count(*)
151         ) / count(*) as stddev_rsrp,
152         INT(max(rsrp))-INT(157) as max_rsrp
153 from RRCXFER.nr_neighbor
154 //where schemaId = 4 and rsrp<128
155 where  rsrp<128
156 group by timestamp_ms/$window as tb, gnb_id
157