Class TrafficLightGroupUnit
java.lang.Object
org.eclipse.mosaic.fed.application.ambassador.simulation.AbstractSimulationUnit
org.eclipse.mosaic.fed.application.ambassador.simulation.TrafficLightGroupUnit
- All Implemented Interfaces:
- CommunicationModuleOwner,- AdHocCommunicative,- CellCommunicative,- Locatable,- OperatingSystem,- TrafficLightOperatingSystem,- EventProcessor
public class TrafficLightGroupUnit
extends AbstractSimulationUnit
implements TrafficLightOperatingSystem
Simulation unit that represents a traffic light group.
- 
Constructor SummaryConstructorsConstructorDescriptionTrafficLightGroupUnit(String simulationUnitId, GeoPoint trafficLightPosition, TrafficLightGroup trafficLightGroup) Creates a new traffic light group simulation unit.
- 
Method SummaryModifier and TypeMethodDescriptionassembleCamMessage(CamBuilder camBuilder) Assembles aCamBuilder(Cooperative Awareness Message) using the givenMessageRoutingand the units' status information.Returns all traffic light programs that are registered for a traffic light group using this operating system.Returns all traffic lights a traffic light group using this operating system.Returns a collection of incoming lanes controlled by this traffic light group.Returns the traffic light program phase that is currently running on a traffic light group using this operating system.Returns the traffic light program that is currently running on a traffic light group using this operating system.This data element provides an absolute geographical longitude and latitude in a WGS84 coordinate system.This data element provides an absolute geographical longitude and latitude in a WGS84 coordinate system.getSignalSequence(String trafficLightProgramId, int trafficLightId) Returns a sequence of states for a certain traffic light, where each state represents a state of the traffic light during a phase within a traffic light program.Getter for the traffic light group.voidprocessEvent(Event event) Processes the given event.voidsetRemainingDurationOfCurrentPhase(long remainingDuration) Set the remaining duration of the current traffic light program phase of this traffic light group.voidswitchToCustomState(List<TrafficLightState> stateList) Switches all traffic lights which belong to this group to the given state.voidswitchToPhaseIndex(int newPhaseId) Switches the phase in the current traffic light program to the phase with the given id.voidswitchToProgram(String newProgramId) Sets a new traffic light program, identified by the givennewProgramId, to this traffic light group.voidswitchToProgramAndPhase(String newProgramId, int phaseId) Sets a new traffic light program with the given id to this traffic light group and also sets the wanted phase for the new program.Methods inherited from class org.eclipse.mosaic.fed.application.ambassador.simulation.AbstractSimulationUnitgetAdHocModule, getApplications, getApplicationsIterator, getCellModule, getConfigurationPath, getEventManager, getGroup, getId, getOsLog, getSimulationTime, loadApplications, preProcessEvent, processSumoTraciMessage, sendInteractionToRti, sendItefLogTuple, sendSumoTraciRequest, setGroup, setUp, tearDown, triggerOnSendMessageMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.mosaic.fed.application.app.api.os.modules.AdHocCommunicativegetAdHocModuleMethods inherited from interface org.eclipse.mosaic.fed.application.app.api.os.modules.CellCommunicativegetCellModuleMethods inherited from interface org.eclipse.mosaic.lib.util.scheduling.EventProcessorcanProcessEventMethods inherited from interface org.eclipse.mosaic.fed.application.app.api.os.OperatingSystemgetApplications, getApplicationsIterator, getConfigurationPath, getEventManager, getGroup, getId, getSimulationTime, getSimulationTimeMs, sendInteractionToRti, sendItefLogTuple, sendSumoTraciRequest
- 
Constructor Details- 
TrafficLightGroupUnitpublic TrafficLightGroupUnit(String simulationUnitId, GeoPoint trafficLightPosition, TrafficLightGroup trafficLightGroup) Creates a new traffic light group simulation unit.- Parameters:
- simulationUnitId- internal traffic light group identifier
- trafficLightPosition- traffic light position
- trafficLightGroup- traffic light group identifier
 
 
- 
- 
Method Details- 
getPositionDescription copied from interface:LocatableThis data element provides an absolute geographical longitude and latitude in a WGS84 coordinate system.- Specified by:
- getPositionin interface- Locatable
- Returns:
- the position.
 
- 
getInitialPositionDescription copied from interface:LocatableThis data element provides an absolute geographical longitude and latitude in a WGS84 coordinate system.- Specified by:
- getInitialPositionin interface- Locatable
- Overrides:
- getInitialPositionin class- AbstractSimulationUnit
- Returns:
- the position.
 
- 
processEventDescription copied from interface:EventProcessorProcesses the given event.- Specified by:
- processEventin interface- EventProcessor
- Parameters:
- event- the event to process
- Throws:
- Exception
 
