Exemplo n.º 1
0
 def publish_pathloss(self, nem1: int, nem2: int, rx1: float,
                      rx2: float) -> None:
     """
     Publish pathloss events between provided nems, using provided rx power.
     :param nem1: interface one for pathloss
     :param nem2: interface two for pathloss
     :param rx1: received power from nem2 to nem1
     :param rx2: received power from nem1 to nem2
     :return: nothing
     """
     event = PathlossEvent()
     event.append(nem1, forward=rx1)
     event.append(nem2, forward=rx2)
     self.service.publish(nem1, event)
     self.service.publish(nem2, event)
Exemplo n.º 2
0
    def allinformed_pathloss(self, moduleid, eventtype, eventargs):
        # -Inf  nem:1-3,7 allinformedpathloss 90
        nems = nodestr_to_nodelist(moduleid.split(':')[1])

        pathloss = float(eventargs[0])

        events = defaultdict(lambda: PathlossEvent())

        for x,y in itertools.product(nems, nems):
            if x==y:
                # ignore self node pathloss
                continue

            events[x].append(y, forward=pathloss)

            events[y].append(x, forward=pathloss)

        return events
Exemplo n.º 3
0
    def pathloss(self, moduleid, eventtype, eventargs):
        # -Inf  nem:1 pathloss nem:2,90 nem:3,90 nem:4,90 nem:5,90 nem:6,90 nem:7,90 nem:8,200
        sending_nem = int(moduleid.split(':')[1])

        receiving_nems = {}

        for eventarg in eventargs:
            receiving_nem,pathloss = eventarg[eventarg.find(':')+1:].split(',')

            receiving_nems[int(receiving_nem)] = float(pathloss)

        events = defaultdict(lambda: PathlossEvent())
    
        for x,y in itertools.product([sending_nem], receiving_nems):
            if x==y:
                # ignore self node pathloss
                continue

            events[x].append(y, forward=receiving_nems[y])
            
            events[y].append(x, forward=receiving_nems[y])

        return events
Exemplo n.º 4
0
#!/usr/bin/env python
try:
    from emane.events import EventService
    from emane.events import PathlossEvent
except:
    from emanesh.events import EventService
    from emanesh.events import PathlossEvent

# create the event service
service = EventService(('224.1.2.8',45703,'emanenode0'))

# create an event setting the pathloss between 1 & 10
event = PathlossEvent()
event.append(1,forward=90)
event.append(10,forward=90)

# publish the event
service.publish(1,event)
service.publish(10,event)

# create an event setting the pathloss between 9 & 10
event = PathlossEvent()
event.append(9,forward=90)
event.append(10,forward=90)

# publish the event
service.publish(9,event)
service.publish(10,event)
Exemplo n.º 5
0
#!/usr/bin/env python
try:
    from emane.events import EventService
    from emane.events import PathlossEvent
except:
    from emanesh.events import EventService
    from emanesh.events import PathlossEvent

# create the event service
service = EventService(('224.1.2.8', 45703, 'emanenode0'))

# create an event setting the pathloss between 1 & 10
event = PathlossEvent()
event.append(1, forward=90)
event.append(10, forward=90)

# publish the event
service.publish(1, event)
service.publish(10, event)

# create an event setting the pathloss between 9 & 10
event = PathlossEvent()
event.append(9, forward=90)
event.append(10, forward=90)

# publish the event
service.publish(9, event)
service.publish(10, event)