Skip to content

Nerlnet App Flow

Haran Cohen edited this page Jul 16, 2023 · 5 revisions

Nerlnet Platform Flow

Communication in Nerlnet

all communication in Nerlnet is HTTP based. if an entity wants to communicate with another, it must call nerl_tools:sendHTTP/4 which generates a new HTTP request using httpc:request. the relevant entity will get and handle the request in the appropriate handler.

Nerlnet App Init

Stage 1: App start and Initator

After install and build of the platform, you can run the NerlnetRun.sh to start the app.
This will start the Nerlnet app, which waits for an initiator to tell it what entities this device needs to open.
The Nerlnet app open its own cowboy server (open in IP:8484), which has several handlers:

  1. IoT handler: query to this page will return whether this app has an active nerlnet model
  2. json handler: gets the arch and conn jsons that initialize the app and its entities on device

after initiator was received (from json handler), can proceed

Stage 2: init local entities

arch and conn jsons are received and read by jsonParser module. This module saves the data in an ets named "nerlnet_data" that entities have access to.
afterwards, the main app opens all entities on the device.

Stage 3: Idleing

after all entities and their servers have opened, they are all ready to get messages from the api server (thru the main server).
This concludes that init stage.

Setting data in source

before an experiment (or training/predication phase) can start, the relevant data needs to be uploaded to the sources. This is done thru specific handlers that read the CSV and pass it along. When the data reaches the source, it loads it and waits for a start casting message.

Train / Predict phases

Stage 1: mainserver tells clients to go to appropriate state. Clients make sure all workers are ready, and send back ACK to mainserver
Stage 2: mainserver sends start casting to all sensors. they send data at Frequency Hz to relevant workers.
Stage 3: workers get sample thru clients and train/predict according to phase.
Stage 4: when source sends all data / the amount set for experiment, it sends ACK back to mainserver.
Stage 5: mainserver tells clients to go to idle (?)