Giter VIP home page Giter VIP logo

parallell-concurrent-elevator-controller's Introduction

Course Content

Programming formalisms for real-time systems; POSIX, Ada, Java and Go. Threads/processes, synchronization and communication. Shared variable-based synchronization and resource control. Fault Tolerance, availability and consistency. Message-based synchronization, CSP and formal methods. Exercises and project.

In this course, we had a term project, where I was in a group with two other students. The project counts 25% of the final grade. Here's a brief description of the project and our solution:

Elevator project

Description

In this project, we had to create software for controlling n elevators working in parallel across m floors. There were some main requirments, here summarised in bullet points:

  • No orders are lost
  • Multiple elevators should be more efficient than one
  • An Inidividual elevator should behave sensibly and efficiently
  • The lights should function as expected

In the project, we start with 1 <= n <= 3 elevators, and m == 4 floors. However, we should avoid hard-coding these values, and we aimed to write the project where adding a floor or an elevator required minimal work. The system will however not be tested for n > 3 or m != 4. There are also some unspecified behaviours we had to decide for ourselves:

  • Which orders are cleared when stopping at a floor
  • How the elevator behaves when it cannot connect to the network during initialization
  • How the hall (call up, call down) buttons work when the elevator is disconnected from the network

Lastly, there were some permitted assumptions:

  • At least one elevator is always working normally
  • No multiple simultaneous errors: Only one error happens at a time, but the system must still return to a fail-safe state after this error
  • No network partitioning: Situations where there are multiple sets of two or more elevators with no connection between them can be ignored
  • Stop button and obstruction switch are disabled

For full details on each point, the driver files, or the full specs of the project: head over to TTK4145 (the description/project might have changed as the course is held every spring)

Our solution

We wrote our soloution in Google GO. This was a new language for us, so it required some learning. We decided to use a "fleeting master" together with UDP broadcasting. This means that all elevators knows about all orders and that all elevators knows about all other elevators state, direction and floor. The elevator that receives an external order, will be the one to decide which elevator should execute the order. This decision, along with the order, is broadcasted to all other elevators on the network. The order is then implicitly acknowledged between the elevators before execution. If an elevator lost network or failed to finish the order in a certain time, the other elevators would take over the order. If an elevator is operating normally, only without network, it functioned as a locally run elevator. More details can be found in the subfolders of this project.

In terms of performance, the system performed great. Network packet loss was for example not a problem for our solution in relation to the project requirments. However, there were points of improvement that could be done. For example, one module of the project ended up becoming somewhat of a "fix-it-all"-module, where more divisions of tasks would improve the code neatness and readability. Also, even though scaling the system wouldn't require a lot of work, data types shared between modules and changing these could have been benefited of being more dynamic.

This project took a lot of work to complete, but it gave great experience and was a lot of fun. Our end result is something we're satisified with.

parallell-concurrent-elevator-controller's People

Contributors

perkjelsvik avatar kjetilgjerden avatar kjetisg avatar

Watchers

James Cloos avatar

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.