Ejemplo n.º 1
0
 /// <summary>
 /// sets the posion property by retrieving value from Sumo
 /// </summary>
 private void SetPosition()
 {
     try
     {
         TraciVariableAction loopResponse = new TraciVariableAction(_connection,
                                                                    TraciConstants.Command.CMD_GET_INDUCTIONLOOP_VARIABLE,
                                                                    TraciConstants.Variable.VAR_POSITION, InductionLoopID);
         Position = loopResponse.DoubleResponse;
     }
     catch (Exception ex)
     {
         throw new SumoControllerException("Error retrieving Induction loop position", ex);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Intialises class and retrieves list of traffic lights from Sumo
 /// </summary>
 /// <param name="connection">the Sumo/Traci connection</param>
 public TraciGetTrafficLights(Connection connection)
 {
     try
     {
         TraciVariableAction loopResponse = new TraciVariableAction(connection,
                                                                    TraciConstants.Command.CMD_GET_TL_VARIABLE,
                                                                    TraciConstants.Variable.ID_LIST, "GetTrafficLights");
         IDList = loopResponse.StringListResponse;
     }
     catch (Exception ex)
     {
         throw new SumoControllerException("Error retrieving list of traffic lights", ex);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Sets property by retrieving list of induction loops from Sumo
 /// </summary>
 private void SetIdList()
 {
     try
     {
         TraciVariableAction loopResponse = new TraciVariableAction(_connection,
                                                                    TraciConstants.Command.CMD_GET_INDUCTIONLOOP_VARIABLE,
                                                                    TraciConstants.Variable.ID_LIST,
                                                                    InductionLoopID);
         IDList = loopResponse.StringListResponse;
     }
     catch (Exception ex)
     {
         throw new SumoControllerException("Error retrieving list of induction loops", ex);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the vehicle IDs that have passed into detector by retrieving from sumo
 /// </summary>
 private void SetLastStepVehicleIds()
 {
     try
     {
         TraciVariableAction loopResponse = new TraciVariableAction(_connection,
                                                                    TraciConstants.Command.CMD_GET_INDUCTIONLOOP_VARIABLE,
                                                                    TraciConstants.Variable.LAST_STEP_VEHICLE_ID_LIST,
                                                                    InductionLoopID);
         _lastStepVehicleIds = loopResponse.StringListResponse;
     }
     catch (Exception ex)
     {
         throw new SumoControllerException("Error retrieving vehicle IDS that have passed into detector", ex);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Intialises class and retrieves list of traffic light's lanes from Sumo
 /// </summary>
 /// <param name="connection">the Sumo/Traci connection</param>
 public TraciGetTraficLightLanes(Connection connection, string lightName)
 {
     try
     {
         TraciVariableAction loopResponse = new TraciVariableAction(connection,
                                                                    TraciConstants.Command.CMD_GET_TL_VARIABLE,
                                                                    TraciConstants.Variable.TL_CONTROLLED_LANES,
                                                                    lightName);
         LaneList = loopResponse.StringListResponse;
     }
     catch (Exception ex)
     {
         throw new SumoControllerException("Error retrieving list of traffic light lanes", ex);
     }
 }
 /// <summary>
 /// Intialises class and retrieves list of traffic light's state from Sumo
 /// </summary>
 /// <param name="connection">the Sumo/Traci connection</param>
 public TraciGetTrafficLightState(Connection connection, string lightName)
 {
     try
     {
         TraciVariableAction loopResponse = new TraciVariableAction(connection,
                                                                    TraciConstants.Command.CMD_GET_TL_VARIABLE,
                                                                    TraciConstants.Variable.TL_RED_YELLOW_GREEN_STATE,
                                                                    lightName);
         State = loopResponse.StringResponse;
     }
     catch (Exception ex)
     {
         throw new SumoControllerException("Error retrieving traffic light state", ex);
     }
 }