next up previous contents index
Next: The sweep Command Up: Simulation Control Commands Previous: The step Command   Contents   Index


The stop Command

The stop command will add a stop point to the runop list.

stop analysis point [postcmds]
When a condition is true, simulation will stop, but can be resumed, after clearing the stop point, with the resume command. The stop points can be cleared with the delete command, and listed with the status command. The panel brought up by the Trace button in the Tools menu can also be used to manipulate stop points.

The stop command is a ``runop'' similar to the measure command, and is in fact implemented internally from the same components. Analogous to measure, there is also a .stop input syntax element which uses the same syntax, which will be in force when simulating the circuit containing the line. When entered on the command line, the stop is in force for all circuits, while the runop is active.

Note that this is a different implementation of the stop command than found in WRspice-4.3.8 and earlier, which was based on the Berkeley Spice3 implementation. Although similar, the present syntax is a little different, and the command has more features and options.

analysis
This specifies the type of analysis during which the break condition will be active. Exactly one of the following keywords should appear in this field: tran, ac, dc. Note that this did not appear in the stop syntax used in WRspice-4.3.8 and earlier.

point
This is precisely the same point specification as is used in the measure command. Please refer to that section for a description of the syntax. Note that this should cover the pre-4.3.9 syntax, however an analysis point index is now an integer enclosed is square brackets, numeric values are now assumed to be scale values (such as time) otherwise.

repeat delta
The delta is a real number scale extent. After the point trigger, the actions are repeated on every multipole of delta that follows, as long as a call script (see below) returns 1.

There are a couple of optional ``postcmd'' operations which can be performed when the stop is triggered, but before simulation ends.

exec command
Execute the WRspice shell command found in command, which should be double-quoted if it contains white space. Note that multiple commands can be given, separated by semicolon (`;') characters. This will be run before a script is called (see below) so can be used to pass information to the script. The command will be executed only once, and only if the point condition is reached.

call script
After the point is reached and any command string is executed, the named script will be called. The script can be a normal script file or codeblock. The special names ``.exec'', ``.control'', and ``.postrun'' call the exec, control, or postrun bound codeblocks of the running circuit, if they exist.

The script can be used for additional processing or testing of whatever sort. If the script returns 1, the current simulation will not stop, and will continue as if the stop condition never occurred. If the script returns 2, a global error is indicated and the present analysis is terminated. If any other value is returned, or there is no explicit return, the analysis will stop as normal, and can be resumed.

silent
Normally when the stop is activated a message is printed. If the silent keyword is given, no message will be printed. Suppressing the message may be desirable when the stop is being used to terminate failed Monte Carlo trials, for example, where message output simply clutters the screen.

If a stop command is given at the prompt in interactive mode, it is placed in the global runop list, and activity will persist until deleted (with the delete command). If the command is given in a file, the command will be added to a list for the current circuit, and will apply only to that circuit. Thus, for example, a WRspice file can contain lines like

*# stop tran when ...
and the action will be performed as that circuit is run, but the ``stop tran when ... '' directive will not apply to other circuits. This is the same effect as a .stop line.


next up previous contents index
Next: The sweep Command Up: Simulation Control Commands Previous: The step Command   Contents   Index
Stephen R. Whiteley 2022-09-18