Modules disrupted during simulation

When I start the simulation in code firstly, it is ok. But it happens that all modules in the whole layout are disrupted when I start simulation secondly. Are there something I do not notice?

The code I used:

public void TestFun()
{
    ISimulation simulation = _application.Simulation;
    simulation.TimeMode = SimulationTimeMode.VirtualTime;
    simulation.Reset();
    simulation.RunTime = 100;
    simulation.SpeedFactor = 4;
    simulation.WarmupTime = 0;
    simulation.Run(100);

}

What exactly do you mean with “all modules in the whole layout are disrupted”

The position of components in the layout are disrupted

If the positions change on reset undesirably then you probably need to add a call to ISimulation.SaveState() before starting simulation, which saves the initial positions and such.
I think clicking the play-button in the UI calls SaveState() as well.

Thank you, it is solved