Keyboard Shortcuts
Likes
Search
Text substitution in .meas files
#meas
I am using a .meas file to run after the simulation completes. As this has now grown considerably being able to use text substitution would help enormously but I can't figure out the syntax.?
For example the measurements are taken over a time period,i.e. "FROM 6.3e-3 TO 7.3e-3" so if I want to change this, I have to change every line that contains it. It would better if I could set this once as a parameter and then use that parameter on each line. I've tried various combinations of param, .param, traditional string commands but to no avail. Is it possible to do this and if so, what is the correct syntax please and is there a cheat sheet anywhere? Many thanks Neil ? |
Neil wrote, "I am using a .meas file to run after the simulation completes."
I just want to clarify one thing, which is probably obvious.? You run this .MEAS script from the waveform viewer, right?? (I ask because all .MEAS commands that are in the simulation itself, are executed only after the simulation itself has completed, even though LTspice says that it's still running.) I'm not familiar with .MEAS scripts from the waveform viewer.? There is a Plot Defs file.? Have you been editing that file to include your parameter definitions?? When you refer to the parameters, are you using {curly braces} around them?? This might not help because my experience there is approximately zero. Andy |
Hello Neil
I am using a .meas file to run after the simulation completes. As this hasIf I understand correctly, you want something like this: .meas t1 param 6.3m .meas t2 param 7.3m .meas a avg v(x) from t1 to t2 .meas b rms i(v1) from t1 to t2 . . . Alternatively, you can define t1 and t2 as parameters: .param t1=6.3m t2=7.3m but then you'd have to re-run the simulation so that the .PARAMs are recalculated. With .MEAS they will be available only inside the .MEAS script. Looking at the values for t1 and t2 (as you exemplified), maybe you need these to be calculated for (say) a period of some frequency. Then you can more easily define them as: .meas freq param 1k .meas delay param 0.3/f .meas t1 param 6/f+delay .meas t2 param 7/f+delay If the frequency, itself, is a variable to be determined from measurements, then you could also use this: .meas tmp1 find time when v(x)=0 cross=13 ; or some other trigger .meas tmp2 find time when v(x)=0 cross=15 .meas f param 1/(tmp2-tmp1) ; and now continue with t1, t2, etc -- Vlad ______________________ ltspicegoodies.ltwiki.org v2: quite universal analog/digital filter, power electronics, signal processing, easy to work with math functions, digital models, and rants. |
¿ªÔÆÌåÓýYes, I am running the .meas script from the waveform window. ? Vlad was spot on with his answer. The syntax I was looking for is ? .meas <identifier> param <value> ? e.g. .meas t1 param 6.3m ? Neil ? From: [email protected] <[email protected]> On Behalf Of Andy I
Sent: 22 February 2021 18:16 To: [email protected] Subject: Re: [LTspice] Text substitution in .meas files ? Neil wrote, "I am using a .meas file to run after the simulation completes." |