// AHS-2 Simulator title "AHS-2g Simulator" version {@
Version 1.0, 02.09.2007
francois.roulet@epfl.ch

EPFL
Swiss Federal Institute of Technology
CH-1015 Lausanne
Switzerland
@} help {@
There's a GM-Allison AHS-2 transmission simulator:

@} variable Ratio // Global ratio variable xratio // Local ratio variable Z1, Z2 // Z1 & Z2 offset variable Power // derivated Power variable Carrier // Common carrier variable Zr1, Zs1 // Ring & Sun Teeth variable Zr2, Zs2 // Ring & Sun Teeth variable Zr1init, Zs1init // Factory Ring & Sun Teeth variable Zr2init, Zs2init // Factory Ring & Sun Teeth variable MGA, MGB // Motor & Generator A & B variable ModeShift // Sync mode = 2nd fixed ratio variable Ring3 // Ring of 3rd PGT variable Gear // Fixed gear variable deltaX // Horizontal translation init (Zr1, Zs1, Zr2, Zs2, Z1, Z2, Zr1init, Zs1init, Zr2init, Zs2init, ... MGA, MGB, Carrier, ModeShift, Ratio, Ring3, Power, Gear) = init function {@ function (Zr1, Zs1, Zr2, Zs2, Z1, Z2, Zr1init, Zs1init, Zr2init, Zs2init, ... MGA, MGB, Carrier, ModeShift, Ratio, Ring3, Power, Gear) = init Zr1init = 65; Zs1init = 33; Zr2init = 94; Zs2init = 34; Zr1 = Zr1init; Zs1 = Zs1init; Zr2 = Zr2init; Zs2 = Zs2init; Z1 = 1; Z2 = 1; MGB = (Zr2 + Zs2)/Zs2; MGA = Zs1/Zr1*(MGB - 1) - 1; ModeShift = (Zr1 + Zs1)/Zr1*(1 + MGA) - MGA; Ratio = 1/ModeShift; // 2nd fixed gear Gear = 2; Carrier = 1; Power = 0; Ring3 = 0; subplots('Triple-Planetary Nomogram\nPower x 10 & Regimes x 1\nSettings'); function drawRegimes(Zr1, Zs1, Zr2, Zs2, ModeShift, Ratio) if Ratio > 1/ModeShift // Mode 2 MGA = (Zr1/Zs1 + 1)*Ratio - Zr1/Zs1; // MGB = ((Zr1 + Zs1)*Ratio - Zr1*MGA)/Zs1; MGB = f(MGA) MGB = (1 - (Zr1/Zs1)^2)*Ratio + (Zr1/Zs1)^2; else // Mode 1 MGB = (Zr2/Zs2 + 1) * Ratio; // MGA = (Zr1 - Zs1*MGB)/(Zr1 - Zs1); MGA = f(MGB) MGA = (Zr1 - Zs1*(Zr2/Zs2 + 1)*Ratio)/(Zr1 - Zs1); end scale([-Zr2, Zs2, -1, 3]); label('teeth', 'rev'); line([1, 0], -Zr1, 'k:'); // Twins Sun line([1, 0], -Zr2, 'k:'); // Output Sun text(-Zr1, 3, 'S1+S2', 'tl'); text(-Zr2, 3, 'S3', 'tl'); line([1, 0], 0); // Common Carrier text(0, 3, 'C', 'tr'); line([1, 0], Zs1, 'k:'); // Twins Ring line([1, 0], Zs2, 'k:'); // Output Ring line([0, 1], 0); // Abcissa // PGT1 magenta plot([-Zr1, Zs1; -Zr1, Zs1], [MGA, 1; MGA, 1], 'M_Mo', 1); text(-Zr1, MGA, 'MGA', 'tr'); text(Zs1, 1, 'Input', 'tr'); // PGT2 cyan plot([-Zr1, Zs1; -Zr1, Zs1], [MGB, MGA; MGB, MGA], 'C_Co', 1); text(-Zr1, MGB, 'MGB', 'br'); Ring3 = ((Zr2 + Zs2)*Ratio - Zs2*MGB)/Zr2; plot([-Zr1, Zs1], [MGA, MGA], 'k-', 1); // MGA Link Carrier = (Zs1*MGA + Zr1)/(Zr1 + Zs1); // Carrier plot(0, Carrier, 'co'); plot([0, 0; 0, 0], [0, Ratio; 0, Ratio], 'R_Ro', 1); // Carriers link text(0, Ratio, 'Output', 'br'); if Ratio < 1/ModeShift // Mode 1 legend('Input Split', 'g'); // Active PGT3 green plot([-Zr2, Zs2; -Zr2, Zs2], [MGB, Ring3 ;MGB, Ring3], 'G_Go'); // MGB Link plot([-Zr2, -Zr1], [MGB, MGB], 'G-', 1); else // Mode 2 legend('Compound Split', 'c'); // Passive PGT3 green plot([-Zr2, Zs2; -Zr2, Zs2], [MGB, Ring3; MGB, Ring3], 'g_go', 1); // MGB Link plot([-Zr2, -Zr1], [MGB, MGB], 'k-', 1); end function drawPower(Zr1, Zs1, Zr2, Zs2, ModeShift, Ratio) scale([-0.2, 1.6, -1, 3]); line([1, 0], 1/ModeShift, 'k:'); // Mode toggle line([0,1], 0, 'k:'); // Abcissa % plot in red ('r') a vertical line at ratio line([1,0], Ratio,'R-',1); // MGB = (Zr2/Zs2 + 1) * Ratio; line([-(Zr2/Zs2+1), 1], 0, 'c'); // MGB Mode 1 // MGA = (Zr1 - Zs1*(Zr2/Zs2 + 1)*Ratio)/(Zr1 - Zs1); line([Zs1/(Zr1-Zs1)*(Zr2/Zs2+1), 1], Zr1/(Zr1-Zs1), 'm'); // MGA Mode 1 // MGA = (Zr1/Zs1 + 1)*Ratio - Zr1/Zs1; line([-(Zr1/Zs1+1), 1], -Zr1/Zs1, 'm'); // MGA Mode 2 // MGB = (1 - (Zr1/Zs1)^2)*Ratio + (Zr1/Zs1)^2; line([-(1-(Zr1/Zs1)^2), 1], (Zr1/Zs1)^2, 'c'); // MGB Mode 2 // Adaptation points in Mode 1 deltaX = 0.5; r2 = Zr1/Zs1*Zs2/(Zs2+Zr2) + deltaX; // Tranlated to right r1 = 0 + deltaX; // xratio = (1 - 0.2:0.05:1/ModeShift + 1 + 0.3); xratio = (deltaX - 0.2:0.05:1/ModeShift + deltaX + 0.3); Power = (1 - xratio./r1).*(1 - r2./xratio)/(r2./r1 - 1); plot(xratio - deltaX, 10*Power, 'b-'); // Tranlated to left back // Adaptation points in Mode 2 r4 = Zr1^2/((Zr1-Zs1)*(Zr1+Zs1)); r3 = Zr1/(Zs1 + Zr1); xratio = (1/ModeShift - 0.2:0.05:1.6); Power = (1 - xratio./r3).*(1 - r4./xratio)/(r4./r3 - 1); plot(xratio, 10*Power, 'b'); function (Ratio, msg) = dragRatio(Ratio,id,x1) if isempty(id) cancel; end Ratio = x1; msg = sprintf('Ratio = %g:1', 1/x1); function (msg, cursor) = overFunc(id, x0) if isempty(id) cancel; end msg = sprintf('Ratio = %g:1', 1/x0); cursor = true; function (msg, cursor) = overSlider(Ratio, Z1, Z2, Zr1, Zs1, Zr2, Zs2, ... Zr1init, Zs1init, Zr2init, Zs2init, ModeShift, ... nb, id, x0) if isempty(id) cancel; end cursor = true; if id == 2 switch x0 case 1 Ratio = Zs2/(Zs2 + Zr2); case 2 Ratio = 1/ModeShift; case 3 Ratio = 1; case 4 Ratio = Zr1^2/((Zr1-Zs1)*(Zr1+Zs1)); end msg = sprintf('Ratio = %g:1', 1/Ratio); return; end if isempty(nb) cancel; end switch nb case 1 Z1 = x0; Zr1 = round(Zr1init*Z1); Zs1 = round(Zs1init/Z1); msg = sprintf('Twins: %g/%g', Zr1, Zs1); case 2 Z2 = x0; Zr2 = round(Zr2init*Z2); Zs2 = round(Zs2init/Z2); msg = sprintf('Output: %g/%g', Zr2, Zs2); end function drawSliders(Z1, Z2, Gear) button('Gear:\t1st\t2nd\t3rd\t4th', Gear, 'radiobutton', '', 2); slider(sprintf('Twins offset\nOutput offset'), ... [Z1; Z2], [0.9,1.2; 0.9,1.2], '--', 'bb', 1); function (Gear, Ratio, Z1, Z2, Zr1, Zs1, Zr2, Zs2, ModeShift, msg) = ... dragSlider(Gear, Ratio, Z1, Z2, Zr1, Zs1, Zr2, Zs2, ModeShift, ... Zr1init, Zs1init, Zr2init, Zs2init, _x1, nb, id) if isempty(id) cancel; end if id == 2 Gear = _x1; switch _x1 case 1 Ratio = Zs2/(Zs2 + Zr2); case 2 Ratio = 1/ModeShift; case 3 Ratio = 1; case 4 Ratio = Zr1^2/((Zr1-Zs1)*(Zr1+Zs1)); end msg = sprintf('Ratio = %g:1', 1/Ratio); return; end if isempty(nb) cancel; end switch nb case 1 Z1 = _x1; Zr1 = round(Zr1init*Z1); Zs1 = round(Zs1init/Z1); msg = sprintf('Twins: %g/%g', Zr1, Zs1); case 2 Z2 = _x1; Zr2 = round(Zr2init*Z2); Zs2 = round(Zs2init/Z2); msg = sprintf('Output: %g/%g', Zr2, Zs2); end MGB = (Zr2 + Zs2)/Zs2; MGA = Zs1/Zr1*(MGB - 1) - 1; ModeShift = (Zr1 + Zs1)/Zr1*(1 + MGA) - MGA; @} figure "Triple-Planetary Nomogram" draw drawRegimes(Zr1, Zs1, Zr2, Zs2, ModeShift, Ratio) figure "Power x 10 & Regimes x 1" draw drawPower(Zr1, Zs1, Zr2, Zs2, ModeShift, Ratio) mousedrag (Ratio, _msg) = dragRatio(Ratio,_id,_x1) mouseover (_msg,_cursor) = overFunc(_id,_x0) figure "Settings" draw drawSliders(Z1, Z2, Gear) mousedrag(Gear, Ratio, Z1, Z2, Zr1, Zs1, Zr2, Zs2, ModeShift, _msg) = ... dragSlider(Gear, Ratio, Z1, Z2, Zr1, Zs1, Zr2, Zs2, ModeShift, ... Zr1init, Zs1init, Zr2init, Zs2init, _x1, _nb, _id) mouseover (_msg,_cursor) = overSlider(Ratio, Z1, Z2, Zr1, Zs1, Zr2, Zs2, ... Zr1init, Zs1init, Zr2init, Zs2init, ModeShift, ... _nb, _id, _x0)