network: ORanNetwork = generator.generate()
viewer: NetworkViewer = NetworkViewer(network)
- output_folder: str = configuration["output-folder"]
+ output_folder: str = configuration["outputFolder"]
# If folder doesn't exist, then create it.
if not os.path.isdir(output_folder):
os.makedirs(output_folder)
- name: str = configuration["network"]["name"]
+ name: str = str(configuration["network"]["name"]).lower()
filename: str = ""
# topology json
- if configuration["generation-tasks"]["topology"] is True:
+ if configuration["generationTasks"]["topology"] is True:
filename = output_folder + "/" + name + "-operational.json"
viewer.json().save(filename)
# svg xml
- if configuration["generation-tasks"]["svg"] is True:
+ if configuration["generationTasks"]["svg"] is True:
filename = output_folder + "/" + name + ".svg"
viewer.svg(filename)
# kml xml
- if configuration["generation-tasks"]["kml"] is True:
+ if configuration["generationTasks"]["kml"] is True:
filename = output_folder + "/" + name + ".kml"
viewer.kml(filename)
def termination_points(self) -> list[ORanTerminationPoint]:
result: list[ORanTerminationPoint] = super().termination_points()
- result.append(ORanTerminationPoint({"id": self.name, "name": self.name}))
+ result.append(ORanTerminationPoint(
+ {"id": self.name, "name": self.name}
+ ))
return result
def to_topology_nodes(self) -> list[dict[str, Any]]:
linear_ring: ET.Element = ET.SubElement(outer_boundary, "LinearRing")
coordinates: ET.Element = ET.SubElement(linear_ring, "coordinates")
- points: list[Point] = Hexagon.polygon_corners(self.layout, self.position)
+ points: list[Point] = Hexagon.polygon_corners(
+ self.layout, self.position
+ )
method = (
- self.parent.parent.parent.parent.parent.parent.geo_location.point_to_geo_location
+ self.parent.parent.parent.parent.parent.parent
+ .geo_location.point_to_geo_location
)
geo_locations: list[GeoLocation] = list(map(method, points))
text: list[str] = []
self.parent.parent.parent.parent.parent.parent.geo_location
)
+ p1: int = (2 * index + 1) % 6
+ p2: int = (2 * index + 2) % 6
intersect1: Point = Point(
- (points[(2 * index + 1) % 6].x + points[(2 * index + 2) % 6].x) / 2,
- (points[(2 * index + 1) % 6].y + points[(2 * index + 2) % 6].y) / 2,
+ (points[p1].x + points[p2].x) / 2,
+ (points[p1].y + points[p2].y) / 2,
)
- intersect_geo_location1: GeoLocation = network_center.point_to_geo_location(
+ intersect_gl1: GeoLocation = network_center.point_to_geo_location(
intersect1
)
+ p3: int = (2 * index + 3) % 6
+ p4: int = (2 * index + 4) % 6
intersect2: Point = Point(
- (points[(2 * index + 3) % 6].x + points[(2 * index + 4) % 6].x) / 2,
- (points[(2 * index + 3) % 6].y + points[(2 * index + 4) % 6].y) / 2,
+ (points[p3].x + points[p4].x) / 2,
+ (points[p3].y + points[p4].y) / 2,
)
- intersect_geo_location2: GeoLocation = network_center.point_to_geo_location(
+ intersect_gl2: GeoLocation = network_center.point_to_geo_location(
intersect2
)
cell_polygon: list[GeoLocation] = []
cell_polygon.append(tower)
- cell_polygon.append(intersect_geo_location1)
+ cell_polygon.append(intersect_gl1)
cell_polygon.append(geo_locations[(2 * index + 2) % 6])
cell_polygon.append(geo_locations[(2 * index + 3) % 6])
- cell_polygon.append(intersect_geo_location2)
+ cell_polygon.append(intersect_gl2)
# close polygon
cell_polygon.append(tower)
coordinates.text = " ".join(text)
if self.cell_scale_factor > 0:
- scaled_polygon: ET.Element = ET.SubElement(multi_geometry, "Polygon")
- scaled_outer_boundary: ET.Element = ET.SubElement(scaled_polygon, "outerBoundaryIs")
- scaled_linear_ring: ET.Element = ET.SubElement(scaled_outer_boundary, "LinearRing")
- scaled_coordinates: ET.Element = ET.SubElement(scaled_linear_ring, "coordinates")
+ scaled_polygon: ET.Element = ET.SubElement(
+ multi_geometry, "Polygon")
+ scaled_outer_boundary: ET.Element = ET.SubElement(
+ scaled_polygon, "outerBoundaryIs")
+ scaled_linear_ring: ET.Element = ET.SubElement(
+ scaled_outer_boundary, "LinearRing")
+ scaled_coordinates: ET.Element = ET.SubElement(
+ scaled_linear_ring, "coordinates")
arc: float = self.azimuth * math.pi / 180
- meterToDegree: float = 2 * math.pi * GeoLocation().equatorialRadius / 360
- translateX: float = (
- self.layout.size.x
- * (self.cell_scale_factor / 100)
- * math.sin(arc)
- )
- translateY: float = (
- self.layout.size.y
- * (self.cell_scale_factor / 100)
- * math.cos(arc)
+ meterToDegree: float = (
+ 2 * math.pi * GeoLocation().equatorialRadius / 360
)
centerX: float = self.layout.size.x * 0.5 * math.sin(arc)
centerY: float = self.layout.size.y * 0.5 * math.cos(arc)
- cell_center : GeoLocation = GeoLocation(
+ cell_center: GeoLocation = GeoLocation(
{
"latitude": tower.latitude + centerY / meterToDegree,
"longitude": tower.longitude + centerX / meterToDegree,
text = []
for gl in cell_polygon:
scale: float = 1 + self.cell_scale_factor / 100
- lng_new: float = ( 1 * scale * (gl.longitude - cell_center.longitude) ) + cell_center.longitude
- lat_new: float = ( 1 * scale * ( gl.latitude - cell_center.latitude ) ) + cell_center.latitude
+ lng_new: float = (
+ 1 * scale * (gl.longitude - cell_center.longitude)
+ ) + cell_center.longitude
+ lat_new: float = (
+ 1 * scale * (gl.latitude - cell_center.latitude)
+ ) + cell_center.latitude
scaled_strs: list[str] = [
str("%.6f" % float(lng_new)),
str("%.6f" % float(lat_new)),
)
size: int = int(
- int(configuration["pattern"]["nr-cell-du"]["maxReach"])
+ int(configuration["pattern"]["nrCellDu"]["maxReach"])
/ (
1
+ int(
- configuration["pattern"]["nr-cell-du"][
+ configuration["pattern"]["nrCellDu"][
"cellScaleFactorForHandoverArea"
]
)
{
"oRanSmoSpiralRadiusOfNearRtRics": configuration["pattern"][
"smo"
- ]["near-rt-ric-spiral-radius"],
+ ]["nearRtRicSpiralRadius"],
"oRanNearRtRicSpiralRadiusOfOCus": configuration["pattern"][
- "near-rt-ric"
- ]["o-ran-cu-spiral-radius"],
+ "nearRtRic"
+ ]["oRanCuSpiralRadius"],
"oRanCuSpiralRadiusOfODus": configuration["pattern"][
- "o-ran-cu"
- ]["o-ran-du-spiral-radius"],
+ "oRanCu"
+ ]["oRanDuSpiralRadius"],
"oRanDuSpiralRadiusOfTowers": configuration["pattern"][
- "o-ran-du"
- ]["tower-spiral-radius"],
+ "oRanDu"
+ ]["towerSpiralRadius"],
}
)
self._o_ran_smo = ORanSmo(
result: list[NrCellDu] = []
cell_config: dict = (
self.parent.parent.parent.parent.parent.parent
- .configuration["pattern"]["nr-cell-du"]
+ .configuration["pattern"]["nrCellDu"]
)
- cell_angle: int = cell_config["cell-angle"]
+ cell_angle: int = cell_config["cellAngle"]
cell_scale_factor: int = (
cell_config["cellScaleFactorForHandoverArea"]
)
def to_topology(self) -> dict[str, Any]:
result: dict[str, Any] = {"tp-id": self.name}
- # TODO
- # if self.supporter:
- # network_ref: str = ""
- # match self.parent.__qualname__:
- # case ORanSmo.__qualname__:
- # network_ref = self.parent.parent.id
- # case "<class 'model.python.o_ran_smo.ORanSmo'>":
- # network_ref = self.parent.parent.id
- # case "<class 'model.python.o_ran_near_rt_ric.ORanNearRtRic'>":
- # network_ref = self.parent.parent.parent.id
- # case "<class 'model.python.o_ran_cu.ORanCu'>":
- # network_ref = self.parent.parent.parent.parent.id
- # case "<class 'model.python.o_ran_du.ORanDu'>":
- # network_ref = self.parent.parent.parent.parent.parent.id
- # case "<class 'model.python.o_ran_cloud_du.ORanCloudDu'>":
- # network_ref = self.parent.parent.parent.parent.parent.id
- # case "<class 'model.python.o_ran_ru.ORanRu'>":
- # network_ref = (
- # self.parent.parent.parent.parent.parent.parent.id
- # )
- # case _:
- # print("unknown: implement " + str(type(self.parent)))
- # network_ref = "unknown: implement " + str(
- # type(self.parent)
- # )
-
- # result["supporting-termination-point"] = [
- # {
- # "network-ref": network_ref,
- # "node-ref": self.parent.name,
- # "tp-ref": self.supporter,
- # }
- # ]
+ if self.supporter and type(self.parent) is not int:
+ network_ref: str = ""
+ match str(type(self.parent)):
+ case "<class 'model.python.o_ran_smo.ORanSmo'>":
+ network_ref = self.parent.parent.id
+ case "<class 'model.python.o_ran_near_rt_ric.ORanNearRtRic'>":
+ network_ref = self.parent.parent.parent.id
+ case "<class 'model.python.o_ran_cu.ORanCu'>":
+ network_ref = self.parent.parent.parent.parent.id
+ case "<class 'model.python.o_ran_du.ORanDu'>":
+ network_ref = self.parent.parent.parent.parent.parent.id
+ case "<class 'model.python.o_ran_cloud_du.ORanCloudDu'>":
+ network_ref = self.parent.parent.parent.parent.parent.id
+ case "<class 'model.python.o_ran_ru.ORanRu'>":
+ network_ref = (
+ self.parent.parent.parent.parent.parent.parent.id
+ )
+ case _:
+ print("unknown: implement " + str(type(self.parent)))
+ network_ref = "unknown: implement " + str(
+ type(self.parent))
+
+ result["supporting-termination-point"] = [
+ {
+ "network-ref": network_ref,
+ "node-ref": self.parent.name,
+ "tp-ref": self.supporter,
+ }
+ ]
return result
)
-# Define the "IORanDu" interface
+# Define the "IoRanDu" interface
class ITower(IORanNode):
o_ran_ru_count: int
cell_count: int = (
self.parent.parent.parent.parent.parent.configuration[
"pattern"
- ]["o-ran-ru"]["nr-cell-du-count"]
+ ]["oRanRu"]["nrCellDuCount"]
)
cell_angle: int = (
self.parent.parent.parent.parent.parent.configuration[
"pattern"
- ]["nr-cell-du"]["cell-angle"]
+ ]["nrCellDu"]["cellAngle"]
)
ru_angle: int = cell_count * cell_angle
ru_azimuth: int = index * ru_angle