Coder Social home page Coder Social logo

hdhauk / ttk4145-lift Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 194 KB

Distributed lift controller, based on Raft consensus. Project for the course TTK4145

License: GNU General Public License v3.0

Go 73.08% C 3.22% D 19.02% Shell 4.68%
go golang raft-algorithm raft raft-consensus-algorithm

ttk4145-lift's Introduction

TTK4145-Lift

A distributed lift controller written in Go, created as a project assignment in TTK4145 Real-Time Programming.

Build Status Go Report Card

Highlights

  • Communication based on the Raft consensus algorithm.
  • Can handle loss of up to half of available nodes without degraded functionality.
  • Support both lift-hardware and simulators
  • godoc compliant

Raft algorithm

For a overview over the Raft consensus algorithm see the excellent visualizations at:

Module documentation

Module name Description
driver GoDoc Package driver provides control of both simulated and actual lifts. The package also provide functionality for handeling internal orderes, as well as taking external orders.
peerdiscovery GoDoc Package peerdiscovery provides automatic detection of other peers in the same subnet. It does this by utlizing broadcastmessages over UDP.
globalstate GoDoc Package globalstate is wrapper package for Hashicorps' implementation of the Raft consensus protocol. See https://github.com/hashicorp/raft.
statetools GoDoc Package statetools implements costfunctions, and tools necessary to replicate some of the globalstate's functionality offline.

Installation

Requirements

  • Ubuntu 16.10
  • Go 1.5.3
  • DMD 2.073.0 (only for using the simulator)

Only tested on these versions, but will likely work unless you have any ancient versions

Not tested on Windows, but the Comedi driver will likely be hard to get working. The simulator does not work properly in MacOS.

Prerequisites

  • Make sure your Go environment is correctly set up:

    The location of the project should look something like this:

  $GOPATH/
    ↳ src/
      ↳ github.com/
        ↳ hdhauk/
          ↳ TTK4145-Lift/

1 .Install Comedi drivers

Download the drivers from comedi.org. Extract the tarball and open a terminal in the folder and install the library :

./configure
make
sudo make install

2. Install Go dependencies

The project utilize Hashicorps Raft library. To download all necessary dependencies open a terminal window in the project folder and run

cd $GOPATH/src/github.com/hdhauk/TTK4145-Lift
go get -t ./..

or install it directly using

go get github.com/hashicorp/raft

3. Install testing tools (Optional)

sudo apt-get update
sudo apt-get install xdotool

4. Build the project

cd $GOPATH/src/github.com/hdhauk/TTK4145-Lift
go build .

Usage

If you are intending to run in simulator mode first start the simulator on the local host:

cd $GOPATH/src/github.com/hdhauk/TTK4145-Lift/driver/simulators/simulator1-53566
rdmd sim_server.d

Run the project with the command ./TTK4145-Lift. The following options are available

Argument Additional variable Description
-nick name you want Option to give the elevator a specific id. If omitted it will use the process id
-sim number of the port When set the controller will start in simulator mode an will attempt to connect to a simulator on the provided port (running on localhost)
-raft number of the port used for raft communication Both the port provided and the one above will be used for communication and needs to be available.
-floors number of floors Used to provide a custom number of floors. Default is 4

Example: ./TTK4145-Lift -nick MyElevator -sim 53566 -raft 8000 - floors 9

ttk4145-lift's People

Contributors

erlendbasso avatar hdhauk avatar johankor avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

oscarrk

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.