DCL Clamp Functions for Saturation

Module: Digital Control Library (DCL)

More…

Functions

Name

_DCL_CODE_ACCESS bool

DCL_runClamp(float32_t * data, float32_t Umax, float32_t Umin)
Saturates a control variable and returns true if either limit is exceeded.

_DCL_CODE_ACCESS bool

DCL_runClampF64(float64_t * data, float64_t Umax, float64_t Umin)
Saturates a control variable and returns true if either limit is exceeded.

Defines

Name

DCL_runSat(data, Umax, Umin)
Macro to saturate a control variable but does not change the data itself unlike runClamp()

DCL_runSatF64(data, Umax, Umin)
Macro to saturate a control variable but does not change the data itself unlike runClamp()

Detailed Description

Defines both single, double precision clamp function for saturation

Functions Documentation

function DCL_runClamp

_DCL_CODE_ACCESS bool DCL_runClamp(
    float32_t * data,
    float32_t Umax,
    float32_t Umin
)

Saturates a control variable and returns true if either limit is exceeded.

Parameters:

  • data The address of the data variable

  • Umax The upper limit

  • Umin The lower limit

Return: Returns ‘false’ if (Umin < data < Umax), else ‘true’

function DCL_runClampF64

_DCL_CODE_ACCESS bool DCL_runClampF64(
    float64_t * data,
    float64_t Umax,
    float64_t Umin
)

Saturates a control variable and returns true if either limit is exceeded.

Parameters:

  • data The address of the data variable

  • Umax The upper limit

  • Umin The lower limit

Return: Returns ‘false’ if (Umin < data < Umax), else ‘true’

Macros Documentation

define DCL_runSat

#define DCL_runSat(
    data,
    Umax,
    Umin
)
(data > Umax) ? Umax : (data < Umin) ? Umin : data

Macro to saturate a control variable but does not change the data itself unlike runClamp()

Parameters:

  • data The data value

  • Umax The upper limit

  • Umin The lower limit

Return: Returns unchanged data value is not saturated, else either Umax or Umin

define DCL_runSatF64

#define DCL_runSatF64(
    data,
    Umax,
    Umin
)
(data > Umax) ? Umax : (data < Umin) ? Umin : data

Macro to saturate a control variable but does not change the data itself unlike runClamp()

Parameters:

  • data The data value

  • Umax The upper limit

  • Umin The lower limit

Return: Returns unchanged data value is not saturated, else either Umax or Umin