rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
telemetry_sim.h
Go to the documentation of this file.
1
20#pragma once
21
22#include "bench_state.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
31typedef struct {
32 float cells;
33 float cell_nominal_v;
35 float kv;
37 float stall_amps;
38 float pack_mah;
39 float rpm_tau_s;
41
42#define TELEMETRY_SIM_DEFAULT() \
43 (telemetry_sim_cfg_t) { \
44 .cells = 6.0f, \
45 .cell_nominal_v = 4.05f, \
46 .internal_ohms = 0.018f, \
47 .kv = 920.0f, \
48 .no_load_amps = 1.4f, \
49 .stall_amps = 78.0f, \
50 .pack_mah = 5000.0f, \
51 .rpm_tau_s = 0.22f, \
52 }
53
57typedef struct {
59 float rpm;
60 float drawn_mah;
61 float drawn_wh;
62 float temp_esc;
63 float temp_motor;
65
73
85void telemetry_sim_step(telemetry_sim_t *s, float throttle_pct, float dt_s,
86 bench_state_t *out);
87
88#ifdef __cplusplus
89}
90#endif
The bench readings, in the units a person reads: V, A, W, rpm (revolutions per minute),...
#define s
Short name for esc_stick_s inside the five stick-class files.
Definition esc_stick_panel_int.h:295
The bench readings in the units a person reads: V, A, W and rpm, with their peaks.
Definition bench_state.h:54
The configuration of the telemetry model: pack, motor and propeller.
Definition telemetry_sim.h:31
float internal_ohms
Definition telemetry_sim.h:34
float no_load_amps
Definition telemetry_sim.h:36
float pack_mah
Definition telemetry_sim.h:38
float stall_amps
Definition telemetry_sim.h:37
float rpm_tau_s
Definition telemetry_sim.h:39
float kv
Definition telemetry_sim.h:35
The state of the telemetry model.
Definition telemetry_sim.h:57
float drawn_mah
Definition telemetry_sim.h:60
float temp_esc
Definition telemetry_sim.h:62
float temp_motor
Definition telemetry_sim.h:63
telemetry_sim_cfg_t cfg
Definition telemetry_sim.h:58
float drawn_wh
Definition telemetry_sim.h:61
float rpm
Definition telemetry_sim.h:59
void telemetry_sim_init(telemetry_sim_t *s, const telemetry_sim_cfg_t *cfg)
Sets up the model from its configuration.
Definition telemetry_sim.c:13
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.
Definition telemetry_sim.c:24