Depending on the device under investigation, one can create multiple electrical contacts to assign different bias voltages in DEVICE. For example, a simple diode can have two electrical contacts (anode and cathode), whereas a field-effect transistor (MOSFET) can have up to four electrical contacts (source, drain, gate, and body). In most cases, we apply a bias voltage (sweep) on one of the contacts and keep the voltages at the other contact(s) fixed. This can be done easily by using the dc sweep option of the corresponding electrical contact.
However, sometimes, we may want to change the voltage at two contacts simultaneously (for example, sweep the gate and drain voltages of a MOSFET). In such cases, we can not just enable the dc sweep option on both contacts and run the simulation. Even though the solver will allow users to define dc sweeps on multiple contacts, the simulation will almost always fail. The solution to this problem lies in the script. When running voltage sweep on multiple (say two) contacts, we will have to apply a dc sweep on “contact A” and then use a “for” loop in the script to change the voltage of “contact B”. The solver will run multiple simulations sweeping the voltage of “contact A” for each of the voltage steps for “contact B” as defined by the script.
One thing to note here is that for each of the different voltage values of “contact B”, the solver will run different simulations. So the script needs to record the results at each step so that the results at all the bias points are available at the end.