LTSpice .meas Help - Page 1
Forum section: electronics / projects

author: Glenn0010
author_rank: Regular Contributor
timestamp: August 18, 2019, 03:15:50 pm
content: Hi all,I am not very used to spice directives and would like some wisdom.I have the circuit below where I am to measure the different fall time of an IGBT under different load currents. I have done .meas scripts however this only does the measurement for the first fall time. I would like this to be repeated for all the rest of them. other than copy pasting it several times, is there a more elegant way of doing this?Cheers

author: SiliconWizard
author_rank: Super Contributor
timestamp: August 18, 2019, 03:33:51 pm
content: Off the top of my head, I would try something like this:- Make V1 only generate ONE pulse.- Use a parameter for the load current.- Use a .STEP directive to make above parameter sweep through the intended range.- Keep your .MEAS directives as is.But some questions: how do you modulate the load current here? Is something important hidden by the Cursors Window?

author: Glenn0010
author_rank: Regular Contributor
timestamp: August 18, 2019, 03:44:03 pm
content: Quote from: SiliconWizard on August 18, 2019, 03:33:51 pmThe load current is dictated by then inductor size. The value of the inductor dictates the rise time, if this simulation were longer the inductor current would keep on rising.Using the step command can I "set" the current through the inductor? Say setting an initial condition

author: SiliconWizard
author_rank: Super Contributor
timestamp: August 18, 2019, 03:46:07 pm
content: Ok, makes sense now. But sorry to be thick, where is the power supply? Is it not hidden on the right?

author: Glenn0010
author_rank: Regular Contributor
timestamp: August 18, 2019, 03:47:15 pm
content: Oh yes it is, it is a 800v dc supply

author: SiliconWizard
author_rank: Super Contributor
timestamp: August 18, 2019, 04:33:35 pm
content: I see.Well I don't think you can really do anything but add more .measure directives to do this. You can't just copy the ones you showed, because they will always only get the first falling edge. You'll need to add some TRIG parameter to them I think, to get measurements for each next falling edge.One way to only write the 3 .MEAS directives once would be to use a .STEP directive, and step a parameter for the trigger point (parameters can be used in .MEAS directives). Downside is, it would launch a simulation for each stepped parameter, whereas the parameter would only influence the measurements and not the transient analysis itself, so wasted time. If the simulation is fast, that's an option though to automate the process. (Hope you got what I meant.)

author: Dmeads
author_rank: Regular Contributor
timestamp: August 18, 2019, 06:33:24 pm
content: if you put create a parameter for your the inductance value by putting it in curly brackets and naming it (i.e. load or whatever you want),then you can use a list and step through the values you want to see results from. the different colors on the waveform show the different results from the sweep. I believe the first value in your list would correspond to whatever the first color is in you waveform color preferences, and the second corresponds to the second color...check the picture.let me know if this helps

author: Ian.M
author_rank: Super Contributor
timestamp: August 18, 2019, 07:20:51 pm
content: *DON'T* *FORGET* to useCode:.opt plotwinsize=0so your .measure statements run against the raw results that haven't been compressed.Parameterize the time to start saving data from in the .tran command and .step it. Its still inefficient as it re-runs the sim for each set of .measure commands.Alternatively, if sim run time is a significant problem, knock up a repeated .measure script generator in whatever high level language with good string handling you prefer (or even in a spreadsheet!), and use it to increment an instance number for the .measured variable names, and to increase TD in the measure command to pick out the pulses in turn, outputting a script with the repeated .measure commands you need. Run it against the sim results using File=>Execute .MEAS Script with the plot window in focus.N.B. If using TRIG and TARG you need a TD for each of them. RISE/FALL/CROSS=count aren't reliable because they tend to count nearly invisible ringing on edges and glitches due to sim artifacts.

author: Glenn0010
author_rank: Regular Contributor
timestamp: August 20, 2019, 07:21:31 am
content: Hi All thanks for all your help!I have been busy these past 2 days but have managed to do some work on it.What I have done is initialized the inductor initial condition as a parameter, then I am stepping through that parameter.I have also implemented some of the suggestions you guys made.Let me know if there are any obvious flaws in my logic there. Cheers