On 06/05/2025 18:41, Andy I via
groups.io wrote:
On Tue, May 6, 2025 at 09:33 AM, Tony Casey wrote:
Assuming you want to calculate the average inductor
current:
.MEAS Imax max I(L_filter_dc)
.MEAS Imin min I(L_filter_dc)
.MEAS Imid param (Imax+Imin)/2
.MEAS Tstart when I(L_filter_dc)=Imid rise=2
.MEAS Tstop when I(L_filter_dc)=Imid rise=3
.MEAS Iavg avg I(L_filter_dc) from Tstart to Tstop
If I understand correctly, that would of course find the average
inductor current over one complete cycle.
?
But Ankit wants to find the average voltage over three
distinct time intervals, each of which is a portion of one
cycle:
- The rising inductor current,
- The falling inductor current,
- The interval where the inductor current is zero.
These three intervals are identified as t0-to-t1, t1-to-t2,
and t2-to-t3??-- or as d1Ts, d2Ts, and d3Ts -- in the second
photo
that Ankit uploaded earlier today.
?
That is a little more challenging because one wants to
identify the starting and ending times of each of the three
semi-linear portion of the I(L) waveform, but there is some
noise (ringing) which makes finding the exact corners
challenging.
?
That is why I recommended adding guard bands.? Instead of
looking for
? ? I(L_filter_DC)=0,
Ankit may want to test for
? ? I(L_filter_DC)=50m
or some other number (75mV, 200mV, ?mV) that is not exactly
zero, but large enough to be unaffected by ringing.? Admittedly
it requires Ankit to accept the errors caused by measuring over
inexact time intervals.? I think it may be a necessary
trade-off.
?
The mechanics of putting that into one or a collection of
.MEAS commands is another matter.? Perhaps the syntax Ankit used
was incorrect (but we may never know because of unwillingness to
show the non-working .MEAS commands).? Or perhaps the tested
events never happened.? Unfortunately, the error message can be
the same in either case, making it challenging to diagnose.?
Breaking it up into multiple .MEAS commands does help and you
can see where it fails.
The screenshot caption simply states "Calculate average value of a
waveform under specific conditions using .meas command". So that's
what I did, assuming the interval was 1 cycle.
For finding a good estimate of the start and stop times of the
transitions, the best method is to look for the highest and lowest
values of the derivative of the repetitive waveform, and then find
the time when (say) 98% of those values are achieved, to allow for
inconsistent peaks (better with Tmax in the .TRAN directive) , e.g.
.MEAS MaxdV max d( I(L_filter_dc)) ; max +v derivative
.MEAS T1 when d( I(L_filter_dc))=0.98*MaxdV rise=1 ; start of 1st
+ve transition
.MEAS MindV min d( I(L_filter_dc)) ; max -ve derivative
.MEAS T2 when d( I(L_filter_dc))=0.98*MindV fall=1 ; start of 1st
-ve transition
.MEAS T3 when d( I(L_filter_dc))=0.98*MaxdV td=T2 rise=1 ; start 2nd
+ve transition
Then find the averages of whatever intervals are required.
--
Regards,
Tony