C# Class TrafficManager.TrafficLight.TimedTrafficLightsStep

Inheritance: ICloneable
Show file Open project: Katalyst6/CSL.TransitAddonMod Class Usage Examples

Public Properties

Property Type Description
lastFlowWaitCalc uint
maxTime int
maxWait float
minFlow float
minTime int
segmentLights CustomSegmentLights>.Dictionary
startFrame uint
waitFlowBalance float

Public Methods

Method Description
Clone ( ) : object
GetLight ( ushort segmentId, ExtVehicleType vehicleType, int lightType ) : RoadBaseAI.TrafficLightState
MaxTimeRemaining ( ) : long

Countdown value for max. time

MinTimeRemaining ( ) : long

Countdown value for min. time

SetLights ( ) : void

Updates "real-world" traffic light states according to the timed scripts

SetLights ( bool noTransition ) : void
SetStepDone ( ) : void
Start ( ) : void

Starts the step.

StepDone ( bool updateValues ) : bool
TimedTrafficLightsStep ( TimedTrafficLights timedNode, int minTime, int maxTime, float waitFlowBalance, List groupNodeIds, bool makeRed = false ) : System
UpdateLights ( ) : void

Updates timed segment lights according to "real-world" traffic light states

calcWaitFlow ( float &wait, float &flow ) : bool

Calculates the current metrics for flowing and waiting vehicles

isValid ( ) : bool

Private Methods

Method Description
ChangeLightMode ( ushort segmentId, ExtVehicleType vehicleType, CustomSegmentLight mode ) : void
addSegment ( ushort segmentId, bool makeRed ) : void

Adds a new segment to this step. After adding all steps the method `rebuildSegmentIds` must be called.

calcLightState ( RoadBaseAI previousState, RoadBaseAI currentState, RoadBaseAI nextState, bool atStartTransition, bool atEndTransition ) : RoadBaseAI.TrafficLightState
calcMaxSegmentLength ( ) : void
getCurrentFrame ( ) : uint
isEndTransitionDone ( ) : bool

Checks if the green-to-red (=yellow) phase is finished

isInEndTransition ( ) : bool

Checks if the green-to-red (=yellow) phase is currently active

isInStartTransition ( ) : bool

Method Details

Clone() public method

public Clone ( ) : object
return object

GetLight() public method

public GetLight ( ushort segmentId, ExtVehicleType vehicleType, int lightType ) : RoadBaseAI.TrafficLightState
segmentId ushort
vehicleType ExtVehicleType
lightType int
return RoadBaseAI.TrafficLightState

MaxTimeRemaining() public method

Countdown value for max. time
public MaxTimeRemaining ( ) : long
return long

MinTimeRemaining() public method

Countdown value for min. time
public MinTimeRemaining ( ) : long
return long

SetLights() public method

Updates "real-world" traffic light states according to the timed scripts
public SetLights ( ) : void
return void

SetLights() public method

public SetLights ( bool noTransition ) : void
noTransition bool
return void

SetStepDone() public method

public SetStepDone ( ) : void
return void

Start() public method

Starts the step.
public Start ( ) : void
return void

StepDone() public method

public StepDone ( bool updateValues ) : bool
updateValues bool
return bool

TimedTrafficLightsStep() public method

public TimedTrafficLightsStep ( TimedTrafficLights timedNode, int minTime, int maxTime, float waitFlowBalance, List groupNodeIds, bool makeRed = false ) : System
timedNode TimedTrafficLights
minTime int
maxTime int
waitFlowBalance float
groupNodeIds List
makeRed bool
return System

UpdateLights() public method

Updates timed segment lights according to "real-world" traffic light states
public UpdateLights ( ) : void
return void

calcWaitFlow() public method

Calculates the current metrics for flowing and waiting vehicles
public calcWaitFlow ( float &wait, float &flow ) : bool
wait float
flow float
return bool

isValid() public method

public isValid ( ) : bool
return bool

Property Details

lastFlowWaitCalc public property

public uint lastFlowWaitCalc
return uint

maxTime public property

The number of time units this traffic light remains in the current state at most
public int maxTime
return int

maxWait public property

maximum mean "number of cars waiting for green" / "average segment length"
public float maxWait
return float

minFlow public property

minimum mean "number of cars passing through" / "average segment length"
public float minFlow
return float

minTime public property

The number of time units this traffic light remains in the current state at least
public int minTime
return int

segmentLights public property

public Dictionary segmentLights
return CustomSegmentLights>.Dictionary

startFrame public property

public uint startFrame
return uint

waitFlowBalance public property

public float waitFlowBalance
return float