Exemple #1
0
        /// <summary>
        /// Inserts the information about the effort of the named edge valid from begin time to end time into the global edge weights container.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="effortValue"></param>
        /// <returns></returns>
        public TraCIResponse <object> SetEffort(string id, double beginTime, double endTime, double effortValue)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIDouble()
            {
                Value = beginTime
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = endTime
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = effortValue
            });

            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_EDGE_VARIABLE,
                       TraCIConstants.VAR_EDGE_EFFORT,
                       tmp
                       ));
        }
Exemple #2
0
        /// <summary>
        /// Adds the defined Polygon
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="color"></param>
        /// <param name="filled"></param>
        /// <param name="layer"></param>
        /// <param name="shape"></param>
        /// <returns></returns>
        public TraCIResponse <object> Add(string id, string name, Color color, bool filled, int layer, Polygon shape)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIString()
            {
                Value = name
            });
            tmp.Value.Add(color);
            tmp.Value.Add(new TraCIUByte()
            {
                Value = filled == false ? (byte)0: (byte)1
            });
            tmp.Value.Add(new TraCIInteger()
            {
                Value = layer
            });
            tmp.Value.Add(shape);

            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_POLYGON_VARIABLE,
                       TraCIConstants.ADD,
                       tmp
                       ));
        }
Exemple #3
0
        // TODO: 'extended retrieval', see: http://sumo.dlr.de/wiki/TraCI/Edge_Value_Retrieval


        /// <summary>
        /// Inserts the information about the travel time of the named edge valid from begin time to end time into the global edge weights times container.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="travelTimeValue"></param>
        /// <returns></returns>
        public TraCIResponse <double> AdaptTraveltime(string id, int beginTime, int endTime, double travelTimeValue)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIInteger()
            {
                Value = beginTime
            });
            tmp.Value.Add(new TraCIInteger()
            {
                Value = endTime
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = travelTimeValue
            });

            return(TraCICommandHelper.ExecuteSetCommand <double, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_EDGE_VARIABLE,
                       TraCIConstants.VAR_EDGE_TRAVELTIME,
                       tmp
                       ));
        }
Exemple #4
0
        /// <summary>
        ///     Appends a stage walking to the plan of the given person.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="edges"></param>
        /// <param name="arrivalPosition"></param>
        /// <param name="duration"></param>
        /// <param name="speed"></param>
        /// <param name="stopId"></param>
        /// <returns></returns>
        public TraCIResponse <object> AppendWalkingStage(string id, List <string> edges, double arrivalPosition, int duration, double speed, string stopId)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIInteger()
            {
                Value = 2
            });
            tmp.Value.Add(new TraCIStringList()
            {
                Value = edges
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = arrivalPosition
            });
            tmp.Value.Add(new TraCIString()
            {
                Value = stopId
            });
            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_PERSON_VARIABLE,
                       TraCIConstants.APPEND_STAGE,
                       tmp
                       ));
        }
Exemple #5
0
        /// <summary>
        ///     Appends a stage waiting to the plan of the given person.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="duration"></param>
        /// <param name="description"></param>
        /// <param name="stopId"></param>
        /// <returns></returns>
        public TraCIResponse <object> AppendWaitingStage(string id, int duration, string description, string stopId)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIInteger()
            {
                Value = 1
            });
            tmp.Value.Add(new TraCIInteger()
            {
                Value = duration
            });
            tmp.Value.Add(new TraCIString()
            {
                Value = description
            });
            tmp.Value.Add(new TraCIString()
            {
                Value = stopId
            });
            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_PERSON_VARIABLE,
                       TraCIConstants.APPEND_STAGE,
                       tmp
                       ));
        }
Exemple #6
0
        // TODO: 'extended retrieval', see: http://sumo.dlr.de/wiki/TraCI/Person_Value_Retrieval

        /// <summary>
        ///     Inserts a new person to the simulation at the given edge, position and time (in s). This function should be followed by appending Stages or the person will immediately vanish on departure.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="typeId"></param>
        /// <param name="initialEdgeId"></param>
        /// <param name="departTime"></param>
        /// <param name="departPosition"></param>
        /// <returns></returns>
        public TraCIResponse <object> Add(string id, string typeId, string initialEdgeId, double departTime, double departPosition)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIString()
            {
                Value = typeId
            });
            tmp.Value.Add(new TraCIString()
            {
                Value = initialEdgeId
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = departTime
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = departPosition
            });

            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_PERSON_VARIABLE,
                       TraCIConstants.ADD,
                       tmp
                       ));
        }
