  This two-part paper considers strategic topology switching for security in
the second-order multi-agent system. In Part II, we propose a strategy on
switching topologies to detect zero-dynamics attack (ZDA), whose
attack-starting time is allowed to be not the initial time. We first
characterize the sufficient and necessary condition for detectability of ZDA,
in terms of the network topologies to be switched to and the set of agents to
be monitored. We then propose an attack detection algorithm based on the
Luenberger observer, using the characterized detectability condition. Employing
the strategy on switching times proposed in Part I and the strategy on
switching topologies proposed here, a strategic topology-switching algorithm is
derived. Its primary advantages are threefold: (i) in achieving consensus in
the absence of attacks, the control protocol does not need velocity
measurements and the algorithm has no constraint on the magnitudes of coupling
weights; (ii) in tracking system in the absence of attacks, the Luenberger
observer has no constraint on the magnitudes of observer gains and the number
of monitored agents, i.e., only one monitored agent's output is sufficient;
(iii) in detecting ZDA, the algorithm allows the defender to have no knowledge
of the attack-starting time and the number of misbehaving agents (i.e., agents
under attack). Simulations are provided to verify the effectiveness of the
strategic topology-switching algorithm.
