Adventures with .MEASURE in LTSPICE

.MEASURE or .MEAS is a very convenient and one of the few options for built in post processing of simulation results in LTSPICE. Though, you should be careful, while using it.

If you are using periodic functions in .MEASURE, argument is in degrees. It is in radian for similar functions in simulation. It is confusing, because simulation and postprosessing (.MEASURE) are using different units.

This means, that if you are using something like V=V(In)*sin(2*pi*time*Fg) in your schematic or subsircuit, you should use V(In)*sin(360*time*Fg) in .MEASURE command.

You can change default argument representation of periodic functions in .MEASURE to radians by checking corresponding option in Waveform tab of LTSPICE Control Panel.

If you want to use results of one .MEASURE command in calculations, done by the other .MEASURE command, you have to use param keyword in .MEASURE statement.

Example:

.meas RMSVOLTAGE RMS V(input)

.meas AVGVOLTAGE AVG V(input)

.meas DELTA param (RMSVOLTAGE-AVGVOLTAGE)  is working

.meas DELTA (RMSVOLTAGE-AVGVOLTAGE)  does not work

Some symbols should not be used in the names of variables. I had troubles using % sign at the end of variable name. It works fine until you will use this variable name as an argument of a function, used in other .MEASURE command

You should not use variable names, starting with number, as an argument of a function used in other .MEASURE command. You can use numbers as a portion of variable name in any position, other than the first one.

This LTSPICE file will show some examples of .MEAS statement

Comments

One Response to Adventures with .MEASURE in LTSPICE

  1. Eugene says:

    Some additional info on using % at the end of variable name: as I mentioned, it works fine if you are not using it as an argument of an equation.
    However, if you are doing stepping and then trying to plot this variable, you will get an undefined symbol error. Though, it is calculated properly in SPICE Error Log file.