TinyURL widget - shorten your URL's for free!

Enter a long URL to make tiny:

Sunday, March 20, 2016

Writing time to vector data output in ngspice control block


If you want to store the time as a vector alongside the columns of data in an ngspice simulation output, then you call the vector 't' which is the internal name for the time-stepped finite difference. 

For example, this control block prints out the time into a wrdata command.

**************************************************************
*  CONTROL BLOCK                                             *
**************************************************************
.control
set hcopydevtype=postscript
* allow color and set background color if set to value > 0
set hcopypscolor=1
*color0 is background color
*color1 is the grid and text color
*colors 2-15 are for the vectors
set color0=rgb:f/f/f
set color1=rgb:0/0/0
set color2=rgb:5/5/5
set color3=rgb:0/9/9
set color4=rgb:7/9/0
op
run
*  V(1) V(2) V(3) I(vss) V(7) V(6) V(5)
gnuplot   V(1) V(2) V(3) I(vss) V(7) V(6) V(5)
hardcopy multi-switch.ps  V(1) V(2) V(3) I(vss) V(7) V(6) V(5)
wrdata multiswitch.data  t V(1) V(2) V(3) I(vss) V(7) V(6) V(5)
.endc

which resulted in the following output:


 

Friday, March 4, 2016

Example of a MOSFET switch in SPICE model

I was reading this OK tutorial to refresh myself on how to make a MOSFET switch. They do a good job explaining theory but they dont' take it that one step further. You can find more information here.




I took a n-channel depletion MOSFET model from here Simon Bramble
and I made a SPICE model circuit around it.

I stepped the voltage on the gate - look at the V(1) voltage in grey - and it activates the MOSFET conducting channel via the field effect when the blue line V(3) (which is the drain node ) drops from 6 volts down to zero.   This causes the current to flow through the drain to source and this turns on the load which is flowing through I(Vss).


Erratum: First version explained effect as transconductance, that's not accurate I've changed it to field effect. That's how rusty I am I mixed the phenomena.Transconductance is a generalization relating transfer function in this case of gate voltage to compared to source current / voltage but the phenomena is the field effect. My first explanation was partly correct but the second one is completely accurate.