Coder Social home page Coder Social logo

elevator-project's Introduction

Elevator project - TTK4145

Elevator project for Real-time Programming TTK4145 at NTNU. This a distributed program which is designed to handle multiple elevators on a network concurrently in a fail-safe manner.

Disclaimer: Our elevator does not handle new orders when disconnected from the network. This is due to the state only being transmit through UDP on the network, without any form of loopback. Introducing a form of local loopback on transmit messages, such as an additional go channel, would solve this issue and fulfil the elevator specification.

Evaluation: Code quality -9/9

Dependencies

This project requires the following dependencies to be installed on the host machine:

  • elevatorserver or elevatorsimulator needs to be installed and in the path of the root user
  • golang >= 1.21 For the distributed elevator program
  • dmd D-lang compiler for the hall request assigner
  • (Optional) ffmpeg for elevator music

Snippets: sudo apt install golang sudo apt install dmd

To build and install the hall_request_assigner run the following commands: chmod +x scripts/install_deps.sh ./scripts/install_deps.sh

Note: If DMD is not in apt sources, visit https://dlang.org/download.html for dmd download

Deployment

To deploy an instance of an elevator you only need to run: sudo ./scripts/create_and_start_elevatorservice.sh 1 Where the argument specifies the ID of that instance. The script does the following:

  • Make a config directory ~/.config/elevator/
  • build the elevator program and copy to ~/.config/elevator/
  • Copy the template systemd service file [email protected] to /etc/systemd/system
  • Start the elevatorserver
  • Enable and start the service with given ID

You can use systemctl to stop, start or view the status of a running elevator:

sudo systemctl start elevator@1

sudo systemctl stop elevator@1

sudo systemctl status elevator@1

Un-deployment: Removing the elevator

To remove the elvatorservice and it's configuration files you can use the following command:

sudo ./scripts/stop_and_remove_elevatorservice.sh 1

"1" being the instance you want to remove.

Cloning the repository

Since we have git submodules you need to clone the repository recursively: git clone --recursive link.to.repo.git

Manual deployment

To deploy the elevator manually you can run the elevatorserver:

elevatorserver --port myport

and then run the elevator program:

go run main.go --id myid --port myport

This is not part of the deployment, but is useful for testing (we use systemd for resetting our system from fail states)

elevator-project's People

Contributors

tordnat avatar

Watchers

 avatar

Forkers

sveinisdahl

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.