I want to simulate a 7 decade string DAC in LTspice for linearity and worst case, but I get the error message below. The type of simulation is operation point. The yellow rectangles are 2-pole rotary switches, which switch when the value of the internal variable is a given number (e.g. the first pair of switches switches switches at A==1, the second A==2). How can I switch each switch through?
-
\$\begingroup\$ What have you tried so far? \$\endgroup\$SnappyRiffs– SnappyRiffs2025-07-01 00:59:29 +00:00Commented Jul 1 at 0:59
-
1\$\begingroup\$ That's too many permutations for the simulator. Try doing a worst-case analysis instead of a monte carlo. It will result in less points to calculate. analog.com/en/resources/technical-articles/… \$\endgroup\$Ste Kulov– Ste Kulov2025-07-01 03:55:34 +00:00Commented Jul 1 at 3:55
2 Answers
You can't do it this way, because LTspice would have to step though all the parameters, each step function would be multiplied by the rest and you would have 10^7 simulations. It's likely that you don't have enough memory to run all those simulations and it would not make sense to graph them.
Make the switches voltage dependent, you can use b-sources to create functions that can switch the switches on and off. Use floor functions to simulate digital signals.
While another answer mentions correctly that you will run out of patience long before the simulation is done due to the combinations, you can do this type of combination using a single .STEP'ed parameter and modulo math.
The problem is that LTspice does not have modulo as a single operation, so you may want to define a function to extract the correct digit. I don't have LTspice right now, but here's a convoluted example to extract the 3rd least significant decimal digit. There are probably easier ways:
floor((x-floor(x/1000)*1000)/100)`
Use this expression with the right scaling for each DAC and a single .STEP'ed variable.


