Back-end File Structure

IoT Unit

  • Responsible for sending and receiving data to/from HEM
  • Also performs authentication and is responsible for encryption and decryption of data

Files

  • cloud.js
  • commandProcessor.js
  • commandSender.js
  • msgTable.js
  • socketTable.js
  • msgPacket.js

Chief Microgrid Operator (CMO)

  • Creates one supervisor (microgrid.js) for each microgrid. Supervisor for a particular microgrid is created when the first HEM of that microgrid sends data.
  • The CMO for now is microgrids.js

Files

  • microgrids.js

Microgrid Supervisor

  • Creates a message bus for a microgrid so that worker nodes can subscribe to it and get live data.
  • When a job comes to the supervisor, it creates a worker node and asks it to run.
  • For now, this is microgrid.js in mem/cloud/microgrid

Files

  • microgrid.js

Status Monitor (SM)

  • Maintains status of all HEMs for the REST services. Mainly for the web application

Files

  • hemGlobalEvents.js
  • hemStatusMonitor.js
  • hemStatusObj.js

Exchanges and Queues

  • We have two types of exchanges– fanout and topic
  • Fanout distributes messages to all connected queues. It does dummy broadcasting
  • Topic distributes messages selectively based on routing key
_images/exchange1.jpg _images/exchange2.jpg _images/exchange3.jpg

Backend Flow

_images/flow1.jpg _images/flow2.jpg _images/flow3.jpg _images/flow4a.jpg _images/flow4b.jpg