This is a simple model of a gearbox with constant efficiency without inertia.
The relationship between torque at flange_a and flange_b is different depending on whether flange_a or flange_b is driving.
To avoid a step in the relationship, efficiency rises from a threshold p_min towards zero to 1; i.e.at speed zero, torque at flange_b is ratio * torque at flange_a.
if p_a > 0 then // flange_a is driving tau_a*ratio*(1 -(1 - eta)*min(1, p_a/p_min)) + tau_b = 0; else // flange_b is driving tau_a*ratio + tau_b*(1 -(1 - eta)*min(1, p_b/p_min)) = 0; end if;
Losses are fed to the optional heatPort.