Hello Hermione,

The rising slew follows the equation:

y = 1 - e^ ( -t / T) where y is the linear gain which begins at zero and rises toward one, t is elapsed time, and T is the time constant which is a property of the slewing which depends upon the slew number.

We can solve this backwards and get:

(t / T) = - ln (1 - y) where (t / T) represents the number of time constants we need to wait to achieve the final gain y. For example, y = 0.99, then:

(t / T) = - ln (1 - 0.99) = - ln (0.01) = 4.605 ....

The Peak Envelope Block tracks the sine wave as it rises from zero, then holds onto its maximum value -- which will be near 1.0 for a 0 dB sine wave, or about 0.32 tor a -10 dB one. Once the peak has passed, the sine wave slopes downward while the Peak Envelope Block's output would normally decay slowly down toward zero until the next peak occurs. Since you've set the decay rate to zero, it never decays but instead remains at the peak value.

With very small slew numbers, the slew completes while the sine wave is still in its first upward slope. In this case the output of the Peak Envelope Block is the same as its input, and the count is correct. With large slew numbers, the slewing is slow, covering many cycles of sine wave -- so the the circuit finds one of these peaks and provides a reasonably close count. It's when the slewing time to 99% occurs between 0.25 mS (the first peak at 1 kHz) and 0.75 mS (the second peak) that you get poor results.

There is no error in your logic -- it's just an limitation of this method generally. If you need only to measure the slewing time of the Slew Volume Control (or similar device) where you have access to the sine wave both before and after it, you can get better results by substituting Absolute Value blocks for the Peak Envelope Blocks. In fact, you need not use a sine wave at all -- the Slew Volume Control works with DC, so using a DC input gets rid of the hassles with the sine wave altogether.

For the general case, for example, comparing the levels of two sine sources which may differ in frequency and phase, you really need Peak Envelope Blocks on each -- and live with the resulting errors at certain rates of rise.

Best regards,

Bob