Skip to main content

loss_budget

Function loss_budget 

Source
pub fn loss_budget(m: &dyn Machine)
Expand description

The energy balance with losses: over a run with a strong torque pulse, the work of the motor torques (sum of torque times rotor angle turned, exact for torques held over a step) equals the change of the machine’s energy plus the time integral of every loss power it reports (signals starting with LOSS_PREFIX), to within LOSS_BUDGET_TOLERANCE. The run takes the integrator’s own sub-steps (DT / SUBSTEPS, one each) as its steps; the powers are taken at the end of each and summed times the step, which is the trapezoid rule but for the two ends of the run. What is left is that rule’s error on powers that change within a step (the bristles of a friction contact settle within microseconds when the speed reverses), and on a power that jumps, up to half of it times the step: a stop’s damper takes c v^2 as soon as the axis touches it. On the linear delta, whose carriages the pulse takes into their upper stops, one touches at 0.533 m/s 1.7 us before the end of a step: 5000 N s/m * 0.533^2 = 1422 W, of which the trapezoid booked 0.5 * 1422 W * 62.5 us = 0.044 J where 0.002 J were lost, 0.042 J off against the 0.018 J allowed; on the 15.6 us sub-steps at most 0.011 J. The energy parts it reports (energy.*) add up to Machine::energy. A machine that reports no loss powers is not checked.