Author Topic: LWMesh.. how to change the routing strategy  (Read 3636 times)

0 Members and 1 Guest are viewing this topic.

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
LWMesh.. how to change the routing strategy
« on: November 08, 2016, 09:47:54 am »
Hello to all
someone tell me if there code to implement the routing level
MPRR(multi path ring routing) and the MAC layer as a B-MAC or tuneable MAC
for LwMesh.
I've already read:
Microcontrollers & FPGAs / Re: Atmel LwMesh: How is the MAC layer implemented?

I would need to create a high latency network 0.5, 1 or 2 packages per hour
think is possible with sleep? or would it be better to use the RTC?
my test hardware (AVAILABLE):
ATZB-212B-XPRO + ATSAMW25-XPRO << DATA SINK
ATZB-212B-XPRO + SAML21 XPLANED XPRO << DATA SINK
ATZB-212B-XPRO + XMEGA-A3BU << SOLUTION FOR BETTER TO NODE
ATZB-X-212B-USB
ATZB-X-212B-XPRO

Best regards to all
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: LWMesh.. how to change the routing strategy
« Reply #1 on: November 08, 2016, 04:03:15 pm »
someone tell me if there code to implement the routing level
MPRR(multi path ring routing) and the MAC layer as a B-MAC or tuneable MAC
for LwMesh.
This is basically equivalent to rewriting 70% of the stack, since it is mostly a routing level implementation. So there is no simple answer, you need to understand how existing code works and write MPRR implementation yourself. At which point, if you are not going for a generic stack, it may be easier to create an application specific solution from scratch.

I would need to create a high latency network 0.5, 1 or 2 packages per hour
think is possible with sleep? or would it be better to use the RTC?
Do you want routing nodes to sleep as well?

It all also depends on total number of nodes. With some dedication and experimentation a lot of things are possible.
Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #2 on: November 10, 2016, 09:37:38 am »
thanks very much for ataradov answer.
I suspected he needed a major change of the LWMesh stack, this is a very tough job.
Let me know in your opinion which I will have to restructure files ...

you all nodes is terminadi that routing will go to sleep and wake up in unison to make communication in a fairly narrow time, this for energy consumption issues.

<MY Work>

My application is agricultural environmental monitoring for large areas.
The estimated distance  between the nodes and 10-50m population of node will be very high (+200).
All will communicate with the data sink
currently I have developed an Android app (Tested in LG K8) for m24rl64 tag programming and code for reading such a device
http://www.avrfreaks.net/forum/atxmegaa3bu-xpld-m24lr64e-r-resolved

I did the first tests on the examples
http://community.atmel.com/forum/help-start-zigbit-212b-resolved

<Concept Hardware>


Best Regards Alex
« Last Edit: November 10, 2016, 09:43:46 am by welby1977 »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: LWMesh.. how to change the routing strategy
« Reply #3 on: November 10, 2016, 06:17:13 pm »
I suspected he needed a major change of the LWMesh stack, this is a very tough job.
Non necessarily. LwMesh has enough APIs for you to implement everything from the application layer. You will basically bypass most of what stack is doing in the process, but it is not all that important.  It all depends on your general algorithmic and programming skills.

Since you only have one data sink, your task will be relatively simple. There are three basic things you will need to figure out:
1. Network commissioning. Since your network is more or less static, this step may include original route discovery.
2. Routing. Again, with one destination, the task will simplify a lot.
3. Sleeping and synchronization. This is probably the hardest part.

Here are some things I would do if I was working on this project:
1. Do not use regular routing algorithms.
2. Use tree structure instead of mesh. This will simplify routing.
3. For sleep and synchronization reasons, make intermediate devices accumulate data from all of their children and pass it along the tree. You will save on traffic and routing.
4. Each device will have multiple awake intervals - one for communicating with each child and one for communicating with the next router (as a child of some other router).
5. Time intervals will have to be assigned by the central node, and maintained autonomously.

This is a very brad picture, there are a lot of details to take care of, but it is not beyond abilities of any reasonable engineer. Just think though the algorithm using only one primitive - each device can communicate to other devices in RF range, no routing is available. And you will figure out what needs to be done exactly pretty fast.
Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #4 on: November 11, 2016, 04:15:27 pm »
I thank you very much for the advice.
some aspects I believe to have them resolved in the node startup procedure where the app transfers the utc received by nmea (GPS smartphone) and the Start of Network (UTC start of the whole network). this to get from the nodes located in different moments a start as simultaneous as possible.
at the stroke of the Network will take place Start of the definition of the levels of multipath routing.
according to the scheme, with Castalia simulated and displayed with CastaliaViz, the configuration package starts from the data sink until it reaches the farthest nodes

https://drive.google.com/open?id=0B-HI4wxq5sPzYnFCTmVGUWlJcTQ

This is my PhD project

