TrafficLight

Package: simu5g.mobility.trafficLightMobility

TrafficLight

compound module

This 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.

mobility : StationaryMobility

This mobility module does nothing; it can be used for stationary nodes.

Source:
mobility: StationaryMobility {
    parameters:
        @display("p=142,52;is=s");
} trafficLightController : TrafficLightController

This module defines the behavior of traffic light controllers in the simulation.

Source:
trafficLightController: TrafficLightController {
    parameters:
        @display("p=48,52;is=s");
        mobilityModule = default("^.mobility");
        bidirectional = parent.bidirectional;
}

Usage diagram

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Parameters

Name Type Default value Description
bidirectional bool false

Properties

Name Value Description
display i=misc/node2_s;bgb=200,100

Unassigned submodule parameters

Name Type Default value Description
mobility.subjectModule string "^"

module path which determines the subject module, the motion of which this mobility model describes, the default value is the parent module

mobility.coordinateSystemModule string ""

module path of the geographic coordinate system module

mobility.displayStringTextFormat string "p: %p\nv: %v"

format string for the mobility module's display string text

mobility.updateDisplayString bool true

enables continuous update of the subject module's position via modifying its display string

mobility.constraintAreaMinX double -inf m

min x position of the constraint area, unconstrained by default (negative infinity)

mobility.constraintAreaMinY double -inf m

min y position of the constraint area, unconstrained by default (negative infinity)

mobility.constraintAreaMinZ double -inf m

min z position of the constraint area, unconstrained by default (negative infinity)

mobility.constraintAreaMaxX double inf m

max x position of the constraint area, unconstrained by default (positive infinity)

mobility.constraintAreaMaxY double inf m

max y position of the constraint area, unconstrained by default (positive infinity)

mobility.constraintAreaMaxZ double inf m

max z position of the constraint area, unconstrained by default (positive infinity)

mobility.initialX double uniform(this.constraintAreaMinX, this.constraintAreaMaxX)
mobility.initialY double uniform(this.constraintAreaMinY, this.constraintAreaMaxY)
mobility.initialZ double nanToZero(uniform(this.constraintAreaMinZ, this.constraintAreaMaxZ))
mobility.initialLatitude double nan deg
mobility.initialLongitude double nan deg
mobility.initialAltitude double 0m
mobility.initialHeading double 0deg
mobility.initialElevation double 0deg
mobility.initialBank double 0deg
mobility.initFromDisplayString bool true

enables one time initialization from the subject module's display string

mobility.updateFromDisplayString bool true

enables continuous update from the subject module's display string for dragging and rotating it

trafficLightController.mobilityModule string "^.mobility"
trafficLightController.greenPeriod double 1s
trafficLightController.yellowPeriod double 1s
trafficLightController.redPeriod double 1s
trafficLightController.startTime double 1s
trafficLightController.startState int 3

do not use 0 or 2, for now!

trafficLightController.meanCarLength double 4m
trafficLightController.areaWidth double 1m

Source code

//
// This 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.
//
module TrafficLight
{
    parameters:
        @display("i=misc/node2_s;bgb=200,100");
        bool bidirectional = default(false);

    submodules:
        mobility: StationaryMobility {
            parameters:
                @display("p=142,52;is=s");
        }
        trafficLightController: TrafficLightController {
            parameters:
                @display("p=48,52;is=s");
                mobilityModule = default("^.mobility");
                bidirectional = parent.bidirectional;
        }
}
File: src/mobility/trafficLightMobility/TrafficLight.ned