Data Structures | Macros | Functions
example_surface_velocity.c File Reference
`#include <complex.h>`
`#include <math.h>`
`#include <stdbool.h>`
`#include <stdint.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include "acc_alg_basic_utils.h"`
`#include "acc_algorithm.h"`
`#include "acc_config.h"`
`#include "acc_definitions_a121.h"`
`#include "acc_definitions_common.h"`
`#include "acc_hal_definitions_a121.h"`
`#include "acc_hal_integration_a121.h"`
`#include "acc_integration.h"`
`#include "acc_integration_log.h"`
`#include "acc_processing.h"`
`#include "acc_rss_a121.h"`
`#include "acc_sensor.h"`
`#include "acc_version.h"`

Go to the source code of this file.

## Data Structures
struct | acc_surface_velocity_config_t
| Surface velocity application config container. More...
struct | acc_surface_velocity_handle_t
| Surface velocity application context handle. More...
struct | acc_surface_velocity_result_t
| Surface velocity application results container. More...

## Macros
#define | CONFIG_SURFACE_DISTANCE (1.0f)
#define | CONFIG_SENSOR_ANGLE (45.0f)
#define | CONFIG_THRESHOLD_SENSITIVITY (0.15f)
#define | CONFIG_PSD_LP_COEFF (0.75f)
#define | CONFIG_VELOCITY_LP_COEFF (0.98f)
#define | CONFIG_SWEEP_RATE (3000U)
#define | CONFIG_HWAAS (16U)
#define | SENSOR_ID (1U)
#define | SENSOR_TIMEOUT_MS (1000U)
#define | MIN_PEAK_VS 0.1f
#define | APPROX_BASE_STEP_LENGTH_M 2.5e-3f

## Functions
static void | cleanup (acc_surface_velocity_handle_t *handle, acc_surface_velocity_config_t *config)
static void | set_config (acc_surface_velocity_config_t *config)
static void | set_prf (acc_surface_velocity_config_t *config)
static void | set_profile (acc_surface_velocity_config_t *config)
static bool | validate_config (acc_surface_velocity_config_t *config)
static bool | do_sensor_calibration_and_prepare (acc_surface_velocity_handle_t *handle, acc_surface_velocity_config_t *config)
static bool | init_handle (acc_surface_velocity_handle_t *handle, acc_surface_velocity_config_t *config)
static bool | init_sensor_resources (acc_surface_velocity_handle_t *handle, acc_surface_velocity_config_t *config)
static bool | measure (acc_surface_velocity_handle_t *handle)
static bool | process (acc_surface_velocity_handle_t *handle, acc_surface_velocity_result_t *result)
static void | print_result (acc_surface_velocity_result_t *result)
static void | update_threshold (acc_surface_velocity_handle_t *handle)
static bool | get_velocity_estimate (acc_surface_velocity_handle_t *handle)
static float | get_angle_correction (float surface_distance, float distance)
static uint16_t | calc_power_spectral_density (acc_surface_velocity_handle_t *handle)
| Calculate PSD (power spectral density) More...
static float | get_perceived_wavelength (void)
static float | calc_dynamic_smoothing_factor (float static_sf, uint32_t update_count)
| Calculate a dynamic smoothing factor. More...
int | acconeer_main (int argc, char *argv[])
| Assembly test example. More...

## Macro Definition Documentation

## ◆ APPROX_BASE_STEP_LENGTH_M

#define APPROX_BASE_STEP_LENGTH_M 2.5e-3f

Definition at line 87 of file example_surface_velocity.c.

## ◆ CONFIG_HWAAS

#define CONFIG_HWAAS (16U)

[Default app config - can be adapted to reflect the setup]

Hardware accelerated average sampling.

Definition at line 80 of file example_surface_velocity.c.

## ◆ CONFIG_PSD_LP_COEFF

#define CONFIG_PSD_LP_COEFF (0.75f)

[Default app config - can be adapted to reflect the setup]

Low-pass filtered power spectral density coefficient.

Affects the stability of the estimate.

Definition at line 57 of file example_surface_velocity.c.

## ◆ CONFIG_SENSOR_ANGLE

#define CONFIG_SENSOR_ANGLE (45.0f)

[Default app config - can be adapted to reflect the setup]

Angle of the sensor compared to the surface.

Definition at line 41 of file example_surface_velocity.c.

## ◆ CONFIG_SURFACE_DISTANCE

#define CONFIG_SURFACE_DISTANCE (1.0f)

[Default app config - can be adapted to reflect the setup]

Distance to surface in meters.

Definition at line 34 of file example_surface_velocity.c.

## ◆ CONFIG_SWEEP_RATE

#define CONFIG_SWEEP_RATE (3000U)

[Default app config - can be adapted to reflect the setup]

The sweep rate for sweeps in a frame during measurement.

Definition at line 73 of file example_surface_velocity.c.

## ◆ CONFIG_THRESHOLD_SENSITIVITY

#define CONFIG_THRESHOLD_SENSITIVITY (0.15f)

[Default app config - can be adapted to reflect the setup]

Threshold level sensitivity.

Definition at line 48 of file example_surface_velocity.c.

## ◆ CONFIG_VELOCITY_LP_COEFF

#define CONFIG_VELOCITY_LP_COEFF (0.98f)

[Default app config - can be adapted to reflect the setup]

Low-pass filtered velocity coefficient.

Affects the stability of the estimate.

Definition at line 66 of file example_surface_velocity.c.

