Electrical – Changing parameter values from a value list file in SPICE

ltspicengspicespice

In my circuit, there is a current generator. This generator generates vaules dependent on a parameter, we called N. But I want to use parameter as a variable. If values change linear, I will use .step function. But my values are gaussian distributed and 10k different value. Thus .step function does not suitable for me.

My question is, could I change N parameter value from an out .txt file continuously as .step function ?

Now, I'm using LTSpice. Tell me if any useful SPICE application you know.
I know PWL() function changes current generator values with a file. But there is a mathmetical formula in I2() and N parameter using in that.

Best Answer

Re-reading this now I think I understand what OP wants: to use a custom sequence of numbers that can be used in a .step command. If this is the case, I'll try to answer.

Normally, for a non-linear sequence of numbers that is not logarithmic, the keyword list is used. Unfortunately, it doesn't allow evaluations, i.e. the values must be numeric, {cos(1)} or {2*5} will fail. So about the only solution would be to generate the numbers externally, in a plain text file, as a single line, or as a concatenated line (with + in front of each new line), and add:

.step param x list <sequence_of_numbers>

at the beginning. This file can then be added to the schematic with the .inc (or .include) command. Don't forget that LTspice XVII sorts the numbers in ascending order prior to simulation start. You may, or may not like it, but that's how it is now. The only way to circumvent this is to use LTspice IV.

To test this, the text file's contents looks like this:

.step param x list 7.254322142991044e-12 2.974321522582202e-10
+ 5.94864415973779e-9 7.733237831307738e-8 7.346575989515156e-7
+ 5.436466237528063e-6 3.261879742903331e-5 1.630939871486926e-4
+ 6.931494453849666e-4   0.02292014166076882 0.05730035415192529
+ 0.1278238669542985 0.2556477339086 0.4601659210354829 0.7477696216826623
+ 1.099661208356858 1.466214944475812 1.774891774891774 1.952380952380952

and the schematic gives this after a .op:

test

The numbers are some would-be Gaussian bell shape. The output looks like a straight line, but using the View > Mark Data Points shows that the distribution is nonlinear. Using .tran will show different DC levels, as expected.