intrig-unicamp / mininet-wifi

Emulator for Software-Defined Wireless Networks
https://mn-wifi.readthedocs.io/
Other
441 stars 240 forks source link

change the car's range and the RSU's range respectively #274

Closed badDDalways closed 4 years ago

badDDalways commented 4 years ago

Hi,

How do I change the car's range and the RSU's range respectively in examples/vanet.py? I tried to change the "range" parameter of RSU, it seems that this only increased the RSU range on the Mininet-WiFi graph, cars in the RSU coverage edge cannot connect to the RSU. I also tried the "range" parameter of cars, also failed. Then I changed the parameters in propagation model, the coverage of RSU and the car is increased or reduced together. I think in practice the range of RSU should be bigger than the car, just as your 2016 youtube video "Mininet-WiFi: Towards Software-Defined VANET" shows.

Thank you very much! Have a nice day ;)

ramonfontes commented 4 years ago

https://mininet-wifi.github.io/part3/#range

badDDalways commented 4 years ago

Hi,

I have tried these methods, they not worked for me.

  1. I use the following command to change the range of RSUs and cars, the error message is displayed, nothing changes. mininet-wifi> py RSU1.setRange(100) main thread is not in main loop mininet-wifi> py car1.setRange(200) main thread is not in main loop mininet-wifi> py RSU1.setRange(100, intf="RSU1-wlan1") main thread is not in main loop mininet-wifi> py car5.setRange(100, intf="car5-wlan0") main thread is not in main loop

  2. Sometimes, although the message "main thread is not in main loop" is displayed, the RSU range on the Mininet-Graph can be changed. However, at this time, cars within RSU's coverage are not connected with this RSU, as follows.

mininet-wifi> py RSU1.params['associatedStations'] [<Car car6: car6-wlan0:192.168.0.6,car6-wlan1:None,car6-mp1:192.168.1.6 pid=17972> , <Car car5: car5-wlan0:192.168.0.5,car5-wlan1:None,car5-mp1:192.168.1.5 pid=17969> , <Car car1: car1-wlan0:192.168.0.1,car1-wlan1:None,car1-mp1:192.168.1.1 pid=17957> , <Car car3: car3-wlan0:192.168.0.3,car3-wlan1:None,car3-mp1:192.168.1.3 pid=17963> , <Car car7: car7-wlan0:192.168.0.7,car7-wlan1:None,car7-mp1:192.168.1.7 pid=17975> ] mininet-wifi> car1 iwconfig car1-mp1 IEEE 802.11abgn Mode:Auto Tx-Power=20 dBm Retry short limit:7 RTS thr:off Fragment thr:off Power Management:on

car1-wlan0 IEEE 802.11abgn ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm Retry short limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:off lo no wireless extensions.

car1-wlan1 IEEE 802.11abgn ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm Retry short limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:off

  1. I also tried the new feature telemetry. Similar error happened.

Error info: *** Creating nodes *** Configuring Propagation Model *** Configuring wifi nodes *** Connecting to wmediumd server /var/run/wmediumd.sock *** Associating and Creating links *** Starting network *** Configuring nodes *** Running CLI *** Starting CLI: mininet-wifi> Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "/usr/local/lib/python2.7/dist-packages/mininet_wifi-2.4.1-py2.7.egg/mn_wifi/telemetry.py", line 70, in start fig, (self.axes) = plt.subplots(1, (len(nodes)), figsize=(10, 4)) File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 1177, in subplots fig = figure(**fig_kw) File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 527, in figure **kwargs) File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 84, in new_figure_manager return new_figure_manager_given_figure(num, figure) File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 101, in new_figure_manager_given_figure icon_img = Tk.PhotoImage(file=icon_fname) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3370, in __init__ Image.__init__(self, 'photo', name, cnf, master, **kw) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3324, in __init__ self.tk.call(('image', 'create', imgtype, name,) + options) **RuntimeError: main thread is not in main loop**

My code:

`def topology():

"Create a network."
net = Mininet_wifi(controller=None, roads=3,
                   link=wmediumd, wmediumd_mode=interference)

info("*** Creating nodes\n")
cars = []
for id in range(0, 10):
    min_ = randint(1, 4)
    max_ = randint(11, 30)
    cars.append(net.addCar('car%s' % (id+1), wlans=2,
                           min_speed=min_,
                           max_speed=max_))

rsu1 = net.addAccessPoint('RSU1', ssid='RSU1', mode='g', 
                           channel='2', dpid="1")
rsu2 = net.addAccessPoint('RSU2', ssid='RSU2', mode='g',
                           channel='2', dpid="2")
rsu3 = net.addAccessPoint('RSU3', ssid='RSU3', mode='g',
                           channel='2', dpid="3")
rsu4 = net.addAccessPoint('RSU4', ssid='RSU4', mode='g',
                           channel='2', dpid="4")
h1 = net.addHost('h1', ip="192.168.0.11/24")
h3 = net.addHost('h3', ip="192.168.0.13/24")

# c1 = net.addController('c1')
c1 = net.addController('c1', controller=RemoteController, ip='127.0.0.1', port=6653)

info("*** Configuring Propagation Model\n")
net.setPropagationModel(model="logDistance", exp=4.5)

info("*** Configuring wifi nodes\n")
net.configureWifiNodes()

info("*** Associating and Creating links\n")
net.addLink(rsu1, rsu2)
net.addLink(rsu1, rsu3)
net.addLink(rsu1, rsu4)
net.addLink(rsu1, h1)
net.addLink(rsu1, h3)

for car in cars:
    net.addLink(car, intf=car.params['wlan'][1],
                cls=mesh, ssid='mesh-ssid', channel=2)

net.plotGraph(max_x=500, max_y=500)

net.startMobility(time=0)

info("*** Starting network\n")
net.build()
c1.start()
rsu1.start([c1])
rsu2.start([c1])
rsu3.start([c1])
rsu4.start([c1])

for car in cars:
    car.setIP('192.168.0.%s/24' % (int(cars.index(car))+1),
              intf='%s-wlan0' % car)
    car.setIP('192.168.1.%s/24' % (int(cars.index(car))+1),
              intf='%s-mp1' % car)

# refer to mn_wifi/telemetry for more information
nodes = net.stations # I also tried "cars"
net.telemetry(nodes=nodes, single=False, data_type='rssi')

info("*** Running CLI\n")
CLI_wifi(net)

info("*** Stopping network\n")
net.stop()

if name == 'main': setLogLevel('info') topology()`

Thank you very much!

ramonfontes commented 4 years ago

https://mininet-wifi.github.io/#alert