GithubHelp home page GithubHelp logo

elevator-problem's Introduction

elevator-problem

The following repository contains the solution for a prototype of and elevator. The program simulates the behaviour of the elvator with given tasks

The following classes are defined

  • Program: containing the main function
  • Building: A basic building with a single elvator
  • Elevator: The actual elevator
  • Queue: The queue of the elevator containing all Commands currently not finsihed
  • Commands: A command containing the information: id of the person, when it was requested, from where it was requested and where it should go

The input and output of the application is handeled by the ElevatorInputs and the ElevatorOutput classes each using the CSVInput and the CSVOutput classes as instances of the data. The required input is a .csv file where its path is conifgured in the App.config configuration with the ID of the person, the time of the initial button press, the floor from where it is requeste and where it should go to. After running the application the output is stored in a .csv defined in the configuration file. This output contains 4 comma separated columns: the time, a semicolonseparated list of people in the elevator, the current floor the elevator is at and a semicolon separted list of floors that are still requested (in the order they will be targeted). Currently the absolut path is set to "/Users/nicolasscharmberg/Projects/AVAMAE_elevator/AVAMAE_elevator" and the input file is called "data.csv" and the output file: "dataOut.csv".

The main application starts a timer in seconds that runs up and whenever either a new task is requested (from the csv input) or a task is finished (either picking someone up or dropping someone off) the state of the elvator is changed. This change contains move the elevator floor accordingly to the time add new task to the queue and start exectuing the next task.

In this prototype some additional output is printed to the screen. Everytime a task is finalised (the combination of picking up and dropping off) the total time spend on this task is shown. Additionally the time outside the elvator and the "minimal" exectuion time are printed. The minimal execution time is defined as the time it would take the levator to finish the task without considering any other tasks. See example below

Finished task for 46 in 48s (8s to pick up, minimal time=30)

Everytime the elvator stops at a floor the current state is printed (identical to the inforamtion store in the output .csv. See example below:

State: t=425, people id's=20, currentfloor=8, floorstogo=9, 8, 7, 6, 5, 10, 4, 3, 2

The executable of this prototype is in the path /bin/Release/netcoreapp3.1/AVAMAE_elevator.dll and can be executed with:

dotnet AVAMAE_elevator.dll

elevator-problem's People

Contributors

der-nico avatar

Watchers

 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.