1

We want to add a ConnectionAgent that monitors a certain connection to the PDPRoadModel in order to support reservations. However, these ConnectionAgents have CommDevices, which require a position in order to be useful, which means the devices have to be PDPObjects.

If we implement them as a Vehicle, they can cause collisions with the existing vehicles and we still want to simulate collisions, so this is impossible. If we implement them as Parcels, they show up on the grid, which covers up the actual Parcels, which is something we're trying to avoid.

As the PDPType object is protected, we can't implement a new PDPType, meaning that we currently have no way to implement our ConnectionAgent properly.

rinde
  • 1,181
  • 1
  • 8
  • 20
Lyncix
  • 13
  • 2

1 Answers1

0

You can work around the restrictions of the PDPRoadModel by not adding the ConnectionAgent to the models as a physical entity but just as a virtual communication entity that has a certain position. For example, the agent could be implemented similar to this:

public class ConnectionAgent implements CommUser {
  final Point position;

  public ConnectionAgent(Connection<LengthData> c) {
    position = Point.centroid(asList(c.from(), c.to()));
  }

  @Override
  public Optional<Point> getPosition() {
    return Optional.of(position);
  }

  @Override
  public void setCommDevice(CommDeviceBuilder builder) {}
}

If you want to have an agent for each connection, you could just loop over the connections in the graph, and then create and add the ConnectionAgent to the simulator.

rinde
  • 1,181
  • 1
  • 8
  • 20