2
\$\begingroup\$

In my LTspice simulation I would like to integrate a current source in an .AC analysis which has an amplitude that varies over the simulated frequency spectrum, e.g. something like \$A(f) = {A_0 \cdot f} \$.

Is the frequency in .AC not an accessible quantity as time is in a .tran analysis?

The red circlet part is obviously not working as intended here.

\$\endgroup\$
6
  • \$\begingroup\$ Just multiply by "f" \$\endgroup\$
    – Andy aka
    Aug 31 '21 at 13:41
  • \$\begingroup\$ unfortunately this doesn't work... \$\endgroup\$ Aug 31 '21 at 14:34
  • \$\begingroup\$ You are doing an AC analysis and using I2 as the input stimulus yes? How have you set up the analysis i.e. what is your output node? Is that output linearly dependent on I2? \$\endgroup\$
    – Andy aka
    Aug 31 '21 at 14:57
  • \$\begingroup\$ I use two current inputs, I1 (on the right hand side) with a constant input amplitude, and on the other hand I2 which is supposed to have a varying input amplitude that changes with the frequency. \$\endgroup\$ Aug 31 '21 at 15:03
  • \$\begingroup\$ That's about 50% of what I asked. \$\endgroup\$
    – Andy aka
    Aug 31 '21 at 15:07
2
\$\begingroup\$

I will not make any comments on what you're trying to simulate; I'll assume you know what you're doing.

The basic voltage or current source (your I2) can only accept numeric literals or parameter-style values -- and .param statements are all evaluated prior to simulation start, therefore none of them can be time or frequency dependent; i.e. they are "static". What you wrote as a value, {Amp*Frequency} (leaving Phi aside for now) implies the usage of two .param defined values, Amp and Frequency, both of which can only be static. Even if frequency is a keyword with special significance, it is only meaningful for the waveform arithmetic, which happens only inside the waveform viewer.

If you need your AC source to vary as \$\dfrac{1}{f}\$ then you need to use an integration, as you correctly assumed. The methods are different, though:

  1. use a current source with a capacitor across it, or
  2. a behavioural source with the idt() function (or sdt(), same thing).

If you use 1) then you will need to add a buffer between the current + cap and the rest of the circuit, unless the output drives a pure voltage input (e.g. the input of a VCVS). Seeing you are driving an LC tank, you need a buffer. The value of the capacitor will decide the frequency when the magnitude will be 0 dB. For 2) it's easier to simply use a bv or a bi (or bi2). An example for both cases:

test

B2 is divided by \$2\pi\$ which will make it have unity magnitude at 1 Hz.

As a side note, unless it was intended, you can press A to toggle the visibility of the anchors (the small circles beside the labels). Also unless intended, you can draw angled wires instead of that staircase by pressing Ctrl when moving the wires.

\$\endgroup\$
1
  • \$\begingroup\$ Laplace expressions also work in LTspice (in .AC, .TRAN may be problematic), as per Andy's answer. For that, in the left half of the picture, instead of the value 1 for the VCVS or VCCS, make it Laplace=<...>, and for the right half of the picture, instead of sdt() or idt() use V=V(1) Laplace=<...>, where <...> is some expression in s. \$\endgroup\$ Sep 1 '21 at 14:17
1
\$\begingroup\$

I use micro-cap and I would use a Laplace function like this: -

enter image description here

The AC analysis of Vout would be this: -

enter image description here

So, I'm using a voltage source (initially AC phase shifted by 90°) feeding through a Laplace term that happens to be "s" (i.e. integration) then controlling the current source.

As you should be able to see from the AC analysis, 0 dB corresponds with a frequency of 0.15915 Hz or 1 radian per second. Of course, the Laplace function can become whatever you want it to be in order to model the actual frequency relationship you want.

If you don't have the ability to use Laplace functions in your sim then insert an equivalent circuit between V1 and E1 that modifies V1 accordingly.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.