User Tools

Site Tools


ephyl_framework_v2

S3_CAP, a modular framework for slotted transmission

This tutorial shows how to use the S3_CAP framework inside the FIT/CorteXlab testbed and implement a access policy. The framework allows you to change the used PHY layer, as described here, but the tutorial will only show you how to implement the access policy.

First you need to retrieve this docker image:

you@yourpc:~$ docker pull amauryparis/s3cap:latest
you@yourpc:~$ docker run -dti --net=host --expose 2222 --privileged amauryparis/s3cap:latest

Access the docker container using ssh :

you@yourpc:~$ ssh -Xp 2222 root@localhost

In this environment, you have access to the S3CAP project with a LoRa PHY layer. By default, a dummy and random access policy is implemented in files upper/sn_upper.py and upper/bs_upper.py. You can change the two files as follow, to update the access policies of our system and make every node transmitting on a predefined slot. We will also update the content of control messages.

New upper/sn_upper.py :

while True:
    feedback_pmt = up.recv()
    feedback = up.extract(feedback_pmt)

    up.log(feedback["NODE"], "SN - Feedback received - source sensor : %s | frame : %s | dlcch : %s" % (feedback["NODE"], feedback["FRAME"], feedback["DLCCH"]))
    print("SN - Feedback received - source sensor : %s | frame : %s | dlcch : %s" % (feedback["NODE"], feedback["FRAME"], feedback["DLCCH"]))

    action = "True"
    frame = feedback["FRAME"] + 1
    
    if feedback["NODE"] == "A":
        sequence = [[0, "Y"], [1, False], [1, False], [1, False]]
        ulcch = str("poulet_basquaise")
    else:
        sequence = [[0, False], [1, "X"], [1, False], [1, False]]
        ulcch = str("boeuf_bourguignon")

    inst = up.create_SN_inst(feedback["NODE"], frame, action, sequence, ulcch)
    up.send(inst)
    
    up.log(frame, "Instruction send - %s" % (inst))
    print("SN - Instruction send - %s" % (inst))

New upper/bs_upper.py:

while True:
    feedback_pmt = up.recv()
    feedback = up.extract(feedback_pmt)

    up.log(feedback["FRAME"], "Feedback received - frame : %s | ulcch : %s | rx : %s" % (feedback["FRAME"], feedback["ULCCH"], feedback["RX"]))
    print("Feedback received - frame : %s | ulcch : %s | rx : %s" % (feedback["FRAME"], feedback["ULCCH"], feedback["RX"]))

    list_dlcch = []
    frame = feedback["FRAME"] + 1

    for sensor in up.list_sensors:
        dlcch = str("tarte_aux_pommes")
        list_dlcch.append([sensor, dlcch])
    
    inst = up.create_BS_inst(list_dlcch, frame)
    up.send(inst)

    up.log(frame, "Instruction send - %s" % (inst))
    print("Instruction send - %s" % (inst))

You can also set the number of slot on the uplink channel, with the slot_count parameter in the sensor and base station upper files, and with the --S option inside the GNU Radio flowgraph.

You can now exit the docker container, to commit and push the updated version on your account.

you@yourpc:~$ docker ps -a 
you@yourpc:~$ docker commit [CONTAINER ID] [NEW IMAGE NAME] 
you@yourpc:~$ docker tag [NEW IMAGE NAME] [DOCKER USERNAME]/[NEW IMAGE NAME] 
you@yourpc:~$ docker login 
you@yourpc:~$ docker push [DOCKER USERNAME]/[NEW IMAGE NAME] 

After booking the testbed with OAR, you can upload the image on three nodes of your choice with an SSH access, as follow :

  nodeX:
    container:
    - image: [DOCKER USERNAME]/[NEW IMAGE NAME]:latest
      command: /usr/sbin/sshd -p 2222 -D

Once connected to each of the three nodes, you can run the following commands. It will start the access policy and then the PHY layer of each node.

On NODE_X - the first sensor

python2 /root/cxlb_toolchain_build/gr-ephyl/upper/sn_upper.py --slot_count=4 &
python2 /root/cxlb_toolchain_build/gr-ephyl/examples/LoRa/sn_multislot_dyn_ephyl_lora.py --sn-id=A --ip-bs-addr=NODE_Z --S=4

On NODE_Y - the second sensor

python2 /root/cxlb_toolchain_build/gr-ephyl/upper/sn_upper.py --slot_count=4 &
python2 /root/cxlb_toolchain_build/gr-ephyl/examples/LoRa/sn_multislot_dyn_ephyl_lora.py --sn-id=B --ip-bs-addr=NODE_Z --S=4

On NODE_Z - the base station

python2 /root/cxlb_toolchain_build/gr-ephyl/upper/bs_upper.py --slot_count=4 &
python2 /root/cxlb_toolchain_build/gr-ephyl/examples/LoRa/bs_multisn_multislot_dyn_ephyl_lora.py --sn-1-ip-addr=NODE_X --sn-2-ip-addr=NODE_Y --S=4

You will then observe the newly updated access policy.

ephyl_framework_v2.txt · Last modified: 2022/11/30 17:09 by aparis

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki