If you have followed the 'first steps' chapter, you have already performed and completed some simulations.
Now, the process of defining and running simulations will be explained more in depth.
Before the simulation, a netlist must be written which contains all
devices, analysis commands and options. The flag 'SPICE3'
in the 'options'-dialog has to be set to SPICE3 if you want to use SPICE3
as your simulator (see page in chapter
'option-dialogs').
This is the default. If you push 'HSPICE' or 'TITAN'
instead, the created netlists will have slightly different formats.
Netlists will be written automatically before simulation if you changed something in your schematic. You will get netlisting statictics in your xterm-window.
If you want to write an explicitly new netlist, execute netlist
in the simulations menu. You also need to do this if you change model files in the model directories. SPICECAD will not check whether a file modification date is more recent than the last netlist, so, please do not be surprised when SPICECAD will not write a new netlist if you change some model files.
Now, lets assume that the netlist failed.
This happens if you forget to fill in required properties, or if there are unconnected contacts or nets which are connected only once.
All devices which are erroneous are marked with a circle on the inside. All contacts which are erroneous are marked wich a circle around. Nets which are connected to only a single terminal are highlighted. This way, you can locate and fix netlisting errors very easily. During fixing of the netlisting problems, it will be necessary to redraw the schematics from time to time (e.g., after zooming into a particular area).
This redraw of the schematic will cause erroneous nets to be displayed using normal colos. You can display all these errors again by using showerr in the simulation menu.
All netlisting errors will result in a textual message which will be displayed in the error window.
Now, let's assume that there is a message 'Net number 34 is connected only once'.
That means that the node number 34 appears only once in the whole netlist.
Now, you need to know the position of net 34 to delete it or to connect it to another net. Good old Murphy's law says that this net is always an invisible net on the lowest hierarchy level.
No problem. Choose findnode in the simulation menu, type in the wanted node number in the appearing dialog box, and SPICECAD will look for this node and will display it on the screen. Even on the deepest hierarchy levels.
Now, you can correct the error, save the fixed schematic with 'CTRL s' and return to the toplevel with totop in the symbol menu or with Hotkey 't'.
Another possible message is 'transistor M34 has incomplete properties'.
It's almost the same procedure: choose findname in the simulation menu, type 'M34' in the appearing dialog box, and you get it. Don't forget to save after correcting the error.
Now, let's assume that you have corrected all errors.
What could possibly still be missing?
You might have forgotten the gnd- symbol, or the parameter-box, and at least one analysis-box, or there are no independent sources in your design.
Please correct that. SPICECAD will tell you in all these cases that the objects mentioned above are missing.
One very annoying error are missing symbols. These missing symbols might be stored in a library, and for whatever reason, the library path was missing inside the setup file 'setup.spi'.
You can correct that in the 'options'-dialog. After doing that, you need to exit and restart SPICECAD. SPICECAD will not reload the whole design after changing library paths.
Okay, now, we want to run a simulation.
Execute runsim or type 'CTRL r'. Note: SPICE3 is so fast for small circuits that it takes a longer time to select runsim with the mousebutton than running the simulation itself.
With select V(x) or select I(x) you can select one or more nets or terminals whose voltages or currents you want to watch. Voltages and currents cannot, however, displayed in the same plotting window. To tell SPICECAD that you want to plot currents, you need to select currents in the What?- pullright-menu. voltages is the default. The selection of nets or terminals is finished with a click of the right mousebutton. To plot the results, select plot dc when you have run a DC-transfer simulation, plot tran for transient simulations. plot acm plots the magnitude of the small-signal voltage of AC-simulations, plot acp plots the phase.
The plotwindow opens automatically. If you want to stretch it, please open it by hand with 'open plotwin' and stretch it before you do the first plot.