#control-system #traffic #coordinates #module #model #dhbw

tcs-dhbw

Modules for a model traffic control system project at DHBW Stuttgart

7 releases (1 stable)

Uses old Rust 2015

1.0.0 May 4, 2023
0.1.5 Apr 23, 2023

#194 in Simulation

Download history 20/week @ 2024-07-29 15/week @ 2024-09-23 4/week @ 2024-09-30

76 downloads per month

MIT license

12KB
221 lines

Verkehrsleitsystem DHBW Verteilte Systeme

This is a Rust project that simulates a simple traffic control system. It consists of several modules that represent different aspects of the system, such as coordinates, traffic areas, and the logic for controlling the traffic.

Modules

Coordinates

This module defines the Coordinate struct, which represents a pair of 'x' and 'y' coordinates. It provides methods for creating a new coordinate, getting the 'x' and 'y' values, and implementing the 'Clone', 'Debug', and 'Default' traits.

Movement Not Possible

This module defines the 'MovementNotPossible' struct, which represents an error that occurs when a movement is not possible. It provides a method for creating a new error message and implements the 'Debug', 'Display', and 'Error' traits.

Traffic Area

This module defines the 'TrafficArea' struct, which represents a two-dimensional area of traffic nodes. It provides methods for creating a new traffic area, placing and removing clients at specific coordinates, getting the position of a client, checking if a position is free, and clearing the entire area. It also implements the 'Debug', 'Display', and 'Clone' traits.

Traffic Control Logic

This module defines the 'TrafficControlLogic' struct, which represents the logic for controlling the traffic. It provides methods for starting a new client, moving a client to a specific coordinate, and calculating the distance between two coordinates. It requires a 'TrafficArea' object to function properly.

Usage

To use this project, you can add it as a dependency in your Rust project's Cargo.toml file:

[dependencies]
tcs-dhbw = "1.0.0"

Then, you can import the modules you need in your Rust code:

use tcs_dhbw::coordinates::Coordinate;
use tcs_dhbw::traffic_area::TrafficArea;
use tcs_dhbw::traffic_control_logic::TrafficControlLogic;

License

This project is licensed under the MIT license. See the LICENSE file for more information.

No runtime deps