You can stop a simulation during the run by clicking the Stop button in the toolbar, giving the Run > Stop menu command, or using the Ctrl+. shortcut. These cause the current executing block to return an abort signal, causing the model to stop executing in whichever state it was in when the Stop command was given. Sometimes the Stop signal takes time to propagate through the block code and back to the simulation engine, so you can't tell when the simulation will actually stop.

To stop the model at an exact point in time, such as when all the blocks are up to date on that step, enter code in an Equation or custom block that gets executed when you want to stop. For example:

numSteps = currentStep+1      // This will cause the simulation engine to stop at the next step.

Note that the ExtendSim simulation engine uses the simulation step value and not the currentTime value to stop the model. However, you can use currentTime in your code to decide when to execute that line of code.