Best Regards Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #5 on: November 13, 2016, 11:22:58 am »
Hi Alex.

I studied a bit the code of LWmesh.
I suggested that the types of nodes are only 2
END D. and D. COORDINATOR
END D. becomes the generic node of the network.
COORDIANTOR D. becomes the Data Sink.
The ROUTER D. are excluded because not allow the Sleep Menager
I generally look for devices the following states
Code: [Select]
APP_STATE_INITIAL,
APP_STATE_SEND,
APP_STATE_WAIT_CONF,
APP_STATE_SENDING_DONE,
APP_STATE_WAIT_SEND_TIMER,
APP_STATE_WAIT_COMMAND_TIMER,
APP_STATE_PREPARE_TO_SLEEP,
APP_STATE_SLEEP,
APP_STATE_WAKEUP

I want to show how I would proceed at this stage, because I'm interested to have your opinion.
Add the states
previous APP_STATE_INITIAL,

Code: [Select]
APP_STATE_NO_INIZIALIZED,Device connected to the batteries at its birth

Code: [Select]
APP_STATE_INZIALIZED,After the NFC programming and data validation
Code: [Select]
APP_STATE_WAIT_SON_TIME,device pending the launch of the network
Code: [Select]
APP_STATE_WAIT_RING_DEFINE,device waiting for the definition of the level packages

I would also ask for clarification of these sections of code that I do not understand
in sleep_mgr.c file
Code: [Select]
static void RTC32_SetTimeout( uint32_t alarmTimeout )
{
uint32_t compareValue;

/* Synchronize CNT from RTC to system clock domain. */
RTC32_SyncCnt();
do { } while (RTC32_SyncCntBusy());

/* Calculate compare time. */
compareValue = RTC32.CNT + alarmTimeout;

/* Wrap on period. */
if (compareValue > RTC32.PER) {
compareValue -= RTC32.PER;
}

/* Add the timeout value to get the absolute time of the alarm. */
RTC32.COMP = compareValue;
}


how works this code
   /* Wrap on period. */
   if (compareValue > RTC32.PER) {
      compareValue -= RTC32.PER;
   }


the sysTimer
It is a timer for short delays , but I can not understand how it does work..


Best Regards Alex

 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: LWMesh.. how to change the routing strategy
« Reply #6 on: November 13, 2016, 05:59:05 pm »
I want to show how I would proceed at this stage, because I'm interested to have your opinion.
I don't have an opinion on exact states, states will change as you go. I think you need to start with just two nodes and make it work as you expect. Then once you get that base code, it will be easier to see who to scale this up.

in sleep_mgr.c file
Note that I'm not going to answer questions on ASF. And I generally recommend you go with a standalone version of LwMesh.

how works this code
   /* Wrap on period. */
   if (compareValue > RTC32.PER) {
      compareValue -= RTC32.PER;
   }

This code will give delay up to the period of a timer, timer overflows on a match with the programmed period, so we are putting the expected delay on the overflowed area. Draw a few periods of timer operation on paper and you will see exactly what this code is doing.
Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #7 on: November 13, 2016, 11:22:08 pm »
Thank you very much Alex for the speed

I apologize for the question
I'll try to do a trial run to see if I am progressing well
Best Regards Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #8 on: July 30, 2018, 09:20:29 am »
Hi Alex, I trust you ...
unfortunately for several evnti I had to put aside the mppt routing project.
I need to create a small network to measure environmental parameters.
I am using the WSNdemo examples as a basis.
I added the code to use the 4 channels of the ADC. it seems to work.
disabling the adc after each conversion to keep the end device timings.
I would like to use as a cordinator (data sink) a samw25 xpro + atzb-212-xpro (no atzb-x-212-xpro). This is to send the received data via soket.
The code to receive data from routers / end devices works ...
The code to open the soket works ...
integrating is complicated for me ... I tried various ways.
can you give me some suggestions?

I thank you so much
Best regards, Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: LWMesh.. how to change the routing strategy
« Reply #9 on: July 30, 2018, 04:11:22 pm »
can you give me some suggestions?
If you have started with ASF version of LwMesh, then I have no idea what to do. It will be hard and you just have to power though it.

If you have started with a standalone version, then just add all files to the W25 project. Then compile and see what does not build, resolve, repeat. There are very few dependencies, so it should just work.
Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #10 on: July 31, 2018, 11:29:56 am »
Thank you very much Alex for the speed

I used the project WSNdemo application for samd21. I modified it for the samw25 and it works ... but for sending via serial console.
Below I have opened the example WINC1500_SIMPLE_TCP_CLIENT_EXAMPLE for samw25.
I loaded the configuration files (pin reference) of the winc1500 in the project WSNdemo I loaded the ASF libraries as in the WIN1500_SIMPLE_TCP ...
I created a function:
appSoketSendMessage ((uint8_t *) & appMsg, sizeof (appMsg));
to insert after:
appUartSendMessage ((uint8_t *) & appMsg, sizeof (appMsg));
everything compiled correctly ....
but in run mode errors do not end up debugging consol ... and obviously it does not work. The two projects are completely different in terms of operating logic.

