next up previous contents index
Next: Referencing Results in Sources Up: The measure Command Previous: Measurements   Contents   Index


Post-Measurement Commands

There are a few commands which can be performed after measurement, which will run whether or not any measurements are actually made.

print, print_terse
By default, nothing is printed on-screen for a .measure line during interactive simulation. If the keyword print appears in the .measure line, the results will be printed on the standard output. A more concise format can be obtained from the alternative keyword print_terse. The result vectors are created in all cases.

stop
If the keyword stop appears in a .measure line, the analysis will be paused when all measurements are complete. Thus if the deck contains several .measure lines and stop is given in at least one, the analysis will pause when all of the measurements are complete, not just the one containing stop. The analysis can then be resumed with the resume command, or reset with the reset command.

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 once only, after measurements if any.

call script
After the measurement (if any) is performed 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 pause immediately (no waiting for other measures) however a calling analysis, such as Monto Carlo, will continue. If 2 is returned, this indicates a fatal global error and any calling analysis will be stopped too. Any other return value allows the run to continue normally.

When a .measure is included in an iterative analysis (Monte Carlo, loop, etc.), data are saved as follows. Before each iteration, the previous result vector and its scale are saved to the end of a ``history'' vector and scale, and are then deleted. The result vector and scale are recreated when the measurement is completed during the iteration. Thus, at the end of the analysis, for a measurement named ``example'', one would have the following vectors:

example the result from the final trial
example_scale the measurement interval or point in the last trial
example_hist results from the prior trials
example_hist_scale intervals from the prior trials

Thus, during each trial, the result vector will have the same properties as in a standard run. It can be used in the .control block of a Monte Carlo or operating range file (recall that $?vector can be used to query existence, and that if there is no checkPNTS vector defined, the .control block is called once at the end of each trial).

Multiple .measure lines can be ``chained'' in the following manner. The vector name following the from, to, trig, or targ keywords can be the name of another measure. In this case, the effective start time is the measure time of the referenced measure. The measure time is the end of the interval or the measure point. The td, rise, and other keywords can be used in the referencing measure. The td will be added to the imported time, and the other keywords operate in the normal way. If there are no keywords other than td specified, the time is the delay time plus the imported time.

Example:

.measure tran t1 trig v(5) val=.4m rise=3
.measure tran t2 trig v(5) val=.4m rise=4
.measure tran pw trig t1 td=20p targ t2 td=20p pw v(5) max v(5)

In this case, the measures t1 and t2 ``frame'' a period of an (assumed) repeating signal v(5). Note that no actual measurement is performed for these lines. Their purpose is to be referenced in the third line, which takes as its interval the t1-t2 interval delayed by 20 pS, and measures the pulse width and peak value.


next up previous contents index
Next: Referencing Results in Sources Up: The measure Command Previous: Measurements   Contents   Index
Stephen R. Whiteley 2022-09-18