ADG5248F
Production
The ADG5248F and ADG5249F are 8:1 and dual 4:1 analog multiplexers. The ADG5248F switches one of eight inputs to a common output and the ADG5249F switches...
Datasheet
ADG5248F on Analog.com
As I mentioned in my last post, Can LTspice Break Physics? I keep an eye on the LTspice page on EngineerZone for interesting problems. To wit, from EngineerZone:
Here a customer wanted to create a model for an analog switch, using an ‘IF’ statement in a behavioral resistance. For example, if the control voltage was above a certain threshold, it would be ‘ON’ and have a resistance of milli-ohms but if it was below the threshold then it would be ‘OFF’ and have a resistance of a giga-ohm.
If you take a look at most LTspice models of switches or multiplexers such as the ADG5248F Fault Protected 8:1 Mux, which is in the ADG.lib file (found in the C:\Users\...\AppData\Local\LTspice\lib\sub directory) you will see that the switch is modeled by a number of Voltage Controlled Switch definitions (see LTspice Voltage Controlled Switches for more information) with the parasitic elements modeled around them to give an accurate simulation model. In fact, each individual FET switch in the mux is modeled by a Voltage Controlled Switch.
Figure 1. Voltage Controlled Switch in LTspice
My initial thought was that if the Voltage Controlled Switch defines the ‘ON’ and ‘OFF’ resistances, the threshold (Vt), and the hysteresis (Vh) then why would you use anything else?
It turned out that the customer wanted a simple model, as the switch was going to be part of a more complex simulation. Once they were aware of the Voltage Controlled Switch, this fitted the customer’s needs perfectly. However, they believed that it was not possible that a switch could be modeled by a simple resistor – Well, challenge accepted!
We came across the wonder of behavioral sources in a previous post in this blog series Conservation of Energy. In that post, we used a behavioral voltage source to display the common-mode and differential-mode switching noise of a DC-DC converter, connected to an LTspice model of a LISN, used in EMC testing.
Figure 2. Behavioral Sources in LTspice
Whilst LTspice has behavioral current (BI) and behavioral voltage (BV) sources, there is another, undocumented behavioral source, the behavioral resistor, and this is what the customer was originally trying to use.
Actually, there is a fourth behavioral source, a constant power load (PV) which is covered here: LTspice Modeling Constant Power Loads.
Figure 3. Constant Resistance, Constant Current, and Constant Power Loads
In essence, we can use any behavioral source symbol (BI or BV) and then edit the V = <expression> or I = <expression> to define a constant power load, P = <expression>.
Well, it turns out that you can do the same thing to define a behavioral resistor. In this case, we can change the syntax to R = <expression>. For example, R=(IF(V(control)>2.5,0.5,1000meg)).
Figure 4. Defining Behavioral Resistance
It does not matter which arbitrary (current or voltage) source symbol you use for the expression, since the syntax (V, I, P, or R) describes the behavior, not the symbol.
Figure 5. Resistance vs. Control Voltage
This is simulating the customer’s desired simple behavior. It doesn’t include any hysteresis but if you need hysteresis, you can always revert to using the switch model instead.
In the customer’s simulation, they had actually defined a subcircuit model instead. The customer’s syntax needed a bit of tidying up but otherwise, this is a perfectly good alternative to the method we used earlier. If you open the .cir file in LTspice, you can just right-click on the subcircuit name (BResSW in this case) and select ‘Create Symbol’ from the menu.
Figure 6. Creating a Symbol from a Subcircuit
Once the symbol is created, it will appear in your ‘[AutoGenerated]’ symbols in LTspice and you can add it to your schematics.
We looked at a couple of different behavioral sources, the constant power load (BP) and arbitrary resistance (BR). One word of caution, be careful when writing your functions, as you may get strange results if R ever goes to zero or if the divisor (R=V/I) is zero. Remember, you can add the LTspice directive, .options numdgt=15 if you need more precision in the calculation, especially if your 'ON' and 'OFF' resistances are many orders of magnitude different.
Until next time – happy simulations!