001_JavaScript : Vector Measurement using JavaScript
Requires: SmartSpice
Minimum Versions: SmartSpice 4.31.17.C
The SmartSpice application allows scripting of tasks in a control block of a SmartSpice input deck together with a JavaScript block:
.JS_BEGIN <code lines> .JS_END
In this particular example we take a "long-tail-pair" bipolar circuit and simulate this circuit and save some vectors vectors. We then use the JavaScript functionality to extract some measurement results from the transient simulation vectors and print these results in the output log file of SmartSpice.
To run the simulation:
- 1. Source the input deck “MeasTest.in” in smartspice and it will run automatically in the GUI.
- 2. You will see in the output window the extracted information. You can then save this log file.
This can be used as a template to do more elaborate post processing analysis on SmartSpice simulation data. Syntax details can be found in the SmartSpice User’s Manual Chapter 3.13
Input Files
MeasTest.in
DEMO EXAMPLE 1: INPUT FILE * VIN 1 0 DC 0 SIN(0 0.1 5MEG) AC 1 VCC 8 0 DC 10 VEE 9 0 DC -12 RS1 1 2 1K RS2 5 0 1K RC1 3 8 10K RC2 4 8 10K RBIAS 7 8 20K CLOAD 3 4 5PF Q1 3 2 6 QNL Q2 4 5 6 QNL Q3 6 7 9 QNL Q4 7 7 9 QNL .MODEL QNL NPN(BF=80 RB=100 CCS=2PF TF=0.3NS TR=6NS CJE=3PF CJC=2PF VA=50) .TRAN 5NS 700NS .save tran V(1) V(3) V(4) .OPTIONS RELTOL=0.001 NOMOD .JS_BEGIN function MeasTest() { simulator.execute("meas tran v3_max max v(3) from=100n"); simulator.execute("meas tran v3_avg avg v(3) from=100n"); simulator.execute("meas tran v3_rms rms v(3) from=100n"); simulator.execute("meas tran v3_integral integral v(3) from=100n"); } MeasTest(); .JS_END .control run jsexec .endc .END
Graphics