X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=code%2Fnetwork-generator%2Fmodel%2Fpython%2Fo_ran_smo.py;h=fe040883ef76df73cdc78ebdd25f50448ba3f2d2;hb=594ae73fbe21e8c723661677ddd0cfb1a1a70bba;hp=2bfd8bb46a24cb09e264892b9f4ccb1744e48dbf;hpb=6ed10a839ce487fafaf0d8b7548f39c95d1ab864;p=oam.git diff --git a/code/network-generator/model/python/o_ran_smo.py b/code/network-generator/model/python/o_ran_smo.py index 2bfd8bb..fe04088 100644 --- a/code/network-generator/model/python/o_ran_smo.py +++ b/code/network-generator/model/python/o_ran_smo.py @@ -21,6 +21,8 @@ from model.python.tower import Tower from model.python.o_ran_near_rt_ric import ORanNearRtRic from model.python.o_ran_object import IORanObject from model.python.o_ran_node import ORanNode +from model.python.hexagon import Hex +import model.python.hexagon as Hexagon import xml.etree.ElementTree as ET @@ -38,29 +40,33 @@ class ORanSmo(ORanNode, IORanSmo): def _calculate_near_rt_rics(self) -> list[ORanNearRtRic]: hex_ring_radius: int = self.spiralRadiusProfile.oRanSmoSpiralRadiusOfNearRtRics - index: int = 0 - s: str = "00" + str(index) - name: str = "Ric-" + s[len(s) - 2 : len(s)] + hex_list: list[Hex] = self.spiralRadiusProfile.oRanNearRtRicSpiral( + self.position, hex_ring_radius + ) result: list[ORanNearRtRic] = [] - result.append( - ORanNearRtRic( - { - "name": name, - "geoLocation": self.geoLocation, - "position": self.position, - "layout": self.layout, - "spiralRadiusProfile": self.spiralRadiusProfile, - "parent": self, - } + for index, hex in enumerate(hex_list): + s: str = "00" + str(index) + name: str = "-".join( + [self.name.replace("SMO", "NearRtRic"), s[len(s) - 2 : len(s)]] + ) + network_center: dict = self.parent.center + newGeo = Hexagon.hex_to_geo_location( + self.layout, hex, network_center + ).json() + result.append( + ORanNearRtRic( + { + "name": name, + "geoLocation": newGeo, + "position": hex, + "layout": self.layout, + "spiralRadiusProfile": self.spiralRadiusProfile, + "parent": self, + } + ) ) - ) return result - # return this.spiralProfile.oRanNearRtRicSpiral(this.position, hexRingRadius).map((hex, index) => { - # const name: string = 'Ric-' + ('00' + index).slice(-2); - # return new ORanNearRtRic({ name: name, position: hex, layout: this.layout, spiralProfile: this.spiralProfile, parent: this }); - # }); - @property def o_ran_near_rt_rics(self) -> list[ORanNearRtRic]: return self._o_ran_near_rt_rics @@ -73,8 +79,15 @@ class ORanSmo(ORanNode, IORanSmo): result.append(tower) return result - def toKml(self) -> None: - return None + def toKml(self) -> ET.Element: + smo: ET.Element = ET.Element("Folder") + open: ET.Element = ET.SubElement(smo, "open") + open.text = "1" + name: ET.Element = ET.SubElement(smo, "name") + name.text = self.name + for ric in self.o_ran_near_rt_rics: + smo.append(ric.toKml()) + return smo def toSvg(self) -> None: return None