Phase locking of long Josephson junctions