tcs-dhbw

Crates.iotcs-dhbw
lib.rstcs-dhbw
version1.0.0
sourcesrc
created_at2023-04-21 12:37:18.145254
updated_at2023-05-04 20:29:40.169592
descriptionModules for a model traffic control system project at DHBW Stuttgart
homepage
repositoryhttps://github.com/AnyCubical/vls
max_upload_size
id845279
size12,737
(AnyCubical)

documentation

README

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.

Commit count: 11

cargo fmt