Simulating equations in LTSPICE

capacitorcurrentequationltspicesensor

I have a dependent current source which depends on external pressure given by quadratic equation. Is it possible to simulate it in LTspice and see the graph between voltage or current and pressure?

Best Answer

If I get it right, you have a sensor in your project that acts as a current source generating a current proportional to a measured pressure squared and you want to simulate this sensor in the circuitry with the purpose of being able to perform, for example, a parametric DC sweep analysis sort of 'the instrumentation circuit output versus measured pressure'. If this is the case, you need a behavioral current source (symbol name BI**) of the LTSpice component registry.

To give you an idea of behavioral modeling, I show you a circuit that you can simulate in the online CircuitLab simulator on this page.

schematic

simulate this circuit – Schematic created using CircuitLab

You press the button Simulate this circuit and, in Simulation panel, select DC Sweep. The parameter to sweep is an ext_P voltage source voltage, which represents in our simulation a pressure to be measured. We imply that volt units of this parameter correspond to pressure units -- millibars, for example. The component MUL1 squares this parameter, and the MUL1 output is fed to a dependent current course VCCS1. The subcircuit of these three components, ext_P, MUL1, and VCCS1, is a model of your pressure gauge. The output current sourced is measured at a terminal of VCCS1 or of an ammeter.

You select start and end parameter values (e.g., 0 and 5), a step value (0.1), and press Run DC Sweep. The results of simulation is plotted to a graph window. enter image description here Using a behavioral current source, you can construct an LTSpice simulation in a similar way. With LTSpice, you need not compose a subcircuit of three components ext_P, MUL1, and VCCS1 as I did with the online simulator. Your pressure gauge will be modeled in your circuit with a behavioral current source BI with a duly selected parameters.

Among these 'duly selected parameters', of course, is a function-expression, 'I=[expression]', like in

BI1 n1 n2 I=square(ext_P)

According to B sources (complete reference), square(x) is an undocumented function; if you have doubts about using undocumented functions, you can use a documented power function pow(x,y)

BI1 n1 n2 I=pow(ext_P, 2)