- 
setRemainingDurationOfCurrentPhasepublic void setRemainingDurationOfCurrentPhase(long remainingDuration) Description copied from interface:TrafficLightOperatingSystemSet the remaining duration of the current traffic light program phase of this traffic light group. Please consider only using numbers that fulfill the condition >= 0 to avoid unwanted changes. Negative numbers usage will affect the next phase so that the absolute value of the given negative number will be subtracted from the remaining duration of the next phase.- Specified by:
- setRemainingDurationOfCurrentPhasein interface- TrafficLightOperatingSystem
- Parameters:
- remainingDuration- the new phase remaining duration in millisecond
 
- 
switchToPhaseIndexpublic void switchToPhaseIndex(int newPhaseId) Description copied from interface:TrafficLightOperatingSystemSwitches the phase in the current traffic light program to the phase with the given id. Remaining phase duration will be reset.- Specified by:
- switchToPhaseIndexin interface- TrafficLightOperatingSystem
- Parameters:
- newPhaseId- id of the phase it will be switched to
 
- 
switchToCustomStateDescription copied from interface:TrafficLightOperatingSystemSwitches all traffic lights which belong to this group to the given state. The states will be held until switched to another list of states, or to another program or phase index.- Specified by:
- switchToCustomStatein interface- TrafficLightOperatingSystem
- Parameters:
- stateList- the list of states to set (one state for each traffic light in the correct order)
 
- 
switchToProgramDescription copied from interface:TrafficLightOperatingSystemSets a new traffic light program, identified by the givennewProgramId, to this traffic light group. Important: when interacting with SUMO one should consider that after changing a program the new program will NOT begin from its first phase, but from the time at which the previous program was interrupted (and from the according phase). Consider using theTrafficLightOperatingSystem.switchToProgramAndPhase(String newProgramId, int phaseId)method to avoid this effect. Therefore changing the program to the same program doesn't change anything.- Specified by:
- switchToProgramin interface- TrafficLightOperatingSystem
- Parameters:
- newProgramId- Id of the new traffic light program.
 
- 
switchToProgramAndPhaseDescription copied from interface:TrafficLightOperatingSystemSets a new traffic light program with the given id to this traffic light group and also sets the wanted phase for the new program. Important: Internal this is made with *two* TraCI commands because it's not possible to do it in one step while interacting with SUMO.- Specified by:
- switchToProgramAndPhasein interface- TrafficLightOperatingSystem
- Parameters:
- newProgramId- Id of the new traffic light program
- phaseId- the index of the phase to switch to
 
- 
getSignalSequencepublic Collection<TrafficLightState> getSignalSequence(String trafficLightProgramId, int trafficLightId) Description copied from interface:TrafficLightOperatingSystemReturns a sequence of states for a certain traffic light, where each state represents a state of the traffic light during a phase within a traffic light program. If there is no program with given id, a sequence of states for the current program is returned.- Specified by:
- getSignalSequencein interface- TrafficLightOperatingSystem
- Parameters:
- trafficLightProgramId- id of the traffic light program to look into
- trafficLightId- id of a traffic light
- Returns:
- a sequence of states for a certain traffic light within a traffic light program with given id or a sequence of states for the current program.
 
- 
getControlledLanesDescription copied from interface:TrafficLightOperatingSystemReturns a collection of incoming lanes controlled by this traffic light group.- Specified by:
- getControlledLanesin interface- TrafficLightOperatingSystem
- Returns:
- controlled lanes
 
- 
getTrafficLightGroupDescription copied from interface:TrafficLightOperatingSystemGetter for the traffic light group.- Specified by:
- getTrafficLightGroupin interface- TrafficLightOperatingSystem
- Returns:
- Traffic light group
 
- 
getAllProgramsDescription copied from interface:TrafficLightOperatingSystemReturns all traffic light programs that are registered for a traffic light group using this operating system.- Specified by:
- getAllProgramsin interface- TrafficLightOperatingSystem
- Returns:
- all traffic light programs that are registered for a traffic light group
 
- 
getCurrentProgramDescription copied from interface:TrafficLightOperatingSystemReturns the traffic light program that is currently running on a traffic light group using this operating system.- Specified by:
- getCurrentProgramin interface- TrafficLightOperatingSystem
- Returns:
- the current traffic light program
 
- 
getCurrentPhaseDescription copied from interface:TrafficLightOperatingSystemReturns the traffic light program phase that is currently running on a traffic light group using this operating system.- Specified by:
- getCurrentPhasein interface- TrafficLightOperatingSystem
- Returns:
- the current traffic light program phase
 
- 
getAllTrafficLightsDescription copied from interface:TrafficLightOperatingSystemReturns all traffic lights a traffic light group using this operating system.- Specified by:
- getAllTrafficLightsin interface- TrafficLightOperatingSystem
- Returns:
- all traffic lights within a traffic light group
 
- 
assembleCamMessageDescription copied from interface:CommunicationModuleOwnerAssembles aCamBuilder(Cooperative Awareness Message) using the givenMessageRoutingand the units' status information.- Specified by:
- assembleCamMessagein interface- CommunicationModuleOwner
- Parameters:
- camBuilder- the routing for the- Cam
- Returns:
- the assembled Cam, which can be sent
 
 
-