Support for additional NR metrics
[ric-app/mc.git] / mc-core / mc / queries / rrcx_stats.gsql
1 DEFINE{ query_name 'rrcx_stats_serv_beam_cell'; 
2         max_lfta_disorder '1'; max_hfta_disorder '1';
3         comment 'statistics on ssb RSRP on the beams of serving cells, aggregated by gbn_id / 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, gnb_id as GNB_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( (rsrp-157.0)*(rsrp-157.0))  -
18                 sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
19         ) / count(*) as stddev_rsrp,
20         INT(max(rsrp))-INT(157) as max_rsrp
21 from RRCXFER.serv_cell_beam_ssb
22 where  rsrp<128
23 group by timestamp_ms/$window as tb, physCellId, gnb_id
24 ;
25
26 DEFINE{ query_name 'rrcx_stats_serv_beam_gnb'; 
27         max_lfta_disorder '1'; max_hfta_disorder '1';
28         comment 'statistics on ssb RSRP on the beams of serving cells, aggregated by gbn_id / cell ID, computed using rrc transfer';
29 }
30 PARAM{ window uint;}
31 //      rsrp, rsrq, sinr ranges are 0 .. 127
32 //      to convert rsrp to dbm, subtract 157
33
34 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
35         gnb_id as GNB_ID,
36         count(*) as cnt,
37         INT(min(rsrp))-INT(157) as min_rsrp,
38         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
39         INT(median_of(rsrp)) - INT(157) as median_rsrp,
40         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
41         sqrt(
42                 sum( (rsrp-157.0)*(rsrp-157.0))  -
43                 sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
44         ) / count(*) as stddev_rsrp,
45         INT(max(rsrp))-INT(157) as max_rsrp
46 from RRCXFER.serv_cell_beam_ssb
47 where  rsrp<128
48 group by timestamp_ms/$window as tb, gnb_id
49 ;
50
51
52 DEFINE{ query_name 'rrcx_stats_neighbor_beam_cell'; 
53         max_lfta_disorder '1'; max_hfta_disorder '1';
54         comment 'statistics on ssb RSRP on the beams of neighboring cells, aggregated by gbn_id / cell ID, computed using rrc transfer';
55 }
56 PARAM{ window uint;}
57 //      rsrp, rsrq, sinr ranges are 0 .. 127
58 //      to convert rsrp to dbm, subtract 157
59
60 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
61         physCellId as CELL_ID, gnb_id as GNB_ID,
62         count(*) as cnt,
63         INT(min(rsrp))-INT(157) as min_rsrp,
64         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
65         INT(median_of(rsrp)) - INT(157) as median_rsrp,
66         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
67         sqrt(
68                 sum( (rsrp-157.0)*(rsrp-157.0))  -
69                 sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
70         ) / count(*) as stddev_rsrp,
71         INT(max(rsrp))-INT(157) as max_rsrp
72 from RRCXFER.neighbor_beam_ssb
73 where  rsrp<128
74 group by timestamp_ms/$window as tb, physCellId, gnb_id
75 ;
76
77 DEFINE{ query_name 'rrcx_stats_neighbor_beam_gnb'; 
78         max_lfta_disorder '1'; max_hfta_disorder '1';
79         comment 'statistics on ssb RSRP on the beams of nrighboring cells, aggregated by gNB, computed using rrc transfer';
80 }
81 PARAM{ window uint;}
82 //      rsrp, rsrq, sinr ranges are 0 .. 127
83 //      to convert rsrp to dbm, subtract 157
84
85 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
86         gnb_id as GNB_ID,
87         count(*) as cnt,
88         INT(min(rsrp))-INT(157) as min_rsrp,
89         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
90         INT(median_of(rsrp)) - INT(157) as median_rsrp,
91         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
92         sqrt(
93                 sum( (rsrp-157.0)*(rsrp-157.0))  -
94                 sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
95         ) / count(*) as stddev_rsrp,
96         INT(max(rsrp))-INT(157) as max_rsrp
97 from RRCXFER.neighbor_beam_ssb
98 where  rsrp<128
99 group by timestamp_ms/$window as tb, gnb_id
100 ;
101
102
103 DEFINE{ query_name 'rrcx_stats_serv_cell'; 
104         max_lfta_disorder '1'; max_hfta_disorder '1';
105         comment 'statistics on the ssb rsrp of the serving cell, aggregated by gnb_id / cell id, computed using rrc transfer';
106 }
107 PARAM{ window uint;}
108 //      rsrp, rsrq, sinr ranges are 0 .. 127
109 //      to convert rsrp to dbm, subtract 157
110
111 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
112         physCellId as CELL_ID, gnb_id as GNB_ID,
113         count(*) as cnt,
114         INT(min(rsrp))-INT(157) as min_rsrp,
115         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
116         INT(median_of(rsrp)) - INT(157) as median_rsrp,
117         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
118         sqrt(
119                 sum( (rsrp-157.0)*(rsrp-157.0) )  -
120                 sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
121         ) / count(*) as stddev_rsrp,
122         INT(max(rsrp))-INT(157) as max_rsrp
123 from RRCXFER.serv_nr_cell
124 where rsrp<128
125 group by timestamp_ms/$window as tb, physCellId, gnb_id
126 ;
127
128 DEFINE{ query_name 'rrcx_stats_neighbor_cell'; 
129         max_lfta_disorder '1'; max_hfta_disorder '1';
130         comment 'statistics on the ssb rsrp of the neighbor cells, aggregated by gnb_id / cell id, computed using rrc transfer';
131 }
132 PARAM{ window uint;}
133 //      rsrp, rsrq, sinr ranges are 0 .. 127
134 //      to convert rsrp to dbm, subtract 157
135
136 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
137         physCellId as CELL_ID, gnb_id as GNB_ID,
138         count(*) as cnt,
139         INT(min(rsrp))-INT(157) as min_rsrp,
140         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
141         INT(median_of(rsrp)) - INT(157) as median_rsrp,
142         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
143         sqrt(
144                 sum( (rsrp-157.0)*(rsrp-157.0))  -
145                 sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
146         ) / count(*) as stddev_rsrp,
147         INT(max(rsrp))-INT(157) as max_rsrp
148 from RRCXFER.nr_neighbor
149 where  rsrp<128
150 group by timestamp_ms/$window as tb, physCellId, gnb_id
151 ;
152
153
154 DEFINE{ query_name 'rrcx_stats_serv_gnb'; 
155         max_lfta_disorder '1'; max_hfta_disorder '1';
156         comment 'statistics on the ssb srp of the serving cell, aggregated by gNB, computed using rrc transfer';
157 }
158 PARAM{ window uint;}
159 //      rsrp, rsrq, sinr ranges are 0 .. 127
160 //      to convert rsrp to dbm, subtract 157
161
162 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
163         gnb_id as GNB_ID,
164         count(*) as cnt,
165         INT(min(rsrp))-INT(157) as min_rsrp,
166         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
167         INT(median_of(rsrp)) - INT(157) as median_rsrp,
168         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
169         sqrt(
170                 sum( (rsrp-157.0)*(rsrp-157.0))  -
171                 sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
172         ) / count(*) as stddev_rsrp,
173         INT(max(rsrp))-INT(157) as max_rsrp
174 from RRCXFER.serv_nr_cell
175 where  rsrp<128
176 group by timestamp_ms/$window as tb, gnb_id
177 ;
178
179 DEFINE{ query_name 'rrcx_stats_neighbor_gnb'; 
180         max_lfta_disorder '1'; max_hfta_disorder '1';
181         comment 'statistics on the ssb rsrp of the neighbor cells, aggregated by gNB, computed using rrc transfer';
182 }
183 PARAM{ window uint;}
184 //      rsrp, rsrq, sinr ranges are 0 .. 127
185 //      to convert rsrp to dbm, subtract 157
186
187 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
188         gnb_id as GNB_ID,
189         count(*) as cnt,
190         INT(min(rsrp))-INT(157) as min_rsrp,
191         INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
192         INT(median_of(rsrp)) - INT(157) as median_rsrp,
193         INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
194         sqrt(
195                 sum( (rsrp-157.0)*(rsrp-157.0))  -
196                 sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
197         ) / count(*) as stddev_rsrp,
198         INT(max(rsrp))-INT(157) as max_rsrp
199 from RRCXFER.nr_neighbor
200 //where schemaId = 4 and rsrp<128
201 where  rsrp<128
202 group by timestamp_ms/$window as tb, gnb_id
203