DCL Auxiliary Macros

Module: Digital Control Library (DCL)

More…

Defines

Name

NULL
NULL pointer.

CONST_PI
Local definitions of the mathematical constant pi.

CONST_2PI
2*PI

CONST_PI_F64
PI float 64b.

CONST_2PI_F64
2*PI float 64b

DCL_FPU32_TOL
Define the acceptable FPU numerical tolerances.

DCL_FPU64_TOL
See DCL_FPU32_TOL.

DCL_DEFAULT_PERIOD_S
Define the default control period in seconds.

DCL_DEFAULT_PERIODF64_S
See DCL_DEFAULT_PERIOD_S.

DCL_isValue(x, y)
Determines numerical proximity to specified value.

DCL_isValueF64(x, y)
See DCL_isValue.

DCL_isZero(x)
Determines floating point numerical proximity to zero.

DCL_isZeroF64(x)
See DCL_isZero.

DCL_rand(a)
Returns a random floating point result between -1.0 and +1.0 where ‘a’ is the multiplier in single or double precision. Useful for initialization of arrays and matrices during test.

DCL_randF64(a)
brief See DCL_rand

DCL_c2Limit
Defines the lower limit on derivative filter coefficient c2 in order for fc to lie below the Nyquist frequency.

DCL_c2LimitF64
brief See DCL_c2Limit

Detailed Description

Defines all the auxiliary macros for DCL

Macros Documentation

define NULL

#define NULL 0

NULL pointer.

define CONST_PI

#define CONST_PI 3.14159265358979323846f

Local definitions of the mathematical constant pi.

PI

define CONST_2PI

#define CONST_2PI 2.0f * CONST_PI

2*PI

define CONST_PI_F64

#define CONST_PI_F64 3.1415926535897932384626433832795028841971693993751058209749445923078164062L

PI float 64b.

define CONST_2PI_F64

#define CONST_2PI_F64 2.0L * CONST_PI_F64

2*PI float 64b

define DCL_FPU32_TOL

#define DCL_FPU32_TOL 1.0e-06f

Define the acceptable FPU numerical tolerances.

define DCL_FPU64_TOL

#define DCL_FPU64_TOL 1.0e-10L

See DCL_FPU32_TOL.

define DCL_DEFAULT_PERIOD_S

#define DCL_DEFAULT_PERIOD_S 100.0e-06f

Define the default control period in seconds.

define DCL_DEFAULT_PERIODF64_S

#define DCL_DEFAULT_PERIODF64_S 100.0e-06L

See DCL_DEFAULT_PERIOD_S.

define DCL_isValue

#define DCL_isValue(
    x,
    y
)
((float32_t)fabsf(x - y) < DCL_FPU32_TOL ? 1U : 0U)

Determines numerical proximity to specified value.

define DCL_isValueF64

#define DCL_isValueF64(
    x,
    y
)
((float64_t)fabs(x - y) < DCL_FPU64_TOL ? 1U : 0U)

See DCL_isValue.

define DCL_isZero

#define DCL_isZero(
    x
)
DCL_isValue(x, 0.0f)

Determines floating point numerical proximity to zero.

define DCL_isZeroF64

#define DCL_isZeroF64(
    x
)
DCL_isValueF64(x, 0.0L)

See DCL_isZero.

define DCL_rand

#define DCL_rand(
    a
)
(a * ((float32_t)rand() / (float32_t)(RAND_MAX >> 1) - 1.0f))

Returns a random floating point result between -1.0 and +1.0 where ‘a’ is the multiplier in single or double precision. Useful for initialization of arrays and matrices during test.

float32_t s = DCL_rand(1.0f);

define DCL_randF64

#define DCL_randF64(
    a
)
(a * ((float64_t)rand() / (float64_t)(RAND_MAX >> 1) - 1.0L))

brief See DCL_rand

define DCL_c2Limit

#define DCL_c2Limit ((2.0f - CONST_PI) / (2.0f + CONST_PI))

Defines the lower limit on derivative filter coefficient c2 in order for fc to lie below the Nyquist frequency.

define DCL_c2LimitF64

#define DCL_c2LimitF64 ((2.0L - CONST_PI_F64) / (2.0L + CONST_PI_F64))

brief See DCL_c2Limit