I'm using the Xbee ZB SMT modules in an end device application and having some problems with the orphan scan.
The desired behavior for the device is that it comes online, associates with a router/coordinator, and transmits data. If the end device powers down (for battery replacement) and comes back online, it should seek out the same parent it was previously connected to. If the parent fails and has to be replaced, I would like the child device to recognize the parent is missing on it's next power-up, and fall back to a default scan for any other router/coordinators it can connect to establishing a new parent.
Orphan scan behavior sounds like it does exactly this, but in practice I've had some difficulty making it work.
Write security parameters to persistent memory, but allow channel and PANID to default. The security parameters ensure the device only connects to a valid coordinator that is part of our system, but if multiple coordinators are in range it arbitrarily joins any of them regardless of the previous time it was powered on.
Write security parameters to persistent memory, allow channel and PANID to default, but once connection is established read back the 64-bit operating PANID ("OP"), write that back to "ID" and commit that to persistent memory with a "WR" (using an external microcontroller on the device). This ensures that the device will always connect to whichever coordinator it connects to on the first attempt, but it will 'connect' to that same PANID even if the coordinator is removed.
Scenario 2 is the closest to a solution, but it needs to be able to fall through and connect to another coordinator. In the event of a coordinator failure we can't effectively brick an entire floor worth of devices (requiring manual re-flash).