Skip to main content

Module motor_fit

Module motor_fit 

Source
Expand description

Identification that needs no machine model: one motor’s drive train from its own trace, in the motor’s units (rad, rad/s, N m at the shaft). So it works on any imported drive trace, also of a machine the simulator has no config for.

  • Inertia and friction: torque = J α + b ω + (Tc + (Ts - Tc) e^-(ω/ωs)²) sign ω + T0, with the Stribeck part kept only where the trace shows it, and the LuGre bristle stiffness σ0 from the reversals.
  • Drive delays and filters (the fit’s stage 3): a gain, a first-order lag and a dead time between a setpoint and what follows it (torque setpoint to torque, position setpoint to position).
  • Stiffness and damping between motor and load, as a two-mass model: from a frequency response (measured by the drive, or computed here from a trace with an excitation), or from the ringing after a torque step.

Every value comes with a standard error from the least-squares covariance, widened for residuals that are correlated from row to row; Estimate::interval is the 95 % interval from it. Every model says how well it reproduces the trace (Quality).

Structs§

Estimate
A fitted value and its standard error.
Friction
Inertia and friction of one motor’s drive train, at the motor shaft.
Identified
Everything a trace of one motor gives without extra tests: inertia and friction, and the lags from torque setpoint to torque (where the trace has the setpoint) and from position setpoint to position. What sim-cli identify and the app show.
Lag
A setpoint and what follows it, as gain × first-order lag × dead time: the drive’s loops, filters and bus delays lumped together (stage 3 of the fit).
Quality
How well a model reproduces a measured signal: RMS of the difference, and the normalised fit 100 % × (1 - |measured - model| / |measured - mean|): 100 % is exact, 0 % no better than the mean.
Ringing
A damped oscillation riding on a slow trend: what the motor speed does after a torque step.
TwoMass
Motor and load coupled by a spring with damping: the belt or the coupling, at the motor shaft.

Constants§

QUANTITIES
The names Identified gives its values and qualities, every one it can give.

Functions§

frequency_response
The frequency response from input to output of a trace with an excitation in it (noise, a chirp, a PRBS), at the given frequencies: Welch’s H1 estimate over Hann windows with half overlap, each window long enough for four periods of the lowest frequency. With it the coherence, 0 to 1: below about 0.8 the point is mostly noise or the response is not linear there. None for a trace too short for eight windows: with few windows the coherence of pure noise comes out near 1.
friction
Inertia and friction from a trace’s speed and torque at one motor (angle for the presliding). Speed and torque are averaged over 5 ms on either side, the acceleration is the slope of the speed across that window. Rows slower than 1 % of the top speed are left out, and so are rows whose window has a reversal. None if the motor does not turn both ways (Coulomb friction and a constant torque cannot be told apart then) or the trace is too short.
lag
Fits gain, lag and dead time from input (a setpoint) to output. The trace has to start at rest. The start is the best point of a grid (dead time 0 to 20 rows, time constant 0 and 1 to 100 rows). A time constant the trace cannot resolve (shorter than a fraction of a row, or a following error too small to show it) is reported as 0 ± one row, and gain and dead time are fitted without it.
quality
ringing
Fits A e^(-σt) sin(ω_d t + φ) + c0 + c1 t + c2 t² to signal between from and until (s), with t from from. The quadratic takes the rigid motion under the step. The start for ω_d is the strongest frequency of what is left after the trend; the start for φ the best of eight. None with fewer than 20 rows in the span or no fit.
two_mass
The two-mass model from a frequency response of motor torque to motor speed: the dip (the lowest in frequency, as resonance finds it), the highest peak above it up to five times its frequency, and the total inertia from the part below a third of the dip (gain = 1 / (J ω) there, corrected for the two frequencies). Then J_motor = J (f_dip / f_peak)², J_load = J - J_motor, stiffness = J_load (2π f_dip)², and the damping from the width of the dip. That is the start for a least-squares fit of the whole model (with a viscous friction at the motor) through all points, whose values and errors are returned; where that fails, the values read off the dip and peak. None without a dip, a peak inside the response, or three points below the dip.
two_mass_from_ringing
The two-mass model from the ringing after a torque step, which shows the resonance (motor and load against each other), given the total inertia (from friction) and the motor’s own (the rotor, from its data sheet, plus what sits on the motor side of the spring). Its reduced inertia μ = J_motor J_load / J gives stiffness = μ (2π f)² and damping = 2 ζ sqrt(stiffness μ).