rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
telemetry_sim.h File Reference

A pack, a motor and a propeller, modelled, so every screen runs without a measurement front end. More...

#include "bench_state.h"

Go to the source code of this file.

Data Structures

struct  telemetry_sim_cfg_t
 The configuration of the telemetry model: pack, motor and propeller. More...
struct  telemetry_sim_t
 The state of the telemetry model. More...

Macros

#define TELEMETRY_SIM_DEFAULT()

Functions

void telemetry_sim_init (telemetry_sim_t *s, const telemetry_sim_cfg_t *cfg)
 Sets up the model from its configuration.
void telemetry_sim_step (telemetry_sim_t *s, float throttle_pct, float dt_s, bench_state_t *out)
 Advance by dt_s at throttle_pct and fill out.

Detailed Description

A pack, a motor and a propeller, modelled, so every screen runs without a measurement front end.

It runs on the panel, and only while no IOmcu answers: an IOmcu that is answering reports what it measures and leaves the rest empty, so a modelled number and a measured one never appear on the same screen.

Every value it produces carries LINK_BN_SIMULATED, and the router draws SIMULATION across the screen while that bit is set: a modelled number must not read as a measured one.

The model is crude: the bus sags under load, current grows faster than throttle (exponent 2.5), and rpm (revolutions per minute) follows the sagging bus rather than the stick.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ TELEMETRY_SIM_DEFAULT

#define TELEMETRY_SIM_DEFAULT ( )
Value:
.cells = 6.0f, \
.cell_nominal_v = 4.05f, \
.internal_ohms = 0.018f, \
.kv = 920.0f, \
.no_load_amps = 1.4f, \
.stall_amps = 78.0f, \
.pack_mah = 5000.0f, \
.rpm_tau_s = 0.22f, \
}
The configuration of the telemetry model: pack, motor and propeller.
Definition telemetry_sim.h:31

Function Documentation

◆ telemetry_sim_init()

void telemetry_sim_init ( telemetry_sim_t * s,
const telemetry_sim_cfg_t * cfg )

Sets up the model from its configuration.

Parameters
sThe model to set up.
cfgThe configuration, or NULL for the default.

◆ telemetry_sim_step()

void telemetry_sim_step ( telemetry_sim_t * s,
float throttle_pct,
float dt_s,
bench_state_t * out )

Advance by dt_s at throttle_pct and fill out.

Peaks are accumulated into out as the IOmcu accumulates them for the BENCH page, so the screen sees the same behaviour from both sources.

Parameters
sThe model.
throttle_pctThe throttle, in percent.
dt_sThe time step, in s.
outReceives the readings.