Git Product home page Git Product logo

go-heisen's Introduction

Go-heisen

Elevator Project for TTK4145 Real Time Programming at NTNU

Design decisions:

  • Random Unique IDs for every order:
    • Makes it possible to differentiate a new order from the one that was completed a minute ago
  • Peer-to-peer:
    • Every node may assign an order to any node
    • Every node stores all orders for all nodes
    • Every node regularly broadcasts all the orders for all nodes it believes are active
      • If a node receives an active order it knows is completed, it broadcasts the completed order so the other nodes may clear it
      • This ensures that the elevators quickly converge to a common belief state, even through restarts and disconnects/reconnects
    • Any node may clear a hall order if it has been finished, regardless of if it was the intended executor
  • Order Delegation
    • The nodes regularly broadcast their states
    • The node that receives a button push delegates the order to the best recipent, given the stored states of the other nodes
  • Redundancy
    • If an order is for any reason not completed within the deadline (40 seconds), every node redelegates the order to a new node
      • Remember that all the equivalent orders are cleared if one is completed

Modules

Module Diagram

Concurrent goroutines

  • OrderProcessor:
    • Keeps track of all orders in all nodes
    • Updates it's OrderRepository with incoming orders from other nodes
      • Sends all the active orders to the Controller if changes are made
    • Creates and broadcasts orders from button pushes if no equivalent orders exist
    • Clears all equivalent orders when arriving at a floor, broadcasts the completed orders to the other nodes
    • Regularly rebroadcasts all active orders
    • Regularly provides Watchdog with all the active orders, s.t. it may redelegate the ones not completed within the deadline
  • Controller:
    • Interfaces with ElevatorServer, executes the active orders that belong to the node. Heavily based on elev_algo from the ProjectResources repository
    • Controls the motor, lights, door, and receives updates of new floors
    • Informs OrderProcessor when a button is pushed or a floor is stopped at, does not make decisions to create/complete orders itself
    • Informs Delegator when the state has changed
  • Delegator:
    • Delegates new orders provided by OrderProcessor
    • Orders are delegated to the node with the lowest Cost
    • Redelegates orders to a new recipent if provided by Watchdog
  • Watchdog:
    • Checks that active orders provided by OrderProcessor are completed within the deadline
      • Sends orders to Delegator to be redelegated if they are too old

Other modules

  • elevator:
    • Definitions of orders, elevator state, as well as types for buttons, motor directions etc.

Libraries used

  • Network-go
    • Used for broadcasting and receiving elevator state and orders between nodes.
  • driver-go

go-heisen's People

Contributors

krisbrud avatar hkindem avatar helgags avatar

Watchers

 avatar  avatar

go-heisen's Issues

Refactor Orderrepository

OrderRepository is more complex than needed, a simple struct with a dictionary and mutex should suffice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.