Skip to content

NathanMacDiarmid/UDP-Elevator

Repository files navigation

SYSC3303A-Project

Elevator Control System and Simulator

Iteration 1 simulates a elevator using java threads represented with string prompts in the terminal. Users are notified when the elevator has finished a request/move and where that request is.

Iteration 2 has the goal of adding the state machines for the scheduler and elevator subsystems assuming that there is only one elevator.

Iteration 3 has the goal of adding multiple elvators to the program. The scheduler now has to choose the best elevator to receive the incoming instruction to execute based on direction and distance from floor request.

Iteration 4 has the goal of adding code for detecting and handling faults. Faults are outputted in the console as they happen, based on the the type of fault, the error handling is adjusted.

Iteration 5 has the goal of adding a User Interface for the concierge to monitor the elevator system while it is servicing requests. The performance of the system was also measured by recording the time it takes to run the entire input file.

Contributions:

🥇 Amanda Piazza (101143004)

  • Implementation of Output Class (UI)

🥇 Juanita Rodelo (101141857)

  • Measurement Analysis
  • Output class (UI)

🥇 Matthew Belanger (101144323)

  • Bug Fixes

🥇 Michael Kyrollos (101183521)

  • Unit testing, UML diagrams

🥇 Nathan MacDiarmid (101098993)

  • UML Sequence Diagram
  • Scheduler State Machine
  • Bug Fixes

Structure

  • Floor.java accepts events from InputData.java. Each event consists of the current time, the floor request, the direction of travel and the car button pressed. These events are sent to Scheduler.java

  • Elevator.java waits for the Scheduler to receive an event. It becomes active once the Scheulder.java is with an event in elevatorQueue ArrayList. The move is executed and the new data is sent to Scheduler.java. Implements the state machine.

  • Scheduler.java is a organized messanger between Floor.java and Elevator.java. It accepts events from Floor.java and sends this event to Elevator.java. New data is recieved from Elevator.java and is sent to Floor.java.

Running the test cases in VS Code

Open the settings.json file in VS code and modify according to the image below. image

How to run the program

  1. Open Eclipse and create a new project (File -> New -> Java Project) image

  2. Name the project Iteration3 and click Finish image

  3. Create a package by right clicking on the /src directory within the project folder in Eclipse, name it Iteration3 image

  4. Unzip LA1G6_Iteration3.zip

  5. Right click on the package and click import. image

  6. Import as File Systems image

  7. Locate the directory in which the Java src files can be found. (From the Extracted zip in Step 4). From the GitHub Repo, it would be \SYSC3303A-Project\Iteration3\src\Iteration3 image

Include the following files

  • Elevator.java

  • Floor.java

  • InputData.java

  • Scheduler.java

  • ElevatorTest.java

  • Floor.java

  • SchedulerTest.java

  1. Run the program with the green play button at the top image

If JUnit tests are not working after importing the project

If there is an x symbol beside any of the testing files, follow the intructions below.

  1. Open a testing file and hover the mouse over the @Test code that is underlined red. Click on Add JUnit 5 library to the build path image

  2. Hover over the import statement at the top of the file and click on the circled button in the picture below. image

  3. Hover over the @Test code that is underlined red. Click on Fix Project Setup. Click on Add JUnit 5 library to the build path -> choose org.junit.jupiter.api.Test image

  4. Navigate to the module-info.java file and open it. Hover over the red underlined code and click on the option to change the build path. The tests should be working now.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages