I am running an AC analysis on my schematic. In the AC analysis limits, the three Y expressions that I have specified are PDT, PST, and PGT in order to view the total power dissipated, stored, and generated in the schematic. I would expect that:
PGT = PDT + PST
When I run the simulation, the outputs of PDT and PST produce a sum greater than the value of PGT. However, if I plot the sum directly as:
PDT + PST
then the output of that expression will match exactly with the PGT waveform. What is happening?
In AC analysis, the internal calculations are performed using complex mathematical operators. An expression such as PDT is actually calculated as a complex number, but when it is plotted to the screen, it is displayed as a magnitude unless an operator such as RE() or IM() is used in conjunction with it. When PDT, PST, and PGT are all plotted individually, the magnitude of PGT will not equal the sum of the magnitudes of PDT and PST as the sum would be equivalent to the following:
SQRT( RE(PDT)^2 + IM(PDT)^2 ) + SQRT( RE(PST)^2 + IM(PST)^2 )
whereas the PGT magnitude would be equivalent to:
SQRT( (RE(PDT) + RE(PST))^2 + (IM(PDT) + IM(PST))^2 )
The reason that the PDT + PST waveform plot produces a match to the PGT waveform is that the magnitude operation is the last calculation done before plotting to the screen. When the addition operation occurs, the power values are still in complex form and the addition is therefore a complex operation where:
(RE(PDT) + RE(PST)) + (IM(PDT) + IM(PST))
This case is also applicable to voltages and currents when plotted in an AC analysis.