It may help some similar project ... if you know it ..
best regards Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: LWMesh.. how to change the routing strategy
« Reply #11 on: July 31, 2018, 04:20:40 pm »
I don't understand. Do you have one project with two stacks merged or two separate projects? Does appSoketSendMessage() work if you can it from anywhere?

I don't know of any projects that use SAM W25 and LwMesh.
Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #12 on: August 01, 2018, 08:51:50 am »
Thank you very much Alex for the speed
the SAM W25 and LwMesh project I did it and it works ...
but I would like this project to take advantage of the features of the sam w25 to make a connection to a cloud to store data.
I should integrate the two stacks ... which I have already tried ...
but with poor results.
The purpose is to create a bridge to send data on the internet with only one device, which can potentially do it.
I always have a plan B which plans to use two devices so as to divide the tasks.
A samw25, or alternatively Arduino MKR1000, for internet connection and an atzb-x-212-xpro as network coordinator.
Samw25 communicates with atzb-x-212-xpro via serial ...

It may help some similar project ... to make the bridge.

best regards Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: LWMesh.. how to change the routing strategy
« Reply #13 on: August 01, 2018, 03:52:28 pm »
You describe the results as "poor", but don't provide any evidence that you have actually tried to debug anything. And you are not really providing any information to help you debug things. Like what exactly does not work after the integration?

Integration of two big software components is not a trivial process, I would not expect it to work right away. You have to do more debugging, it may be some thing simple.
Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #14 on: August 02, 2018, 12:49:25 pm »
Hi Alex
my current situation is as follows:
if I compile with the fuction that starts sending the data with soket the coordiantore stops receiving the packets of the routers / end devices but opens the soket and communicates with TCP ..
if you comment the function the network works correctly.
The problem seems to be the m2m_wifi_init () function
that at its execution it stops the reception of the packages.
I assume it is a problem related to the rewriting of interrupts ...
the wifi works with callback status

do you have a suggestion? do you need more information?

thanks Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: LWMesh.. how to change the routing strategy
« Reply #15 on: August 02, 2018, 05:12:56 pm »
I'm not going to debug this for you remotely. If you suspect that  m2m_wifi_init() interferes with LwMesh somehow, then step through it and figure out what exactly happens.

There is no easy way out, merging two big stacks is hard, you will have to work through it.
Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #16 on: August 03, 2018, 09:38:45 am »
Hi Alex
I understand the possibility of a remote debugging .....
This object is being developed for academic / recreational purposes only
I have no problem to share this project with you and the world ...
For the sake of completeness I share both the coordinator's project (samw25 xplained pro + + atzb-212-xpro) and that of the ED / Ro sensor nodes (atzb-x-212-xpro or atzb-x-212-usb).
obviously for the nodes I recommend the atzb-x-212-xpro which have available adc on header j3.

I hope this can be something you like.
the projects are large, I link to Gdrive.
https://drive.google.com/open?id=1Rg0frNX_Yd5jEdWqlbb1Uw1ZsHcOgHmo
thanks Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: LWMesh.. how to change the routing strategy
« Reply #17 on: August 03, 2018, 04:46:34 pm »
Ok, i think I was not clear. I will not do your work for you. I can guide you, but you have to actually do the work and provide specific questions. You seem to have no debugging at all so far.
Alex
 

Offline welby1977Topic starter

  • Contributor
  • Posts: 11
  • Country: it
Re: LWMesh.. how to change the routing strategy
« Reply #18 on: August 07, 2018, 02:49:30 pm »

Hi Alex
to start, I thank you for looking at the code, it's actually not a clean code.
unfortunately I do not have time to devote myself to solving this problem.
Looking at the wiring diagrams of the two devices I noticed that both the atzb-212-xpro module and the flash memory mounted in the samw25 xplained pro are connected on the same SPI (PA16-PA17-PA18-PA19). The only one available externally in the module SamW25 ...
Surely I have to study better and more ...
Do you think this example could be more relevant to my case?
AT15964-SmartConnect-6LoWPAN-Gateway-Inte
in this example they use a samd21 + WILC1000 XPRO (Similar Win1500) ...
and two different channels for atzb-212-xpro and flash ...

thanks Alex for your patience
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: LWMesh.. how to change the routing strategy
« Reply #19 on: August 07, 2018, 05:53:15 pm »
I'm NOT looking into your code. If you don't have time to deal with this, then why would I?

6LoWPAN is a completely different stack. It will have its own learning curve and limitations. I can't say if it will work for you.
Alex
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf