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