Simulation eBook - Configuring Voltage and Current Sources
Configuring Voltage and Current Sources
EasyEDA Libs provides a range of Voltage and Current Sources whose outputs are defined by a list of values or parameters. The outputs do not depend on anything else.
These sources have already been discussed in terms of their DC source resistances and DC paths.
In most of the examples so far, they have been used to provide DC supply voltages either as ideal voltage sources or as Thevenin or Norton Sources.
Their use to provide time domain (time varying) signals has been introduced in the examples about transformers but has not so far been explained.
This section describes in detail how any V (and I) source can be set up to provide the following types of signal sources:
- SINE or SIN: a sinusoidal signal;
- PULSE: a general pulse waveform;
- EXP: a single pulse with exponential rising and falling edges;
- SFFM: (Single Frequency Frequency Modulated) a single sinusoidal carrier, frequency modulated by single sinusoidal frequency;
- PWL: (PieceWise Linear sources} an arbitrary waveform source with signals created as a list of times and levels with the signal linearly interpolated between each time point.
Although the examples in this section only illustrate how to configure V Sources, I Sources are configured in exactly the same way. Please note that the descriptions and examples of the different sources describes the most common configurations. LTspice offers several unique V and I Source features which are beyond the current scope of this document. To find out about these advanced options please search for V and I in the native LTspiceXVII Help files either in a locally installed copy or from the LTwiki site here: http://ltwiki.org/index.php?title=LTspice_Annotated_and_Expanded_Help* Even more advanced options are described on the LTwiki site here: http://ltwiki.org/index.php?title=Undocumented_LTspice#Standard_Sources
Configuring the SIN (or SINE) option
Configuring the SINE option to create an unmodulated, single frequency sinusoidal signal source.
More ways to use the SIN (or SINE) option
Configuring the PULSE option
Configuring the PULSE option to create a pulse signal source.
More ways to use the PULSE option
Configuring the EXP option
Configuring the EXP option to create a single pulse source with exponential rising and falling edges.
Configuring the SFFM option
Configuring the SFFM option to create a simple, single frequency, frequency modulated sinusoidal signal source.
Configuring the PWL option
Configuring the PWL option to create an arbitrary piecewise linear waveform signal source.
Configuring the AC source option
As well as their more obvious use to generate time domain signals for Transient Analysis (time domain) simulations, V and I Sources can also be configured as AC Sources for AC Analysis (frequency domain) simulations. The amplitude and phase of the AC Source is specified and a list of frequencies at which the circuit is to be analysed is given in an AC Analysis spice directive. The result of an AC Analysis is a set of amplitudes and phases that are plotted to create an Amplitude and Phase versus Frequency plot such as a Bode plot showing the frequency response of a circuit.
It is important to understand that these plots are not generated as they would be for a real world, physical circuit where a Frequency Response Analyser presents a sinusoidal signal, either swept slowly or stepped at a series of discrete frequencies, to the input of a circuit and then the amplitude and phase of an output at some other point in the circuit is measured, relative to the input signal, in the time domain.
The way they are generated is the result of a purely mathematical analysis. In simple terms, the DC operating point of the circuit is examined and all the components in the circuit are replaced by their linearised small signal models. In other words, everything is assumed to be linear about the DC operating point so that the circuit can be represented as a small signal linear system in the frequency domain. The output from that set of linear equations is then solved at each of the input frequencies specified in the AC Analysis spice directive.
It can be quite hard to visualise what the Amplitude and the Phase settings in the AC Source options of the V and I Sources really mean when the signals in an AC Analysis cannot be viewed in the time domain in a Transient Analysis. To try to help visualise these settings and what they represent, the following couple of examples demonstrate the settings in ways that can be related back to their equivalents in the time domain.
The first example shows how more than one AC Source can be configured in a circuit to represent different signal sources at the same frequency but with different phases. The example also shows how the phase settings relate to the same signals in the time domain.
In this example both AC Sources are set to the same amplitude of 1. They could be set to different amplitudes: try it and compare the results with the same amplitude changes in the time domain part of the signal sources.
Note, however, that the AC Analysis assumes that the circuit is perfectly linear so even if an AC Source amplitude 100 were to be specified, the output would still look as if it came from a perfectly linear circuit. Compare that with what happens if the time domain parts of the sources are set to 100!
The DC offset of the inphase AC Source in this example is important because it biases Q1 into a range where both the emitter and collector swings are operating in the linear region. This can clearly be seen by probing V(Q1E) and V(Q1C) in a Transient Analysis. If the DC Offset is increased, eventually V(Q1C) falls and V(Q1E) rises will until they meet as Q1 saturates and V(Q1E) starts to pull V(Q1C) back up again. At the point where this happens the small signal gain of the collector output passes through zero and then becomes a non-inverting gain of somewhat less than unity.
If the DC offset is reduced to near ground or even below it, Q1 is cut off so both the collector and the emitter output small signal gains fall effectively to zero. Again this can clearly be seen in a Transient Analysis.
What is not so obvious is that although these effects still occur in the AC Analysis, because the DC conditions cannot be represented in the frequency domain plots, the results can sometimes be hard to interpret.
So, the information to take away from this is that if an AC Analysis seems to be showing a lower than expected gain then it is worth checking that the DC operating point of the circuit is not forcing some part of it into saturation or cutoff. One example of this is incorrectly biasing an opamp input so that the output has hit one or the other of the supply rails. Forgetting to connect up a power supply rail is another common mistake.
An AC Analysis can only be used to study the small signal frequency response of a circuit. Since the linearity of most circuits varies with the instantaneous value of the input signal the results of an AC Analysis cannot be used to infer the large signal response of a circuit in the frequency domain.
Care must also be taken in setting up the correct DC operating point when applying an AC Analysis to circuits including AGC and other forms of dynamic range compression and expansion where the DC operating point is set by some long term (compared to the period of the signal) averaging, or similar function of the amplitude of the output of the circuit itself.
A further point about the effects of the DC operating point is that an AC Analysis can not be used to study the frequency response of circuits such as Phase Locked Loop, Switch Mode Power Supplies and Class D amplifiers because these circuits usually contain elements that are always switched into one state or another where the linearised gain is reduced to zero. There are ways to study the frequency responses of such circuits but they require more advanced modelling techniques to replace the switching and other elements (such as the VCO in a PLL) with linearised equivalent circuits.
It must also be understood that although any number of AC Sources can be placed in a circuit, each with their own amplitude and phase, all the sources will operate at exactly the same frequency as this is determined by the AC Analysis settings and not by the sources themselves. In a circuit with several Independent Sources in it, AC sources can simply be added to, removed from or moved around it just by adding the AC amplitude and phase values to the required source. So in the example above, the response of the inphase and out of phase side of the all pass network can be observed simply by setting one AC Source or the other to have zero amplitude or just by deleting the AC parts of the Source configuration.
Another example of this might be that the frequency response of an amplifier from signal input to output can be plotted using an AC Source at the input source whilst the frequency response of the amplifier from power supply ripple to output can be plotted by swapping the AC Source settings to the voltage source being used for the power supply.