LTspice: Using .MEAS and .STEP Commands to Calculate Efficiency

Predicting the efficiency of an application is vital to evaluating design trade-offs of a switching mode power supply. Two useful tools, the .step and .meas commands, can be used to calculate and plot efficiency over a range of load currents.

To evaluate efficiency, clearly label your input and output voltage net as IN and OUT, respectively. Press F4 to place net names. Replace your resistive load with a independent current source as shown below and define the value using a global variable {Iload}. Press F2 and type load2 in the search box to select and place the component. Edit the component value by right-clicking on the symbol and enter the variable {Iload}. Note the names of the input voltage source (V1) and the load current source (I1).

SMPS Efficiency Schematic

The .step command is useful for sweeping a variable across a range of values in a single simulation run. The variable can be temperature, a model parameter, a global parameter or in our case an independent source. These steps can be defined as linear, logarithmic or as a list of specific values.

Insert a .step command into your schematic as a SPICE directive and step the independent current source from a light load to maximum current load and define the step increments. (You can use the S hotkey to add and place a SPICE directive.)

Here, we step the independent current source, I1, from 0.2A to 1.2A in 0.1A increments using a global variable defined as {Iload}. The param directive is used here in the .step command to allow for the creation of this user-defined variable. Please see the help file (F1) for more details on .step command and param directive.

.step param Iload .2 1.2 .1

It is important to calculate efficiency when the circuit is operating in a steady state. To ensure this, simulate your circuit, and note when steady state is achieved for all conditions in the .step command, extending simulation stop time if needed. Use this observation to set the the “time to start saving data” and “stop time” to encompass a short duration within the observed steady state period. In the .tran statement below, we start to save data at 2ms and stop at 2.1ms.

.tran 0 2.1m 2m startup

The .meas command is useful for measuring a range over the abscissa (as well as one point on the abscissa). Add the following expressions as a SPICE directive to calculate the average input power (Pin), average output power (Pout) and the efficiency (Eff). Please note the current direction convention for the input voltage source, V1, is into the device, hence the negative sign in the Pin calculation. The final expression calculates the efficiency using the param directive for clarity. Run your simulation. Please see the help file (F1) for more details on .meas command.

.meas Pin AVG -V(IN)*I(V1)
.meas Pout AVG V(OUT)*I(I1)
.meas Eff param Pout/Pin

Once the simulation completes, right-click one of the windows, select view and select Spice Error Log (or use the Ctrl+L hotkey). The Spice Error Log contains data points for the .meas statements to include the efficiency calculations.

LTspice Error Log

One neat feature of LTspice is the ability to plot the stepped .meas data over the abscissa (Iload). To plot the data, right-click the error log and select the Plot step’ed .meas data, right-click on the blank screen to select Add Trace (or use Ctrl+A) and select Eff. This will display the efficiency calculation over stepped load current.

SMPS Efficiency Waveform

Of course, calculating efficiency is only one example. The .meas and .step commands can be combined in countless other ways to characterize your analog circuit designs.



Gabino Alonso

Gabino Alonso目前是Power by Linear™部门的战略营销总监。加入ADI公司之前,Gabino在凌力尔特、德州仪器、加州理工州立大学担任过市场营销、工程、运营和讲师等多个职位。他拥有加州大学圣巴巴拉分校电子和计算机工程硕士学位。