17#ifndef RCBENCH_SUPPLY_H
18#define RCBENCH_SUPPLY_H
50#define SUPPLY_CAPS_PPS_DEFAULT { 3.3f, 21.0f, 0.02f, 0.5f, 5.0f, 0.05f }
63#define SUPPLY_OK_VOLTAGE 0x01u
64#define SUPPLY_OK_CURRENT 0x02u
146 SUPPLY_TRIP_NONE = 0,
204float supply_snap(
float value,
float min,
float max,
float step);
255#define SUPPLY_SIM_LOAD_OHMS 6.0f
256#define SUPPLY_SIM_PERIOD_S 3.0f
257#define SUPPLY_SIM_BURST_S 0.6f
258#define SUPPLY_SIM_BURST_A 1.4f
259#define SUPPLY_SIM_SOURCE_OHMS 0.05f
#define s
Short name for esc_stick_s inside the five stick-class files.
Definition esc_stick_panel_int.h:295
What a supply can be set to.
Definition supply.h:32
float v_step
Definition supply.h:35
float v_min
Definition supply.h:33
float i_min
Definition supply.h:36
float i_step
Definition supply.h:38
float i_max
Definition supply.h:37
float v_max
Definition supply.h:34
What the operator allows, on top of what the supply can do: caps on the set points,...
Definition supply.h:122
float i_max
Definition supply.h:124
float v_max
Definition supply.h:123
float trip_i
Definition supply.h:125
float trip_v
Definition supply.h:126
float trip_s
Definition supply.h:127
The state of the supply model.
Definition supply.h:264
float t
Definition supply.h:266
float set_i
Definition supply.h:268
float set_v
Definition supply.h:267
bool output
Definition supply.h:269
A supply's readings, set points, mode and trip state.
Definition supply.h:69
supply_mode_t mode
Definition supply.h:75
float set_v
Definition supply.h:70
uint16_t samples
Readings the supply has taken, modulo 65536: a new count is a new reading, and the same count read ag...
Definition supply.h:92
bool online
Definition supply.h:77
uint8_t counted
Definition supply.h:113
float v
Definition supply.h:72
float i
Definition supply.h:73
uint32_t taken_ms
When the panel had this reading, on its millisecond clock: the page read that brought it,...
Definition supply.h:100
bool sag_seeded
Definition supply.h:108
uint8_t ok
Definition supply.h:79
bool output
Definition supply.h:76
float set_i
Definition supply.h:71
bool stamped
Definition supply.h:101
uint8_t trip
The trip that switched the output off last, as supply_trip_kind_t; kept until the output is switched ...
Definition supply.h:84
bool modelled
Definition supply.h:78
float p
Definition supply.h:74
How long each reading has been over its threshold, counted from the first reading seen over it,...
Definition supply.h:155
float v_at
Definition supply.h:161
bool v_over
Definition supply.h:159
bool i_over
Definition supply.h:158
float i_at
Definition supply.h:160
void supply_track_peaks(supply_state_t *s)
Take this sample into the run's extremes, only what arrived.
Definition supply.c:53
supply_caps_t supply_caps_limited(const supply_caps_t *caps, const supply_limits_t *lim)
The supply's caps narrowed by lim: the set points a screen offers.
Definition supply.c:107
void supply_reset_totals(supply_state_t *s)
The run begins: nothing delivered, nothing counted.
Definition supply.c:73
void supply_count_totals(supply_state_t *s, float dt_s)
Add dt_s of the readings to the run's charge and energy while the output is on, only what arrived; dt...
Definition supply.c:83
supply_mode_t
The output mode of a supply: off, constant voltage or constant current.
Definition supply.h:56
@ SUPPLY_MODE_CV
Definition supply.h:58
@ SUPPLY_MODE_OFF
Definition supply.h:57
@ SUPPLY_MODE_CC
Definition supply.h:59
supply_trip_kind_t
The trips: none, current and voltage.
Definition supply.h:145
void supply_sim_set(supply_sim_t *m, float v, float i)
Set points are snapped to the caps; the output's state is kept.
Definition supply.c:239
void supply_trip_reset(supply_trip_t *t)
Clears the trip state.
Definition supply.c:129
void supply_sim_output(supply_sim_t *m, bool on)
Switches the model's output on or off.
Definition supply.c:248
float supply_snap(float value, float min, float max, float step)
value clamped to min .. max and rounded to a multiple of step above min.
Definition supply.c:17
supply_trip_kind_t supply_trip_step(supply_trip_t *t, const supply_limits_t *lim, const supply_state_t *s, float dt_s)
Take dt_s of the readings in s into the trips.
Definition supply.c:192
void supply_sim_init(supply_sim_t *m)
Sets up the supply model.
Definition supply.c:224
void supply_reset_peaks(supply_state_t *s)
The run's extremes start again from what is shown, and only from readings that arrived; a maximum wit...
Definition supply.c:38
void supply_sim_step(supply_sim_t *m, float dt_s, supply_state_t *out)
Advance dt_s and write the readings, mode and set points into out, counting one more sample; peaks,...
Definition supply.c:259