# Using the “bi” and “bv” Arbitrary Sources in LTspice

The arbitrary sources in LTspice are incredibly versatile and useful. In the previous article it was shown how the “bi” source could be used to make a simple current dependent current source (“bv” could similarly be used to make a current dependent voltage source); however, the arbitrary sources can be used to create much more complex current/voltage sources based on virtually any combination of simulation parameters and LTspice recognized mathematical functions. Here two examples of how to use arbitrary sources are given with the associated LTspice circuit downloads provided.

## A Time Stepped Current Source.

This can be done with a PWL function, PWL file, or table, but all those things can get rather tedious if lots of steps or frequent editing is necessary. The same thing can be done very quickly, easily, and with a lot more simplicity and versatility via a “bi” arbitrary source. Observe.

Download LTspice File - Arbitrary_Source_bi_Current_Step.asc (540 Bytes)

Here the current source as defined is feeding a parallel 1 kOhm and 100 nF load. It is defined to provide a 1 mA current step increase every 1 ms by utilizing the **ceil()** function and **time** parameter. Since the simulation is run as a transient simulation from 0 to 10 ms, the current steps up from 0 to 1 mA just after time = 0 and continues at the 1 mA/ms step rate from there. Imagine how many other useful source behaviors could be created using arbitrary sources and the correct application of the LTspice recognized mathematical functions.

## A Sinusoidal Voltage Source With a Periodic Logarithmic Frequency Step

Here a sinusoidal voltage source ( **sin(2 pif*t)** ) is defined with the following characteristics.

- A 100V amplitude (
**100*sin**) - A starting (time = 0) frequency of 1 kHz (
**2**)*pi*1k - A logarithmically stepped frequency every 2 ms (
**10**floor(time*500)** ) - A horizontal timescale shift of 1 ms to the left (
**time+1m**)

The voltage source is feeding a series RC circuit with a specifically selected time constant to set the cutoff frequency at 10 kHz, the odd and unrealistic **{100n/(2*pi)}** capacitor value and 1 kOhm resistor value were used just to make the math work out perfectly for the demonstration.

Download LTspice File - Arbitrary_Source_bv_Frequency_Step.asc (569 Bytes)

The expected single pole behavior is observed, with the output voltage of the capacitor dropped only slightly from the source amplitude at 1 kHz a decade below the cutoff frequency, by the square root of two at 10 kHz, by a factor of 10 (20 dB) at 100 kHz, and by another factor of 10 each subsequent logarithmic frequency step. Since the transient simulation is run from 0 to 6ms, four frequency steps are seen, the first at 1 ms, and another every 2 ms after this. So, from this example it’s obvious that the arbitrary sources are a useful way to create a frequency variable source when running a time domain ( **.tran** ) simulation.

# Comments

Any questions or comments please go to our TechForum: TechForum