Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Overview

Slew rate limiter

Discussion

Slew rate limiter that restricts the rate of change of a signal. The module computes the derivative of a signal and limits positive values to .maxSlew and minimum values to .minSlew. This mimics slew rate limiting that occurs in analog amplifiers.

The .units variable specifies how .maxSlew and .minSlew should be interpreted.

.units = 0 means that the slew rates are per sample.

.units = 1 means that the slew rates are per millisecond.

.units = 2 means that the slew rates are per second (the default).

Internally, the function uses the hidden variables .maxSlewSample and .minSlewSample does limiting on a sample by sample basis. The module's set function converts from .maxSlew and .minSlew to .maxSlewSample and .minSlewSample based on .units.

The .reset flag forces the output value to match the input value. This temporarily stops slew rate limiting for 1 sample period. By default, .reset=1 when the module is constructed. This causes the module to start in a converged state (no slew limiting on the first sample). Otherwise, if you set .reset=0 before the module is built it causes the module output to start at 0 and apply slew limiting immediately.

Type Definition

typedef struct _ModuleSlewRateLimiter
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 units;                                  // Specifies the units for the minSlew and maxSlew variables (0=sample, 1=msec, 2=sec)
    FLOAT32 minSlew;                              // Minimum allowed slew rate
    FLOAT32 maxSlew;                              // Maximum allowed slew rate
    INT32 reset;                                  // Forces the output to equal the input
    FLOAT32 minSlewSample;                        // Minimum allowed slew rate per sample
    FLOAT32 maxSlewSample;                        // Maximum allowed slew rate per sample
    FLOAT32* state;                               // State variables. One per channel
} ModuleSlewRateLimiterClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

units

int

parameter

0

2

0:2

minSlew

float

parameter

0

-100

Unrestricted

maxSlew

float

parameter

0

100

Unrestricted

reset

int

parameter

0

1

Unrestricted

minSlewSample

float

derived

1

-0.002083

Unrestricted

maxSlewSample

float

derived

1

0.002083

Unrestricted

state

float*

state

1

[1 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: Input signal

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Output signal

Data type: float

MATLAB Usage

File Name: slew_rate_limiter_module.m

 M=slew_rate_limiter_module(NAME)
 Slew rate limiter module.  It limits the maximum change of a signal
 (that is, its derivative).  There are separate controls for positive
 and negative slewing.  Arguments:
    NAME - name of the module.

  • No labels