Development Of Control Algorithm And A Simulation Tool For Self-Assembly Of Microsystems Based On Swarm Technology