In this evacuation model, I have created a layout where pedestrians are simulated to be leaving rooms from target lines (circled in green) and heading towards either of 2 exits during an evacuation (circled in red). There is a 10% chance of obstruction to exit1 and 50% chance of obstruction to exit2 (here). When both exits are available, I have been able to code the pedestrians to go to the nearest available exit relative to their current position (here) where availableExits is a collection. See also the flowchart implemented.
At a junction in the layout, I have created a red node with an access restriction which allows a capacity of 8 pedestrians at any given time (see properties here and live model here). Assuming both exits are available and based on all the code provided earlier, any pedestrians arriving at this junction will head towards exit1 as this is the closest exit.
I want to program pedestrians which have been denied entry to the node to change their target destination from exit1 to the next closest exit which would be exit2 in this case (to simulate people trying to find a less congested route for evacuation). What will I need to put in the 'On enter denied' code (in the node's properties) for this to be executed?
You can call the cancel(ped)
method:
i.e. in the "On enter denied" code, write myPedGotoBlock.cancel(agent);
Make sure that the ShapeRectangle agent type is set to the Pedestrian type you use.
Last, use the bottom exit port of your PedGoTo to define what the cancelled ped should do next