Exemple #7
0
 /// <summary>
 /// Sets a new maximum allowed speed on the lane in m/s.
 /// </summary>
 public void SetMaxSpeed(string laneId, double maxSpeed)
 {
     TraCICommandHelper.ExecuteSetCommand <object, double>(
         Client,
         laneId,
         TraCIConstants.CMD_SET_LANE_VARIABLE,
         TraCIConstants.VAR_MAXSPEED,
         maxSpeed);
 }
Exemple #8
0
 /// <summary>
 /// Sets the length of the lane in m
 /// </summary>
 public void SetLength(string laneId, double length)
 {
     TraCICommandHelper.ExecuteSetCommand <object, double>(
         Client,
         laneId,
         TraCIConstants.CMD_SET_LANE_VARIABLE,
         TraCIConstants.VAR_LENGTH,
         length);
 }
Exemple #9
0
 /// <summary>
 /// Sets a list of allowed vehicle classes.
 /// </summary>
 public void SetAllowed(string laneId, List <string> allowedVehicleClasses)
 {
     TraCICommandHelper.ExecuteSetCommand <object, List <string> >(
         Client,
         laneId,
         TraCIConstants.CMD_SET_LANE_VARIABLE,
         TraCIConstants.LANE_ALLOWED,
         allowedVehicleClasses);
 }
Exemple #10
0
 public void SetDuration(string id, int phaseDuration)
 {
     TraCICommandHelper.ExecuteSetCommand <object, int>(
         Client,
         id,
         TraCIConstants.CMD_SET_TL_VARIABLE,
         TraCIConstants.TL_PHASE_DURATION,
         phaseDuration);
 }
Exemple #11
0
 public void SetPhase(string id, int phaseIndex)
 {
     TraCICommandHelper.ExecuteSetCommand <object, int>(
         Client,
         id,
         TraCIConstants.CMD_SET_TL_VARIABLE,
         TraCIConstants.TL_PHASE_INDEX,
         phaseIndex);
 }
Exemple #12
0
 /// <summary>
 /// Sets the phase of the traffic light to the given. The given index must be valid for the current
 /// program of the traffic light, this means it must be between 0 and the number of phases known to
 /// the current program of the tls - 1.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="phaseIndex"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetPhase(string id, int phaseIndex)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, int>(
                Client,
                id,
                TraCIConstants.CMD_SET_TL_VARIABLE,
                TraCIConstants.TL_PHASE_INDEX,
                phaseIndex));
 }
Exemple #13
0
 /// <summary>
 /// Sets a new maximum allowed speed on the lane in m/s.
 /// </summary>
 public TraCIResponse <object> SetMaxSpeed(string laneId, double maxSpeed)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, double>(
                Client,
                laneId,
                TraCIConstants.CMD_SET_LANE_VARIABLE,
                TraCIConstants.VAR_MAXSPEED,
                maxSpeed));
 }
Exemple #14
0
 public void SetRedYellowGreenState(string id, string state)
 {
     TraCICommandHelper.ExecuteSetCommand <object, string>(
         Client,
         id,
         TraCIConstants.CMD_SET_TL_VARIABLE,
         TraCIConstants.TL_RED_YELLOW_GREEN_STATE,
         state);
 }
Exemple #15
0
 /// <summary>
 /// Sets a list of disallowed vehicle classes.
 /// </summary>
 public TraCIResponse <object> SetDisallowed(string laneId, List <string> disallowedVehicleClasses)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, List <string> >(
                Client,
                laneId,
                TraCIConstants.CMD_SET_LANE_VARIABLE,
                TraCIConstants.LANE_DISALLOWED,
                disallowedVehicleClasses));
 }
Exemple #16
0
 /// <summary>
 /// Sets the length of the lane in m
 /// </summary>
 public TraCIResponse <object> SetLength(string laneId, double length)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, double>(
                Client,
                laneId,
                TraCIConstants.CMD_SET_LANE_VARIABLE,
                TraCIConstants.VAR_LENGTH,
                length));
 }
Exemple #17
0
 /// <summary>
 /// Switches the traffic light to the given program. No WAUT algorithm is used, the program is
 /// directly instantiated. The index of the traffic light stays the same as before.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="program"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetProgram(string id, string program)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, string>(
                Client,
                id,
                TraCIConstants.CMD_SET_TL_VARIABLE,
                TraCIConstants.TL_PROGRAM,
                program));
 }
Exemple #18
0
 /// <summary>
 /// Sets the remaining duration of the current phase in seconds.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="phaseDuration"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetPhaseDuration(string id, double phaseDuration)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, double>(
                Client,
                id,
                TraCIConstants.CMD_SET_TL_VARIABLE,
                TraCIConstants.TL_PHASE_DURATION,
                phaseDuration));
 }
