Post Go back to editing

ac analysis with multiple behavioral sources

Thread Summary

The user encountered nonsensical results in AC analysis with a feedback loop containing multiple behavioral sources. The final answer explains this is a current limitation of LTspice, where AC components of device currents are assumed to be zero, affecting the behavioral source output. The workaround is to use a zero-volt ideal voltage source in series with the resistor to probe its current instead. The accompanying answers clarify that the issue might be related to the direct reference of the current through the resistor in the behavioral source expression.
AI Generated Content
Category: Software
Product Number: LTspice
Software Version: 26.0.1

Hi, I just wasted a lot of time understanding why this simple feedback loop gave nonsensical results in AC analysis. I have two behavioural sources in that loop with trivial expressions ; DC and transient analysis show expected function.

In an AC analysis (I'm trying to get gain-phase plots out of this), the feedback appears to be broken. If I bypass one of the sources (B3) by combining its expression into B2 , thus only a single behavioural source in the loop, then I get sane results.

In the attached file, this is simply done by swapping places of B1 and B2  (note that one refers to V(ctl), bypassing B3, while the other uses a current through B1 which itself refers to V(ctl)).

Is there some numerical reason for this not to work ?  or a bug ? If the former, is there a way for ltspice to warn me of whatever I'm doing wrong ?

The docs have " However, it is assumed that the circuit element current is varying quasi-statically, that is, there is no instantaneous feedback between the current through the referenced device and the behavioral source output." but I'm not sure that concerns my use case ?

overall loop.asc

  • Hi  ,

    Apologies, I'm having some trouble deducing if the attached file is "working as expected" or is the "problem schematic". I think the attached is the "good" version.

    In the attached file, this is simply done by swapping places of B1 and B2  (note that one refers to V(ctl), bypassing B3, while the other uses a current through B1 which itself refers to V(ctl)).

    I don't see B1 (directly) referencing V(ctr) in the file you sent. I think you mean to say:

    B1 references the current through the resistor R1, where that current is 10 • V(ctl).

    This might be an important distinction, as B1 directly references I(R1), which might be relevant wrt the following (in italics) in the help?

    …there is no instantaneous feedback between the current through the referenced device and the behavioral source output. Similarly, any ac component of such a device current is assumed to be zero in a small signal linear .AC analysis. 

    By inspection, b1 is at -390dB flat across the spectrum in AC analysis. I think this might be numerical limit?

    mike

  • I think the attached is the "good" version.

    That is correct, I could have been more clear. Version that corresponds to first the screenshot worked as expected.

    I'm still not sure about the interpretation of that paragraph - I understood that "instantaneous feedback" is not really the case since I'm closing the loop through an opamp (albeit ideal) and an RC 1-pole response ?

    In fact, even more puzzling is this simpler test I should've done earlier, below : no feedback at all; the B1 current source is just ignored in AC analysis (graph shows -inf dB) ... 

    And modifying the B2 expression to "V=0.5*I(R1)" also leads to a -inf db result. So... AC currents are just totally ignored by behavioural sources ?

  • Dear  ,

    This is a current limitation of LTspice. You are probing the current in a resistor, and the LTspice help explains:

    "Similarly, any ac component of such a device current is assumed to be zero in a small signal linear .AC analysis. These limitations stem from the modified nodal analysis (MNA) employed by LTspice, which leads to a set of equations that does not contain those device currents as solution. As a result, it is impossible to express a relationship between those device currents and the value of the behavioral source as equation. This does not apply to independent voltage sources, thus you can use these as current probes instead if required."

    Workaround: Put a zero volt ideal voltage source in series with said resistor and probe its current instead.

    Best Regards,
    Mathias

  • thanks for clarifying. interesting gotcha, I did not expect such a limitation but now that you mention the workaround, I do remember seeing some various schematics with 0V ideal sources and wondering why they did that and not probe device current directly...

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.