Skip to content
/ base Public
forked from ftsrg-retelab/base

Sample application for the Systems Engineering Laboratory. Do not clone this repository - use the fork provided by the lab instructors.

Notifications You must be signed in to change notification settings

szfp98/base

 
 

Repository files navigation

Train Speed Controller

This is a sample application for the verification laboratory.

Getting started

  • The application is implemented in Java.
  • The project can be built using Gradle or Maven (currently Maven is preferred).
  • JUnit is used for tests.

Maven

Clone the repository and execute Maven to build the application:

mvn compile

To compile and run tests also execute:

mvn test

(That will be enough to know for the current exercises. If you are more interested, see this short guide about Maven.)

Gradle

Clone the repository and execute Gradle to build the application:

./gradlew build

To compile and run tests also execute:

./gradlew test

Overview

Structure

The application represents a simple train controller system with the following three components.

  • Sensor: The sensor can detect the change in the speed limit of the track and can signal in such cases to the controller.
  • Controller: The controller is responsible for controlling the reference speed of the train. The reference speed is set by the user, but the speed limit must also be kept.
  • User: The user can manipulate the reference speed of the train using a joystick.

Behavior

Setting the reference speed of the train works in the following way.

  • The user can set the position of a joystick, which can be zero or a positive/negative number.
  • In each time unit, the controller adds the position of the joystick to the current reference speed. Therefore the reference speed does not change if the position is zero, it is incremented if the position is positive and it is decremented if the position is negative.
  • After each change, the speed limit is checked and enforced.

The figure below illustrates this behavior using an example.

speed example

  1. First, the reference speed and the joystick is both at zero.
  2. At the first time unit, the joystick is set to a positive value, thus the reference speed is also incremented.
  3. As the joystick remains at a positive value, the reference speed is incremented again.
  4. However, it reaches the speed limit so in the next step it is not incremented even though the joystick still has a positive value.
  5. Later, the joystick is set to a negative position for one time unit, making the reference speed to decrease as well.

About

Sample application for the Systems Engineering Laboratory. Do not clone this repository - use the fork provided by the lab instructors.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%