Skip to content

Commit

Permalink
ad todo
Browse files Browse the repository at this point in the history
  • Loading branch information
Grimmgockel committed May 22, 2023
1 parent 0a6be37 commit 6055daa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Solution1/ConsoleApp1/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
var physicalWorld = new PhysicalWorld(graph, parkerCount, cruiserCount);

// sim meta data
//var simDataTask = await SimDataClient.Create(mqttClientFactory, physicalWorld, simDataPublishInterval);
var simDataTask = await SimDataClient.Create(mqttClientFactory, physicalWorld, simDataPublishInterval);

ParkingGuidanceSystem pgs = new ParkingGuidanceSystem(physicalWorld, new NearestParkingStrategy(), false);
// init cruisers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,21 @@ public bool AttemptLocalParking(MockCar car)
}

if (passedParkingSpots.Count == 0) return false;

// occupy
var nearestUnoccupiedSpot = passedParkingSpots.Peek();
car.OccupiedSpot = nearestUnoccupiedSpot;
car.OccupiedSpot.Occupied = true;

// physically park
car.Position = new StreetPosition(car.Position.StreetEdge, nearestUnoccupiedSpot.DistanceFromSource);

nearestUnoccupiedSpot.Occupied = true;
car.Position.StreetEdge.DecrementCarCount();
Random rand = new Random();
car.ParkTime = rand.Next(0, MockCar.MaxParkTime + 1);

car.World.DecrementUnoccupiedSpotCount();
car.World.IncrementParkEvents();
car.KpiManager.DistanceTravelledParking += car.Position.DistanceFromSource;

// car.KpiManager.PublishAll(); TODO publish kpis with async and await
Expand Down
1 change: 0 additions & 1 deletion src/Solution1/ConsoleApp1/sim/MockCar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public void RespawnAtRandom()
public void ResetAfterParking()
{
OccupiedSpot.Occupied = false;
OccupiedSpot = null!;
Position.StreetEdge.IncrementCarCount();

// kpi
Expand Down

0 comments on commit 6055daa

Please sign in to comment.