TrafficLightController

Package: simu5g.mobility.trafficLightMobility

simple module TrafficLightController

Defines the behavior of traffic light controllers in the simulation. It manages the states of the traffic lights (green, yellow, red) and handles the interactions with vehicles, thus influencing the behavior of a node implementing the TrafficLightMobility mobility model when such a node reaches the position of the traffic light. This module allows for the configuration of the duration of green-yellow-red cycles.

simu5g.mobility.trafficLightMobility.TrafficLightControllerTrafficLightControllersimple

Usage diagram

Used in compound modules

Name

Type

Description

TrafficLight

compound module

Simulates a traffic light in an urban environment. It incorporates a stationary mobility submodule to represent the fixed position of the traffic light, and a TrafficLightController submodule to model the traffic light’s states (green, yellow, red) and its interactions with vehicles.

Parameters

Name

Type

Default value

Description

mobilityModule

string

greenPeriod

double

1s

yellowPeriod

double

1s

redPeriod

double

1s

startTime

double

1s

startState

string

“RED”

Do not use OFF or YELLOW for now

meanCarLength

double

4m

areaWidth

double

1m

bidirectional

bool

false

Properties

Name

Value

Description

class

TrafficLightController

Source code

//
// Defines the behavior of traffic light controllers in the simulation.
// It manages the states of the traffic lights (green, yellow, red) and handles the
// interactions with vehicles, thus influencing the behavior of a node implementing the
// ~TrafficLightMobility mobility model when such a node reaches the position of the
// traffic light. This module allows for the configuration of the duration of
// green-yellow-red cycles.
//
simple TrafficLightController
{
    @class(TrafficLightController);

    string mobilityModule;
    double greenPeriod @unit(s) = default(1s);
    double yellowPeriod @unit(s) = default(1s);
    double redPeriod @unit(s) = default(1s);
    double startTime @unit(s) = default(1s);
    string startState @enum(OFF,GREEN,YELLOW,RED) = default("RED"); // Do not use OFF or YELLOW for now
    double meanCarLength @unit(m) = default(4m);
    double areaWidth @unit(m) = default(1m);
    bool bidirectional = default(false);
}

File: src/simu5g/mobility/trafficLightMobility/TrafficLightController.ned