Exemple #19
0
 public void SetProgram(string id, string program)
 {
     TraCICommandHelper.ExecuteSetCommand <object, string>(
         Client,
         id,
         TraCIConstants.CMD_SET_TL_VARIABLE,
         TraCIConstants.TL_PROGRAM,
         program);
 }
Exemple #20
0
 /// <summary>
 /// Removes the defined Polygon
 /// </summary>
 /// <param name="id"></param>
 /// <param name="layer"></param>
 /// <returns></returns>
 public TraCIResponse <object> Remove(string id, int layer)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, int>(
                Client,
                id,
                TraCIConstants.CMD_SET_POLYGON_VARIABLE,
                TraCIConstants.REMOVE,
                layer
                ));
 }
 /// <summary>
 /// Save a screenshot to the given file
 /// </summary>
 /// <param name="id"></param>
 /// <param name="filename"></param>
 /// <returns></returns>
 public TraCIResponse <object> Screenshot(string id, string filename)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, string>(
                Client,
                id,
                TraCIConstants.CMD_SET_GUI_VARIABLE,
                TraCIConstants.VAR_SCREENSHOT,
                filename
                ));
 }
Exemple #22
0
 /// <summary>
 /// Marks that the polygon shall be filled if the value is !=0.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="filled"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetFilled(string id, byte filled)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, byte>(
                Client,
                id,
                TraCIConstants.CMD_SET_POLYGON_VARIABLE,
                TraCIConstants.VAR_FILL,
                filled
                ));
 }
 /// <summary>
 /// Moves the center of the visible network to the given position
 /// </summary>
 /// <param name="id"></param>
 /// <param name="position"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetOffset(string id, Position2D position)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, Position2D>(
                Client,
                id,
                TraCIConstants.CMD_SET_GUI_VARIABLE,
                TraCIConstants.VAR_VIEW_OFFSET,
                position
                ));
 }
Exemple #24
0
 /// <summary>
 /// Sets the polygon's shape to the given value
 /// </summary>
 /// <param name="id"></param>
 /// <param name="polygon"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetShape(string id, Polygon polygon)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, Polygon>(
                Client,
                id,
                TraCIConstants.CMD_SET_POLYGON_VARIABLE,
                TraCIConstants.VAR_SHAPE,
                polygon
                ));
 }
 /// <summary>
 /// Sets the visualization scheme (e.g. "standard")
 /// </summary>
 /// <param name="id"></param>
 /// <param name="schema"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetSchema(string id, string schema)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, string>(
                Client,
                id,
                TraCIConstants.CMD_SET_GUI_VARIABLE,
                TraCIConstants.VAR_VIEW_SCHEMA,
                schema
                ));
 }
Exemple #26
0
 /// <summary>
 /// Sets the polygon's type to the given value
 /// </summary>
 /// <param name="id"></param>
 /// <param name="typeId"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetType(string id, string typeId)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, string>(
                Client,
                id,
                TraCIConstants.CMD_SET_POLYGON_VARIABLE,
                TraCIConstants.VAR_TYPE,
                typeId
                ));
 }
 /// <summary>
 ///     Sets the current zoom level in %
 /// </summary>
 /// <param name="id"></param>
 /// <param name="zoom"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetZoom(string id, double zoom)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, double>(
                Client,
                id,
                TraCIConstants.CMD_SET_GUI_VARIABLE,
                TraCIConstants.VAR_VIEW_ZOOM,
                zoom
                ));
 }
 /// <summary>
 /// tracks the given vehicle in the GUI
 /// </summary>
 /// <param name="id"></param>
 /// <param name="vehicleId"></param>
 /// <returns></returns>
 public TraCIResponse <object> TrackVehicle(string id, string vehicleId)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, string>(
                Client,
                id,
                TraCIConstants.CMD_SET_GUI_VARIABLE,
                TraCIConstants.VAR_TRACK_VEHICLE,
                vehicleId
                ));
 }
Exemple #29
0
 /// <summary>
 /// Sets the polygon's color to the given value
 /// </summary>
 /// <param name="id"></param>
 /// <param name="color"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetColor(string id, Color color)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, Color>(
                Client,
                id,
                TraCIConstants.CMD_SET_POLYGON_VARIABLE,
                TraCIConstants.VAR_COLOR,
                color
                ));
 }
 /// <summary>
 /// Moves the center of the visible network to the given position
 /// </summary>
 /// <param name="id"></param>
 /// <param name="boundaryBox"></param>
 /// <returns></returns>
 public TraCIResponse <object> SetBoundary(string id, Polygon boundaryBox)
 {
     return(TraCICommandHelper.ExecuteSetCommand <object, Polygon>(
                Client,
                id,
                TraCIConstants.CMD_SET_GUI_VARIABLE,
                TraCIConstants.VAR_VIEW_BOUNDARY,
                boundaryBox
                ));
 }