Phase measurement simulation

Hello everyone. I have a question that is so basic, I'm almost embarrassed to ask it: When Circuitlab displays the phase of a current or voltage in a time domain simulation, what is used as the reference waveform?

In a Bode plot, I know that the simulation displays the phase difference between the output voltage and the input voltage. But I don't understand what happens when simulating in the time domain. For example, in a basic circuit with only an AC voltage source and load resistor, the phase display of voltage is a square wave swinging from 0 to 180 degrees in phase with the input sinewave. Obviously I'm missing something very basic.

So I'm going to have a cup of tea and wait until someone will be kind enough to help me understand this.

Thank you very much.

by lsears
August 24, 2022

Hi there, it's a good question and I see the opportunity for confusion!

The phase expressions PH(...) and PHDEG(...) are only defined within the Frequency domain simulation (Bode plot) simulation mode: see the table of Expressions documentation.

It's merely an artifact of the underlying math that you're seeing the square wave of 0 to 180 degrees phase, because PHDEG(...) is trying to take the phase of the signal value as a complex number. In the frequency-domain simulation, the simulation engine's output is a complex number (at each frequency). But in the time-domain, it's a real number (at each time step), so the phases that result are only 0 and 180.

If you'd like to accomplish a phase measurement within time-domain simulation, you'll have to manually use the green vertical measurement cursors on the time-domain graph. For example, you can manually drag one cursor from the left side of the window onto the peak of your input signal, and then manually drag the other cursor from the right side of the plot area onto the peak of the output signal. This will display a delta-T value for you, which you could then convert into a phase as a fraction of your input period. Hope that helps.

by mrobbins
August 24, 2022

Thank You!. I neglected to look at the "context" column in "expressions"; of course this makes perfect sense. ( I had resorted to the delta-T technique)

One more question; in a freq domain (Bode) simulation, how does the program select an input voltage for the phase reference? What about a complicated circuit with more than one source? Thanks again..

by lsears
August 24, 2022

As far as the input source in Frequency Domain simulation, see the Frequency Domain documentation. This specifies three ways you can specify the stimulated input source:

  • V1 which implies that source element named V1 with magnitude 1 and phase 0
  • V1 2 90 which implies an source element named V1 with magnitude 2 and phase 90 degrees
  • V1 0.5 0 V2 0.5 180` which implies two source elements, V1 and V2, which both have magnitude 0.5, but are 180 degrees out of phase. This might be useful for simulating the frequency response of a differential pair, for example.

By far the most common use is simply specifying a single source V1 or I1 for example. And that input is always considered to have unity magnitude and zero phase.

Any source inputs that aren't explicitly specified in the Frequency Domain simulation tab are treated as though they are at their respective DC values. This is a reflection of the Bode plot's use of a linearized small-signal model. Since it's a linearized small-signal model, we're really only interested in the relative magnitude and the relative phase (relative to the specified input source[s]).

by mrobbins
August 24, 2022

Thanks again for your prompt and helpful response. I guess I really should spend more time with the documentation. I think I am good to go. Regards....

by lsears
August 25, 2022

Post a Reply

Please sign in or create an account to comment.

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.