pub fn with_parts(
entry: &MachineEntry,
cfg: &Config,
article: &str,
supply: &str,
gearbox: &str,
) -> Result<Config, ConfigError>Expand description
The config with a candidate’s parts in it and the velocity loop retuned for them. Without this a
motor with a much lighter rotor fails by oscillating, not by being too small. gearbox “” keeps the
config’s own; the drive, belt and axis the config names are put in as well.
The reference of the retuning is the config’s own numbers, as they are before a part is put in:
drive.velocity_kp_nm_s_rad is taken to be tuned for the rotor, gearbox and masses the file states.
So a config that names a part states the gain for its own numbers, not for the part. Putting in
first one part and then another gives the gain of putting in both at once: the ratios multiply.
The gain is scaled with the geometric mean of two ratios: that of the inertia the motors turn, load
included (inertia_seen), and that of the rotor inertia alone (with the gearbox’s, which turns with
it). Below the belt resonance the velocity loop moves rotor and load together, so the first ratio
keeps its speed; above the resonance the belt no longer carries the load along and the loop sees the
rotor alone, so the second ratio keeps its stability. The loop’s crossover lies near the resonance,
where neither holds alone. Scaling with the total inertia only left a rotor a quarter as heavy or
lighter with several times too much gain above the resonance, and it oscillated; scaling with the
rotor only makes the loop needlessly slow. Where the retuned gain leaves the position cascade too close to its edge
(cascade_margins below CASCADE_MARGIN and below the config’s own), drive.kv_1_s is lowered to keep it there;
drive.velocity_tn_s stays. On the EXCT-30 every 1FK2 runs calmly so.