2
\$\begingroup\$

While I was measuring various things in this amplifier design so I could understand it better, I tried to use a square wave as a source signal. I used pulse voltage source, specified parameters and started a transient analysis so I could see what was happening on base of Q1 and at the output. I noticed that the input signal at base of Q1 is shifted up around 160mV and then starts to shift down to -73mV(it takes around 200ms), the same value as the DC operating point voltage of Q1 base. I'm pretty sure I know why does it happens (or maybe I missed something?) C4 is charging etc etc, what I don't understand is why does it seem like the initial conditions of circuit were not applied? I didn't use the option to ignore calculated initial conditions. Why, during transient analysis, it shows that the C4 cap is charging? I always assumed that transient analysis does the dc op analysis and takes that as the initial conditions of the circuit.

It seems that I am in the wrong. Can someone explain it? Why, in transient analysis it shows the initial charging of C4?

Below there are two screenshots, the first 50ms of transient analysis, which show the gradual shift and probably not that important schematic of the whole amplifier. If needed I can provide more informations, screenshots, .asc file.

Snippet of transient analysis A snippet of transient analysis with amplifier input stage

Amplifier circuit

Amplifier circuit

\$\endgroup\$
2
  • \$\begingroup\$ I think you're conflating what SPICE calculates as the initial conditions (via .op analysis like you mentioned) and the "steady state" conditions of your circuit. They are different things. SPICE cannot do the latter, but you can set your own initial conditions on nodes or across capacitors to more closely match the steady state values you expect under certain inputs. This will make it so you don't have to run your simulation as long and wait for it to reach steady state "naturally". \$\endgroup\$ Commented Nov 3 at 19:19
  • \$\begingroup\$ More specifically for your circuit, SPICE only knows your PULSE source starts at -0.25V ("Vinitial" parameter) and uses that to calculate the initial conditions. It doesn't (and can't) know that it pulses between -0.25V & +0.25V and how much charge will accumulate across the capacitors as a result. The simulation must run until steady state to know this. \$\endgroup\$ Commented Nov 3 at 19:26

2 Answers 2

6
\$\begingroup\$

For a transient analysis (.tran), initial conditions are derived from a calculation of the DC operating point of the circuit (an implicit .op), assuming all voltage and current sources have fixed values. Source values are obvious for fixed-value sources, but for sources that change over time, such as PULSE() and SIN() functions, they are evaluated at time \$t=0\$, and any change thereafter is completely ignored.

All capacitors are ignored, since under unchanging conditions, capacitor current will always fall to 0A and remain there, and capacitor voltage will eventually settle at whatever DC potentials exist without the capacitor there at all. Inductors are replaced by a short-circuit, since their voltage will have settled at 0V, and at DC the current through them will eventually be whatever current would flow through a short-circuit there instead.

Initial conditions (DC operating point) are therefore calculated as if there are no time-varying elements present at all, time \$t\$ doesn't appear in any of the calculations. They represent conditions that would be present if the circuit had been powered on, and left for all eternity to settle into a steady state, during which no voltage or current sources deviated by even the tiniest amount. These are the conditions used to determine initial capacitor voltages, and initial inductor currents.

Then the transient analysis begins, and because things are now changing over time, capacitor and inductor voltages and currents are changing. Whatever their average values become over time will obviously be different from those calculated under the naive assumption that nothing ever changes.

When you say "initial charging of C4", be careful. C4 was assumed to be charged to some some fixed voltage during the DC operating point calculations of static state, before time existed, but its average charge over time (and in the future) can be very different, once the circuit starts to experience dynamic conditions, since it is only when time is considered that the truth can be known.

You can tell the simulator to skip the DC operating point calculations, and assume that all capacitors have 0V across them, and all inductors have 0A through them at time \$t=0\$, prior to beginning the transient simulation, using the uic flag in the .tran directive:

.tran 100m uic

You can tell the simulator what initial DC voltage to assume for a named node, ignoring whatever value it calculated during .op, using .ic:

.ic V(some_node)=5

In the following circuit, .op would correctly surmise that after a long time, capacitor voltage will have risen to, and settled at, \$V_X=+5V\$:

enter image description here

The simple .tran will demonstrate \$V_X\$ starting at +5V and staying there for the rest of time, since the capacitor is already charged to 5V:

enter image description here

Adding a uic to the .tran will have the capacitor begin with no charge, corresponding to \$V_X(t=0)=0{\rm V}\$. With no charge at time \$t=0\$, obviously the capacitor's voltage will increase from zero over time, in the expected exponential manner:

enter image description here enter image description here

Using .ic we can say explicitly what state the capacitor shall have, prior to beginning the transient analysis. The .icV(x)=3 will cause capacitor voltage to begin at 3V, and rise from there:

enter image description here enter image description here

Now changing the voltage source to an AC oscillation about a DC average of +5V:

enter image description here enter image description here

The starting value at \$t=0\$ of the SIN() directive evaluates to +5V, no surprise, since \$5+sin(0)=5\$. and this is the value that .op uses to calculate starting conditions. You see above that \$V_X\$ does indeed start at +5V, but this is at a point in the cycle where V1 is rising, so .op predicted conditions at time \$t=0\$ which are not correct for a system that has been running for years. However, you do see that over time the capacitor does eventually adopt the expected average charge, where \$V_X\$ oscillates around +5V.

The next logical question is what would be the value of \$V_X\$, at each instant when V1 passes upwards through its +5V mean, assuming that the system had already been running for a while? In other words, what is a more appropriate \$V_X\$ at \$t=0\$? You could use algebra to figure it out, or you could do as I did, let the simulator predict that for you - I measured \$V_X\$ at \$t >> 0\$, as V1 passed upwards through +5V, and found it to be +4.96V. Set initial \$V_X\$ to exactly that:

enter image description here enter image description here

Here we see that by setting initial conditions to predicted correct values, rather than allowing .op to "guess" them, produces the correct, expected, long-term behaviour, right from the start, from \$t=0\$.

\$\endgroup\$
4
\$\begingroup\$

As Ste Kulov says in the comments, you need to set an initial condition for the base connection of Q1 as SPICE will start with a voltage of zero volts across the input capacitor C4. Add an .IC card to your simulation and set this to -0.25 at the node the base is connected to as shown in the simulation below. You may need to adjust the .ic voltage a bit due to the DC base voltage sitting at -73 mV.

icstatement

\$\endgroup\$
1
  • \$\begingroup\$ In other words, the DC component of the input during the DC operating point calculation (-2.5 V) is different than the DC component after a long time (0 V). The circuit response is the sum of a step response from -2.5 V to 0 V, plus the AC waveform. \$\endgroup\$ Commented Nov 4 at 16:26

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.