### B2Spice subcircuit that functions similar to PSPICE’s SW_tClose

Author: Vaughn P. McDowell

About a year ago (Sept 06) I was interested in having a B2Spice subcircuit that functioned similar to PSPICE’s SW_tClose to simulate High Voltage spark gap switches having variable rise times and turn on resistance. My goal was to use B2Spice to do very simple Marx generator simulations. The above switch is smooth closing having parameter inputs: t delay, t rise, Ron and Roff. The subcircuit I used and its netlist is shown below:

 .subckt SW_tSigmiod N2 N3 V1 4 0 DC 0 Pulse(0 1 {TD} {TR} 1e-6 1 2) B1 N2 N3 i=V(N2,N3)/V(5,0) R1 4 0 10meg B2 5 0 v={Roff}/(1 + exp(28*(V(4,0)))) R3 5 0 1K .ends SW_tSigmoid

The smoothing switch portion is based on the SIGMOID STSNOT3 circuit given in the B2SPICE Resource section. Referring to the above circuit B1 and B2 correspond to B3 and B1 respectively in Figure 2 “Sigmoid NO test circuit #1” . B1 is the non linear current source simulating a variable resistor ( terminals at N2 and N3) by defining its current based on ohm’s law ie I = E/R. Where E corresponds to the voltage across the variable resistor V(N2,N3) and the magnitude value of R is defined by the voltage output of B2 at nodes 5 and 0. Hence the expression <I=EXPR> defining B1’s current is i=V(N2,N3)/V(5,0).

B2’s output voltage magnitude defines R as a function of time <V=EXPRESSION> is given in the STSNOT3 Resources article in Figure 2. For simplicity the switch open resistance was included in the B2 expression as well as omitting the -0.5 portion. The B2 expression controlling its output voltage is v={Roff}/(1 + exp(28*(V(4,0)))).

For my purposes the input parameters of interest were off resistance {Roff}, t delay, and t rise; the on resistance was to be fixed to a sufficiently low value by setting “a” (using the above reference notation) as high as possible ie a=28. If an on resistance was reqired then a resistor could be added in series.

The controlling voltage for B2 is V1 (ie V(4,0)) which is used for controlling the delay and rise time ( for my purposes from a few nanoseconds to a few hundred nanoseconds). Hence the controlling parameters for the V1 pulse generator is {TD}= t delay and {TR} = t rise.

After setting up the previous subcircuit as a B2Spice part (SW_tSigmoid) using the Data Base feature a test circuit was set up:

V1 is a 100volt source and R1 is set to 10K; the switch parameters are TD = 0ns, TR=100ns, and Roff= 10M the waveform voltage across R1 is:

Now testing for turn on resistance for a 0.01 ohm load:

Now increasing R load back to 10K but reducing the rise time from 100 to 10 nsec:

Keeping the 10 ns rise but lowering Rload too 0.01 ohms again:

As can be seen in all cases the 10 to 90 % voltage points, defining the rise time, is about 15% of the {TR} value entered; also as the load resistance decreases the delay increases even though {TD} entered is zero.