|
40 | 40 | from __future__ import print_function |
41 | 41 |
|
42 | 42 | from collections import namedtuple, defaultdict |
43 | | -from enum import Enum |
| 43 | +from enum import Enum, IntEnum |
44 | 44 | import functools |
45 | 45 | from functools import partial |
46 | 46 | import logging |
@@ -96,6 +96,26 @@ class DpaType(Enum): |
96 | 96 | OUT_OF_BAND = 2 |
97 | 97 |
|
98 | 98 |
|
| 99 | +# Define int enum for DPA neighbor_distances list indices |
| 100 | +class DpaNeighborhood(IntEnum): |
| 101 | + CATA = 0 |
| 102 | + CATB = 1 |
| 103 | + CATA_OOB = 2 |
| 104 | + CATB_OOB = 3 |
| 105 | + |
| 106 | + |
| 107 | +# Define int enum for updated DPA neighbor_distances list indices |
| 108 | +class DpaNeighborhoodUpdated(IntEnum): |
| 109 | + CATA_INDOOR = 0 |
| 110 | + CATA_INDOOR_6m = 1 |
| 111 | + CATA_OUTDOOR = 2 |
| 112 | + CATA_OUTDOOR_6m = 3 |
| 113 | + CATB = 4 |
| 114 | + CATB_6m = 5 |
| 115 | + CATA_OOB = 6 |
| 116 | + CATB_OOB = 7 |
| 117 | + |
| 118 | + |
99 | 119 | def findDpaType(low_freq, high_freq): |
100 | 120 | """Finds the DPA protection type for a given frequency range. |
101 | 121 |
|
@@ -142,7 +162,7 @@ def findGrantsInsideNeighborhood(grants, constraint, |
142 | 162 | [cata_dist, catb_dist, cata_oob_dist, catb_oob_dist] |
143 | 163 | or |
144 | 164 | [cata_indoor_dist, cata_indoor_6m_dist, cata_outdoor_dist, |
145 | | - cata_outdoor_6m_dist, catb_dist, catb_6m_dist] |
| 165 | + cata_outdoor_6m_dist, catb_dist, catb_6m_dist, cata_oob_dist, catb_oob_dist] |
146 | 166 |
|
147 | 167 | Returns: |
148 | 168 | A tuple of: |
@@ -176,31 +196,37 @@ def findGrantsInsideNeighborhood(grants, constraint, |
176 | 196 | if len(neighbor_distances) == 4: |
177 | 197 | if dpa_type is DpaType.CO_CHANNEL: |
178 | 198 | if grant.cbsd_category == 'A': |
179 | | - neighbor_dist = neighbor_distances[0] |
| 199 | + neighbor_dist = neighbor_distances[DpaNeighborhood.CATA] |
180 | 200 | else: |
181 | | - neighbor_dist = neighbor_distances[1] |
| 201 | + neighbor_dist = neighbor_distances[DpaNeighborhood.CATB] |
182 | 202 | else: |
183 | 203 | if grant.cbsd_category == 'A': |
184 | | - neighbor_dist = neighbor_distances[2] |
| 204 | + neighbor_dist = neighbor_distances[DpaNeighborhood.CATA_OOB] |
185 | 205 | else: |
186 | | - neighbor_dist = neighbor_distances[3] |
187 | | - elif len(neighbor_distances) == 6: |
188 | | - if grant.cbsd_category == 'A': |
189 | | - if grant.indoor_deployment: |
190 | | - if grant.height_agl > 6: |
191 | | - neighbor_dist = neighbor_distances[0] |
| 206 | + neighbor_dist = neighbor_distances[DpaNeighborhood.CATB_OOB] |
| 207 | + elif len(neighbor_distances) == 8: |
| 208 | + if dpa_type is DpaType.OUT_OF_BAND: |
| 209 | + if grant.cbsd_category == 'A': |
| 210 | + neighbor_dist = neighbor_distances[DpaNeighborhoodUpdated.CATA_OOB] |
| 211 | + else: |
| 212 | + neighbor_dist = neighbor_distances[DpaNeighborhoodUpdated.CATB_OOB] |
| 213 | + else: |
| 214 | + if grant.cbsd_category == 'A': |
| 215 | + if grant.indoor_deployment: |
| 216 | + if grant.height_agl > 6: |
| 217 | + neighbor_dist = neighbor_distances[DpaNeighborhoodUpdated.CATA_INDOOR] |
| 218 | + else: |
| 219 | + neighbor_dist = neighbor_distances[DpaNeighborhoodUpdated.CATA_INDOOR_6m] |
192 | 220 | else: |
193 | | - neighbor_dist = neighbor_distances[1] |
| 221 | + if grant.height_agl > 6: |
| 222 | + neighbor_dist = neighbor_distances[DpaNeighborhoodUpdated.CATA_OUTDOOR] |
| 223 | + else: |
| 224 | + neighbor_dist = neighbor_distances[DpaNeighborhoodUpdated.CATA_OUTDOOR_6m] |
194 | 225 | else: |
195 | 226 | if grant.height_agl > 6: |
196 | | - neighbor_dist = neighbor_distances[2] |
| 227 | + neighbor_dist = neighbor_distances[DpaNeighborhoodUpdated.CATB] |
197 | 228 | else: |
198 | | - neighbor_dist = neighbor_distances[3] |
199 | | - else: |
200 | | - if grant.height_agl > 6: |
201 | | - neighbor_dist = neighbor_distances[4] |
202 | | - else: |
203 | | - neighbor_dist = neighbor_distances[5] |
| 229 | + neighbor_dist = neighbor_distances[DpaNeighborhoodUpdated.CATB_6m] |
204 | 230 | else: |
205 | 231 | raise ValueError('Invalid neighborhood distances size') |
206 | 232 | if dist_km > neighbor_dist: |
|
0 commit comments