-
Notifications
You must be signed in to change notification settings - Fork 0
Dokumentation Implementierung
Im Rahmen des Projektes Verkehrssimulation beschreibt diese Dokumentation diverse Funktionen, Parameter und Schnittstellen der bereits gezeigten Klassen in der Dokumentation Softwaredesign. An dieser Stelle sei erwähnt, dass die folgenden Beschreibungen auf Englisch sind, da für die Source-Code Kommentare ebenfalls diese Sprache bevorzugt wurde.
Description:
- Creates the traffic agent task from Task Factory
Parameters:
- none
Return value:
- Standard-System.Threading.Tasks.TaskFactory for the current task
Description:
- Starts the traffic agent task
Parameters:
- none
Return value:
- void
Description:
- Stops the traffic agent task
Parameters:
- none
Return value:
- void
Description:
Query the initial data of the simulation interface.Starts a Stopwatch for the clock, so that there
is the given amount of ticks within a second.Also calls the update method of all traffic light objects and send the
updated objects to the simulation.
Parameters:
- cancelToken: Token which tells the working loop that the program should stop
Return value:
- void
2.1.5 private TrafficLight.LightStatus convertLightStatus(ServiceReference1.TrafficLightStatus status)
Description:
Converts the status of the traffic lights from the interface type into the internal type
Parameters:
- status: light status to be converted (from interface type to internal type)
Return value:
- TrafficLight.LightStatus
2.1.6 private ServiceReference1.TrafficLightStatus convertLightStatus(TrafficLight.LightStatus status)
Description:
Convert the status of the traffic lights from the internal type into the interface type
Parameters:
- status: light status to be converted (from internal type to interface type)
Return value:
- TrafficLight.LightStatus
2.1.7 private TrafficLightGroup.Position convertLightPosition(ServiceReference1.TrafficLightPosition oldPosition)
Description:
Convert the position of the traffic lights from the interface type into the internal type
Parameters:
- oldPosition: light position to be converted (from interface type to internal type)
Return value:
- TrafficLightGroup.Position
Description:
Convert the internal traffic lights into traffic lights of the interface type and PUSH the traffic lights via the
interface to the simulation.
Parameters:
- none
Return value:
- void
Description:
Pulls the traffic lights from the simulation interface and convert them into internal traffic lights
Parameters:
- none
Return value:
- void
Description:
Changes the state from the actual state to the next state
Parameters:
- none
Return value:
- void
Description:
Check if current tick count is big enough to change the state and change the state if necessary. Also updates the
stateChanged reference
Parameters:
- stateChanged: Reference to the value which tells if a traffic light has changed his state
Return value:
- void
Description:
Sets the Offset of a traffic light group, depending on the amount of traffic lights in the group
Parameters:
- none
Return value:
- void
Description:
Sets the Duration of all traffic lights in the group
Parameters:
- none
Return value:
- void
Description:
Calls the update method of all traffic lights in the group
Parameters:
- stateChanged: Reference to the value which tells if at least one traffic light has changed his state
Return value:
- void
Description:
Get the distance squared between two points
Parameters:
- x: first x point
- y: first y point
- x1: second x point
- y1: second y point
Return value:
- double: distance
Description:
Get the distance between two points
Parameters:
- x: first x point
- y: first y point
- x1: second x point
- y1: second y point
Return value:
- double: distance
Description: Class for loading the vehicle - configuration into an setting object defined in App.config
Parameters:
- none
Description: Class for loading the general configuration into an setting object defined in App.config
Parameters:
- none
Description:
Class for loading the traffic control configuration into an setting object defined in App.config
Parameters:
- none
Description:
Helperclass for using a stopwatch with a defined offset
Description:
Method for starting the stopwatch
Parameters:
- none
Return value:
- void
Description:
Method for stopping the stopwatch
Parameters:
- none
Return value:
- void
Description:
Field which contains the elapsed timespan.
Parameters:
- value: setter
Return value:
- Timespan: getter
Description:
Basic Element for the simulation and the GUI
Description:
Enum for the two needed blocktypes: staticBlocks can't move or change their behavior, dynamic blocks do that
Parameters:
- StaticBlock: block that cannot move
- DynamicBlock: block that can move
Return value:
- int
Description:
Basic Class for most of the dynamic blocks, it adds the TmxObject to the dynamic block. This enables the transmission
and usage for the GUI.
Description:
Basic class for most of the dynamic blocks, it defines the minimal Fields which every dynamic block needs
Description:
Basic Class for all roadsigns.
Description:
Implementation of the RoadSign class for the traffic light objects of the simulation and GUI.
Description:
Enum for the different light states. enum numbers equals the GID of the GUI-block
Parameters:
- Red: 12
- Yellow: 13
- Green: 14
- YellowRed: 15
- Off: 16
Return value:
- int
Description:
Method to change the traffic lights state while the traffic control is not available and simulation is in emergency
traffic-control-mode.
Parameters:
- none
Return value:
- void
Description:
Like Crossing Element and adds Coordinates and set Type to staticBlock
Description:
Enum for the directions in which a street block leads
Parameters:
- RightToLeft: 3
- LeftToRight: 4
- TopToBottom: 5
- BottomToTop: 6
- Crossing: 7
Return value:
- int
Description:
Enum for the possible directions in which a crossing element leads
Parameters:
- Left: left diretion
- Right: right diretion
- Straight: straight diretion
- None: no diretion
Return value:
- int
Description:
Enum for the possible vehicle types, values equals the GID of the values
Parameters:
- Car1: 1004
- Car2: 1001
- Truck1: 1000
- Truck2: 1002
- Motorcycle: 1003
Return value:
- int
Description:
Method to run the update/atc method.
Parameters:
- none
Return value:
- void
Description:
helper class for the simulation logic to handle X and Y coordinates and rotation in one class
Description:
Init Method for the Simulator, in here, there are the initial instantiations of some fields and first creation
of the map
Description:
Event handler for the external vehicle receiving.
Parameters:
- sender: Object Sender
- e: VehicleEventArgs
Return value:
- void
Description:
Method to initialize the list of spawning points by checking the streetblocks which leads into the map and are on the
border of the map.
Parameters:
- none
Return value:
- void
Description:
Method to initialize the street map. Filters out all non street Block and creates a map off streetblocks and crossing
blocks. Also add crossing direction to the crossing fields.
Parameters:
- none
Return value:
- void
Description:
Method contains the main loop of the simulation in which the simulation logic includig the call of the block updates
run.
Parameters:
- none
Return value:
- void
Description:
Method to choose a vehicle out of the vehicles to spawn and remove the spawned vehicle from the spawning list.
Parameters:
- spawningList: List of integer which contains the GID of the vehicles to spawn
Return value:
- void
Description:
Method to create a new vehicle at a random spawning point and add the vehicle to the dynamicObject List.
Parameters:
- tempGID: GID of the vehicle to spawn
Return value:
- void
3.9.9 public List<List> getMapInfo(double vehicleX, double vehicleY, double rotation, Dictionary<VehicleMovementAgent.side, int> directionDistances, ref int actPosInMapListX, ref int actPosInMapListY, ref int actoffsetX, ref int actoffsetY)
Description:
Method to create the map in the sight of the vehicle in the vehicle-given view-range
Parameters:
- vehicleX: actual X coordinates of the vehicle
- vehicleY: actual Y coordinates of the vehicle
- rotation: actual rotation of the vehicle
- directionDistances: Dictionary which contains the distances for the viewing range
- actPosInMapListX: Reference to the actual x position in the generated map
- actPosInMapListY: Reference to the actual y position in the generated map
- actoffsetX: Reference to the difference between the x coordinates and the x block Position*32
- actoffsetY: Reference to the difference between the y coordinates and the y block Position*3
Return value:
- List: List
Description:
Method to add a street or crossing block of the given GID (param 1) to the given position (param 2 and 3)
Parameters:
- GID: GID of the block to set
- posX: x position to set the block
- posY: y position to set the bloc
Return value:
- StreetBlock
3.9.11 public SortedDictionary<double, List> allDynamicObjectsInRange(double vehicleX, double vehicleY, double rotation, Dictionary<VehicleMovementAgent.side, int> directionDistances)
Description:
Method to get the dynamic blocks
Parameters:
- vehicleX: actual X coordinates of the vehicle
- vehicleY: actual Y coordinates of the vehicle
- rotation: actual rotation of the vehicle
- directionDistances: Dictionary which contains the distances for the viewing range
Return value:
- SortedDictionary: double, List<DynamicBlock
Description:
Get the distance squared between two points
Parameters:
- point1: point one
- point2: point two
Return value:
- double: distance
Description:
Get the distance between two points
Parameters:
- point1: point one
- point2: point two
Return value:
- double: distance
Description:
Allows the game to perform any initialization it needs to before starting to run. This is where it can query for any
required services and load any non-graphic related content. Calling base.Initialize will enumerate through any
components and initialize them as well.
Parameters:
- none
Return value:
- void
Description:
LoadContent will be called once per game and is the place to load all of your content.
Parameters:
- none
Return value:
- void
Description:
UnloadContent will be called once per game and is the place to unload game-specific content.
Parameters:
- none
Return value:
- void
Description:
Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio.
Parameters:
- gameTime: Provides a snapshot of timing values
Return value:
- void
Description:
This is called when the game should draw itself.
Parameters:
- gameTime: Provides a snapshot of timing values
Return value:
- void
Description:
Method contains the loading of the streetmap and the dynamicObject List
Parameters:
- vehicle: actual vehicle to which the vehicle agent belongs
Return value:
- void
5.1.2 public virtual void moveVehicle(Vehicle vehicle, List<List> vehiclesStreetMap, List dynamicList, int actPosInMapListX, int actPosInMapListY, int actOffsetX, int actOffsetY)
Description:
Method contains the loading of the streetmap and the dynamicObject List
Parameters:
- vehicle: actual vehicle to which the vehicle agent belongs
- vehiclesStreetMap: map part around the vehicle in the view of the vehicle
- dynamicList: List of all dynamic objects
- actPosInMapListX: x block position of the vehicle
- actPosInMapListY: y block position of the vehicle
- dynamicList: value which contains the difference between x-value of vehicle and x-value of the actual block
- dynamicList: value which contains the difference between y-value of vehicle and y-value of the actual block
Return value:
- void
Description:
Method to calculate the distance between the actual vehicle and a given dynamic block
Parameters:
- vehicle: actual vehicle to which the vehicle agent belongs
- block: the dynamic object for which d´the distance should be calculated
Return value:
- double
Description:
Method to calculate if a given vehicle can react within the given distance
Parameters:
- distance: distance between an object and the given vehicle
- vehicle: actual vehicle to which the vehicle agent belongs
Return value:
- bool
Description:
Method to calculate if a given vehicle can react on another vehicle with the given distance
Parameters:
- distance: distance between an object and the given vehicle
- ownVehicle: actual vehicle to which the vehicle agent belongs
- otherVehicle: the other vehicle
Return value:
- bool
Description: Method to check if a dynamic block is in front of the vehicle
Parameters:
- vehicle: actual vehicle to which the vehicle agent belongs
- dynamicBlock: dynamic block which should be checked
Return value:
- bool
Description:
Method to calculate the new position of the vehicle within the map. Belongs to actual velocity
Parameters:
- vehicle: actual vehicle to which the vehicle agent belongs
Return value:
- void
Description:
Method to calculate the new velocity of the vehicle within the map. Belongs to actual acceleration or deceleration
Parameters:
- none
Return value:
- void
Description:
Method to calculate the new acceleration of the vehicle within the map. The new acceleration depends on if the vehicle
should be accelerate or decelerate.
Parameters:
- accelerate: flag to signal if vehicle should accelerate
- decelerate: flag to signal if vehicle should decelerate
- fieldsToBreak: distance in blocks in which the vehicle should stand. Not used at the moment
Return value:
- void
Description:
Method to initialize the distances around the vehicle in which the driver should see street blocks.
Parameters:
- none
Return value:
- void
Description:
Method to load the list of dynamic objects.
Parameters:
- none
Return value:
- List: DynamicBlock
5.1.12 public virtual List<List> loadStreetMap(double X, double Y, double rotation, ref int actPosX, ref int actPosY, ref int actOffSetX, ref int actOffsetY)
Description:
Method to load the street map.
Parameters:
- none
Return value:
- List: StreetBlock