Basic Math, TRMS, AVG, Mean

Is there an easy way to calculate the TRMS, Average, Mean etc of a waveform

by jmirsky
July 13, 2013

At present, CL does not support scripting or the spice .measure statement which is what you need to calculate RMS and mean values (average is the same as mean) etc.

This:

shows a workaround but it is very clunky.

The example is for RMS but of course the M part of finding RMS demonstrates a way to find the mean.

This technique finds a rolling RMS or mean. It is much more complex to use this technique to find these and other values over a fixed time interval or number of cycles.

The .measure statement of spice is designed expressely for such functions so hopefully it will appear in CL.

:)

by signality
July 14, 2013

All of those math functions and no average or TRMS. If your going to charge you'd better get better fast.

I'm a M.E. (motor and generators). I use CL because its M.E. friendly. I don't use Spice because it's not.

by jmirsky
July 14, 2013

Thanks for the advice.

I wasn't aware you were not somehow associated with CL.

My experience with Spice (and it's been a long time) Is that it is a very powerful program that would take some time to learn.

CL has been quite easy to learn even trivial. The last public circuit that I posted actually is a real PMG system and the waveforms agree very well with the experimental results.

It should be understood that the experimental results were available before I ran the simulations. Until then I got all kinds of strange results. (mostly from unrealistic voltage references that are required for Sims).

That being said. If CL can Add, Subtract, Multiply, Divide and take Sq roots. It can Integrate, Average and Sum squares. It seems odd that every day O-Scope math functions are not right there next to the hyperbolic functions and a full set of complex analysis expressions.

I'm sure the developers at CL are charging now to pay for this type of development. I am a paying customer.

You are probably right It is time to move to something more powerful.

I guess you have exposed my inner lazy engineer.

Again, thank you for the thoughtful advice and the links.

by jmirsky
July 14, 2013

Hi @jmirsky. We are actively working on getting these types of functions you would expect to find in your O-Scope into the CircuitLab plots, I can even let you see a sneak preview!

Imgur

Other than RMS of a waveform, are there other Math functions you need and/or expect? I'll make sure they make it on the to-do list of this feature.

Best. Humberto

by hevans
July 14, 2013

I Take ALL my designs to hardware. Thus I need to compare sims with lab measurements.

I would love to see any measurements that One would expect of a mid grade Scope. I've copied The functions of A Tek MDO 4000. as an example.

Clearly all are not necessary. But I'm much to lazy to quantify.

Arithmetic Add, subtract, multiply, and divide waveforms. Math functions Integrate, Differentiate, FFT. FFT Spectral magnitude. Set FFT Vertical Scale to Linear RMS or dBV RMS, and FFT Window to Rectangular, Hamming, Hanning, or Blackman-Harris. Spectrum math Add or subtract frequency-domain traces. Advanced math Define extensive algebraic expressions including waveforms, reference waveforms, math functions (FFT, Intg, Diff, Log, Exp, Sqrt, Abs, Sine, Cosine, Tangent, Rad, Deg), scalars, up to two user-adjustable variables and results of parametric measurements (Period, Freq, Delay, Rise, Fall, PosWidth, NegWidth, BurstWidth, Phase, PosDutyCycle, NegDutyCycle, PosOverShoot, NegOverShoot, PeakPeak, Amplitude, RMS, CycleRMS, High, Low, Max, Min, Mean, CycleMean, Area, CycleArea, and trend plots), e.g.,(Intg(Ch1 - Mean(Ch1)) × 1.414 × VAR1). POWER MEASUREMENTS (OPTIONAL)

Power Quality Measurements VRMS, VCrest Factor, Frequency, IRMS, ICrest Factor, True Power, Apparent Power, Reactive Power, Power Factor, Phase Angle.

Secondy Speed. I would have no problem downloading some runtime engine functions to the PC so that some of the functions might run native.

Thanks

by jmirsky
July 15, 2013

Post a Reply

Please sign in or create an account to comment.