## ◆ MIN_PEAK_VS

#define MIN_PEAK_VS 0.1f

Definition at line 86 of file example_surface_velocity.c.

## ◆ SENSOR_ID

#define SENSOR_ID (1U)

Definition at line 83 of file example_surface_velocity.c.

## ◆ SENSOR_TIMEOUT_MS

#define SENSOR_TIMEOUT_MS (1000U)

Definition at line 84 of file example_surface_velocity.c.

## Function Documentation

## ◆ acconeer_main()

int acconeer_main | ( | int | argc,
|  | char * | argv[]
| ) |  |

Assembly test example.

Surface velocity example application.

Tank level reference application.

Smart presence reference application.

Breathing example application.

Service subsweeps example.

Service multple configurations example.

Low power service example.

Service example.

Processing subtract adaptive background example.

Processing static presence example.

Processing peak interpolation example.

Processing noncoherent mean example.

Processing coherent mean example.

Processing amplitude example.

Detector presence example with multiple configurations.

Low power detector presence example.

Detector presence example.

Distance detector low power example.

Detector distance example.

Control helper example.

Returns
  Returns EXIT_SUCCESS if successful, otherwise EXIT_FAILURE

Test if measure on wake up is enable Do a measurement if the the detector is ready (configured and calibrated)

Test if measure on wake up is enable Do a measurement if the the detector is ready (configured and calibrated)

Detector filters and states are reset on prepare (reconfiguration) to avoid risk of false detections when switching back to a zone.

Detector filters and states are reset on prepare (reconfiguration) to avoid risk of false detections when switching back to a zone.

Definition at line 226 of file example_surface_velocity.c.

## ◆ calc_dynamic_smoothing_factor()

static float calc_dynamic_smoothing_factor | ( | float | static_sf,
|  | uint32_t | update_count
| ) |  |
| static

Calculate a dynamic smoothing factor.

Parameters

  [in] | static_sf | The target smoothing factor that will be used after the first sweeps
  [in] | update_count | The update count should be 0 for the first sweep and increased by one for each update

Returns
  Dynamic smoothing factor

Definition at line 1013 of file example_surface_velocity.c.

## ◆ calc_power_spectral_density()

static uint16_t calc_power_spectral_density | ( | acc_surface_velocity_handle_t * | handle | ) |
| static

Calculate PSD (power spectral density)

Parameters

  handle | Surface velocity handle

Returns
  Distance index

Definition at line 826 of file example_surface_velocity.c.

## ◆ cleanup()

static void cleanup | ( | acc_surface_velocity_handle_t * | handle,
|  | acc_surface_velocity_config_t * | config
| ) |  |
| static

Definition at line 374 of file example_surface_velocity.c.

## ◆ do_sensor_calibration_and_prepare()

static bool do_sensor_calibration_and_prepare | ( | acc_surface_velocity_handle_t * | handle,
|  | acc_surface_velocity_config_t * | config
| ) |  |
| static

Definition at line 566 of file example_surface_velocity.c.

## ◆ get_angle_correction()

float get_angle_correction | ( | float | surface_distance,
|  | float | distance
| ) |  |
| static

Definition at line 365 of file example_surface_velocity.c.

## ◆ get_perceived_wavelength()

static float get_perceived_wavelength | ( | void |  | ) |
| static

Definition at line 996 of file example_surface_velocity.c.

## ◆ get_velocity_estimate()

static bool get_velocity_estimate | ( | acc_surface_velocity_handle_t * | handle | ) |
| static

Definition at line 342 of file example_surface_velocity.c.

## ◆ init_handle()

static bool init_handle | ( | acc_surface_velocity_handle_t * | handle,
|  | acc_surface_velocity_config_t * | config
| ) |  |
| static

Definition at line 648 of file example_surface_velocity.c.

## ◆ init_sensor_resources()

static bool init_sensor_resources | ( | acc_surface_velocity_handle_t * | handle,
|  | acc_surface_velocity_config_t * | config
| ) |  |
| static

Definition at line 604 of file example_surface_velocity.c.

## ◆ measure()

static bool measure | ( | acc_surface_velocity_handle_t * | handle | ) |
| static

Definition at line 791 of file example_surface_velocity.c.

## ◆ print_result()

static void print_result | ( | acc_surface_velocity_result_t * | result | ) |
| static

Definition at line 989 of file example_surface_velocity.c.

## ◆ process()

static bool process | ( | acc_surface_velocity_handle_t * | handle,
|  | acc_surface_velocity_result_t * | result
| ) |  |
| static

Definition at line 883 of file example_surface_velocity.c.

## ◆ set_config()

static void set_config | ( | acc_surface_velocity_config_t * | config | ) |
| static

Definition at line 502 of file example_surface_velocity.c.

## ◆ set_prf()

static void set_prf | ( | acc_surface_velocity_config_t * | config | ) |
| static

Definition at line 492 of file example_surface_velocity.c.

## ◆ set_profile()

static void set_profile | ( | acc_surface_velocity_config_t * | config | ) |
| static

Definition at line 476 of file example_surface_velocity.c.

## ◆ update_threshold()

static void update_threshold | ( | acc_surface_velocity_handle_t * | handle | ) |
| static

Definition at line 321 of file example_surface_velocity.c.

## ◆ validate_config()

static bool validate_config | ( | acc_surface_velocity_config_t * | config | ) |
| static

Definition at line 530 of file example_surface_velocity.c.