Ensure that only Cells cover a geographical area 87/11987/1
authorMartin Skorupski <martin.skorupski@highstreet-technologies.com>
Sat, 28 Oct 2023 19:26:12 +0000 (21:26 +0200)
committerMartin Skorupski <martin.skorupski@highstreet-technologies.com>
Sat, 28 Oct 2023 19:27:22 +0000 (21:27 +0200)
- create cells per O-RU
- call cell representation for kml

Issue-ID: OAM-378
Change-Id: I72e961c02150f15f57dd8d1bcd68bdfe3a859156
Signed-off-by: Martin Skorupski <martin.skorupski@highstreet-technologies.com>
code/network-generator/model/python/o_ran_ru.py

index 0ce0b90..a02db29 100644 (file)
@@ -17,6 +17,7 @@
 """
 A Class representing an O-RAN radio unit (ORanRu)
 """
+from model.python.nr_cell_du import NrCellDu
 from model.python.o_ran_object import IORanObject
 from model.python.o_ran_node import ORanNode
 import xml.etree.ElementTree as ET
@@ -24,9 +25,11 @@ import xml.etree.ElementTree as ET
 
 # Define the "IORanRu" interface
 class IORanRu(IORanObject):
-    def __init__(self, cell_count: int, **kwargs):
+    def __init__(self, cell_count: int, ru_angle:int, ru_azimuth:int, **kwargs):
         super().__init__(**kwargs)
         self._cell_count = cell_count
+        self._ru_angle = ru_angle
+        self._ru_azimuth = ru_azimuth
 
 
 # Define an abstract O-RAN Node class
@@ -34,9 +37,52 @@ class ORanRu(ORanNode, IORanRu):
     def __init__(self, o_ran_ru_data: IORanRu = None, **kwargs):
         super().__init__(o_ran_ru_data, **kwargs)
         self._cell_count = o_ran_ru_data["cellCount"] if o_ran_ru_data and "cellCount" in o_ran_ru_data else 1
+        self._ru_angle = o_ran_ru_data["ruAngle"] if o_ran_ru_data and "ruAngle" in o_ran_ru_data else 120
+        self._ru_azimuth = o_ran_ru_data["ruAzimuth"] if o_ran_ru_data and "ruAzimuth" in o_ran_ru_data else 0
+        self._cells: list[NrCellDu] = self._create_cells()
 
-    def toKml(self) -> None:
-        return None
+
+    def _create_cells(self) -> list[NrCellDu]:
+        result: list[NrCellDu] = []
+        cell_angle : int = self.parent.parent.parent.parent.parent.parent.configuration()[
+            "pattern"
+        ]["nr-cell-du"]["cell-angle"]
+        for index in range(self._cell_count):
+            s: str = "00" + str(index)
+            name: str = "-".join(
+                [self.name.replace("RU", "NRCellDu"), s[len(s) - 2 : len(s)]]
+            )
+            azimuth: int = index * cell_angle +self._ru_azimuth
+            result.append(
+                NrCellDu(
+                    {
+                        "name": name,
+                        "geoLocation": self.geoLocation,
+                        "position": self.position,
+                        "layout": self.layout,
+                        "spiralRadiusProfile": self.spiralRadiusProfile,
+                        "parent": self,
+                        "cellAngle": cell_angle,
+                        "azimuth": azimuth,
+                    }
+                )
+            )
+        return result
+
+    @property
+    def cells(self) -> list[NrCellDu]:
+        return self._cells
+
+    def toKml(self) -> ET.Element:
+        print("ru-tower", self.position, self.parent.position) if self.position.q is not self.parent.position.q else "ok"
+        o_ran_ru: ET.Element = ET.Element("Folder")
+        open: ET.Element = ET.SubElement(o_ran_ru, "open")
+        open.text = "1"
+        name: ET.Element = ET.SubElement(o_ran_ru, "name")
+        name.text = self.name
+        for cell in self.cells:
+            o_ran_ru.append(cell.toKml())
+        return o_ran_ru
 
     def toSvg(self) -> None:
         return None