adrianiaz / TTK4145-project

Elevator project - The creation of software for controlling n elevators working in parallel across m floors.
0 stars 0 forks source link

Network module #5

Open adrianiaz opened 6 months ago

adrianiaz commented 6 months ago

Inputs: Elevator state from ElevatorController, Incoming orders and completed orders from the OrderHandler, and the ledger from the Master module. Outputs: The ledger to the OrderHandler

The network module is responsible for distributing the ledger downstream to the OrderHandler, and sending relevant information to the master upstream from different modules. The network module is responsible for creating a TCP-connection to the slave network modules. This ensures that all nodes are connected through the network, and recieve the same information.

The network module should also ping out the masters IP on a UDP broadcast if the module is run from a master node. When a node restarts, it will look for a UDP broadcast on the network and assign themselves slave status if they find it. If not, they will assign themselves as the Master on the network and start pinging out its own IP for new slaves to connect to.

(possible issues: What if two modules assign themselves as master at the same time? Possible solution: Have a prioritization list for who will take over in the case there is no master written to the ledger. A problem here could be on initialization, where this prioritization has not yet been written to the ledger)

adrianiaz commented 6 months ago

Submodule TCPserver for handling incoming TCP connections.