pub fn apply_motor(
cfg: &mut Config,
article: &str,
supply: &str,
) -> Result<(), ConfigError>Expand description
Puts a motor of the catalogue into a config, for a supply of SUPPLIES (“230v”, “400v”, “s120”, …): rotor
inertia, torque constant and saturation, rated current, thermal time constant, and the drive’s torque and speed
limits. The peak torque stays within what the machine’s pulley allows, where the config rates that.
The bus voltage becomes the DC link voltage of that supply, because the catalogue’s rated speed and
torque hold on it: 540 V on a 400 V three-phase line (1.35 times the line voltage, the figure the
Siemens line module data in catalog/siemens/line_modules_s120.csv is given for; also for “s120”, whose motor
data hold for a DC link of 510 to 720 V) and 325 V on a 230 V line (its peak, 230 V times the square root of 2);
another maker’s, 1.35 times its line voltage.
A config written for another bus would otherwise run the motor against a back-EMF it was never meant to meet.
The braking threshold and the trip level of the config’s DC link are scaled with the bus voltage: left as they
were, those of a config written for a lower bus would lie below the new one.
Winding resistance and inductance: Siemens publishes them only for the 1FK7 and 1FT7 (their data sheets, per
phase). For those they are put in as the model’s one winding has them, three times the phase values (its
current is the RMS phase current and its voltage three times the phase voltage, see drive), and the current
controller is retuned with them: Kp = L / T for the config’s own current loop time constant T (its L over its
Kp), Tn = L / R. For every other motor they stay as the config has them, and so do the current loop’s gains.
The velocity gain stays here too; resolve and with_parts retune it for the new rotor.
Options of the motor, read from [parts] where the config has them: motor_brake = true takes the inertia and
weight with the holding brake (refused for a motor without brake data), and motor_encoder the encoder’s counts per
revolution from encoders_1fk2_1ft2.csv (“AS22DQC”, “AM22DQC”; the 26-bit “AS26DQC”, “AM26DQC” for a 1FT2 only).
It sets drive.max_speed_rad_s to the catalogue’s highest speed (the lower of the mechanical limit and what the
converter allows, where both are given) and motor.stall_current_a, where the config has them.
A linear motor (<maker>/linear_motors_*.csv: the Siemens 1FN3 at “s120”, another maker’s at its supply) reads in N
for N m and m for rad, as a linear motor config does: its printed force constant for the torque constant, the
coil’s mass for the rotor’s inertia, the continuous and peak force and current, the speeds in m/s, the winding’s
phase values as the 1FK7’s are put in, and its magnetic attraction and pole pitch into [linear_motor].