Code to study models for transmission design

Written for Mathematica 4.0
Paul Novak
March 31, 2000
novak@caltech.edu

Transmission simulation

Basic constants and coefficients of the motor and load for spring term 
2000.

The first two, GearRatio, and mu, are user defined inputs. GearRatio 
is the gear ratio, or speed ratio, of your transmission. The efficiency of 
the transmission, mu, is really just an estimate of the efficiency of your 
device. It is a measure of how well machined it is. Realistically, mu can 
range from about 40 to 85% (.4 ≤ μ ≤ .85). You can 
put in any value for GearRatio, and mu, and this code will return plots to 
describe that particular transmission.

As described in the information 
sections for the transmission contest, StallTorque is the torque of the motor 
when ω=0, in [N-m]. OmegaNoLoad is the speed of the motor with no load 
attached to it, in [1/s]. MotorInertia and WheelInertia are given in [kg - (m^2)].  a, b, and c are the draq coefficients on the load. Tmax is the maximum 
time the simulation will run. If the simulation does not reach 250 RPM by the 
time Tmax is reached, it will assume that Tmax is the value for the 
denominator of the transmission cost function. You can change Tmax if you 
would like to run the simulation longer.

One last note is that this 
notebook will take a while to run, so please be patient. If you would like to 
see a plot of a function, and it is not expressing it, remove any semicolon ( 
; ) that is at the end of the line, and/or remove and colon ( : ) from 
directly in front of any equal sign (if you see :=, remove the :). This should allow you to see any output you want. Also, this is 
guaranteed to work for Mathematica 4.0. I can not guarantee that this will work for earlier versions of Mathematica.

GearRatio= ;
mu= ;

RPMtoRAD =  2*π/60.0;
StallTorque =   .287;
OmegaNoLoad =  4550 * RPMtoRAD;
WheelInertia =  0.27;
MotorInertia =  0.0000045;
a =  0.00103605;
b =  0.00000375109;
c =  0.000000952731;
Tmax = 180;

WheelDrag describes the drag of the load (a bicycle wheel) as a function of 
the speed of the load, OmegaLoad. PlotDrag returns a graph of WheelDrag.

WheelDrag[OmegaLoad_] :=  

        a OmegaLoad  +  b OmegaLoad^2  +  

          c OmegaLoad^3;
\(\(PlotDrag := \ 

        Plot[WheelDrag[OmegaLoad], {OmegaLoad, 0, 200}, 
	

          AxesLabel -> {"LoadSpeed [1/s]", \ "Drag 
[n-m]"}];\)\)

MotorTorque describes the torque of the motor. PlotMotorTorque plots the 
MotorTorque as a function of the load speed, OmegaLoad, with the parameter 
GearRatio. GearRatio, is once again, the gear or speed ratio of your 
transmission.

MotorTorque[OmegaMotor_] :=  

        StallTorque (1.0 - 

              OmegaMotor/OmegaNoLoad);
PlotMotorTorque[GearRatio_] := 

      Plot[(GearRatio*

            MotorTorque[(GearRatio*OmegaLoad)]), {OmegaLoad, 0, 200}, 

        AxesLabel -> {"Load speed [1/s]",  "Motor Torque \

[N-m]"}]

Acceleration is function of GearRatio, OmegaLoad, and mu, the efficiency. It 
is described in the formula as the sum of the torques (torque provided by the 
motor less the drag due to the wheel) divided by the effective inertia of the 
system ( the load inertia plus the (gear ratio)^2 times the motor inertia). 
Note that the inertia of your transmission is not included in this 
consideration. Acceleration is plotted versus the load speed here.

Acceleration[OmegaLoad_, GearRatio_,  

          mu_] :=  (mu*GearRatio*MotorTorque[(GearRatio*OmegaLoad)] - 

              WheelDrag[OmegaLoad])/(GearRatio^2 * MotorInertia  +  

              WheelInertia);
PlotAcceleration[GearRatio_, mu_] := 

      Plot[Acceleration[OmegaLoad, GearRatio,  mu], {OmegaLoad, 0, 

          200}, 
AxesLabel ->  {"Load speed \

[1/s]",  "Acceleration [1/s^2]"}]

MaxSpeed finds the maximum load speed by setting the wheel drag equal to the 
motor torque, and finding the load speed at the point. When the drag is equal 
to the motor torque, there is obviously no unbalanced torque which would 
accelerate the load. MaxSpeed is a function of GearRatio and mu, and here, is 
plotted versus gear ratio.

MaxSpeed[GearRatio_ , 

          mu_] :=  First[

            FindRoot[

              WheelDrag[OmegaLoad] ==  

                mu*GearRatio*MotorTorque[GearRatio*OmegaLoad],  {OmegaLoad, 

                0}]][[2]];
\(\(PlotMaxSpeed[mu_] := \ 

        Plot[\((MaxSpeed[GearRatio, mu]/RPMtoRAD)\), \ {GearRatio, \ 1, 

            20}, 
PlotRange -> {0, 

              700}, 
AxesLabel -> {"Gear ratio", \ 
"Maximum load speed [RPM]"}, 
PlotLabel -> \ 
"Maximum load speed vs. gear ratio"];\)\)

These next two functions model the transmission itself. The function 
Sim[GearRatio_ ,mu_] will return a plot of the velocity profile of the load 
versus the time in seconds. This is very interesting to look at for various 
gear ratios and efficiencies. It is used below to make such plots.

CreateProfile[GearRatio_, mu_] := 

        NDSolve[{(OmegaLoad^′)[t] == 

              Acceleration[OmegaLoad[t],  GearRatio,  mu],  

            OmegaLoad[0] == 0},  

          OmegaLoad[t],  {t, 0, 

            Tmax}];

Sim[GearRatio_,  mu_] := 

        Block[{velocity}, 
velocity = 

            CreateProfile[GearRatio,  mu]; 
Return[

            Plot[(1.0/RPMtoRAD) Evaluate[

                  OmegaLoad[t]  /. velocity],  {t, 1, 

                Tmax}]]; ];

time is the time is takes the given transmission, with a user specified gear 
ratio and efficiency, to reach 250 RPM. Transmission function is the score 
that device shall recieve, for a cost function = (Maximum Load Speed in RPM) 
/ (the time it takes to 250 RPM).

\(\(OmegaLoadFcn[

          t_]\  = \ \((OmegaLoad[t]/RPMtoRAD)\) /. 
	

          First[NDSolve[{\(OmegaLoad\^′\)[t]\  == \ 

                  Acceleration[OmegaLoad[t], \ GearRatio, \ mu], \ 

                OmegaLoad[0]\  == \ 0}, 
	

              OmegaLoad[t], \ {t, 0, Tmax}]];\)\)
time =  

        If[1/RPMtoRAD MaxSpeed[GearRatio, mu] < 250,  Tmax, 

          t /. FindRoot[OmegaLoadFcn[t] == 250, {t, 5}]];
TransmissionFunction = 

      1/RPMtoRAD MaxSpeed[GearRatio, mu]* 1/time

Various Plots

This cell, when evaluated, will yield plots of load velocity vs. time for 
various gear ratios (gear ratio = 1, 2, 4, 6, 8, 10, 12, 15, 20) and a 
constant efficiency (μ= 0.8), for various efficiencies(μ = .4, .5, 
.6, .7, .8, .9) at a constant gear ratio of 5. The last plot is a plot of the 
maximum load speed as a function of gear ratio, for various efficiencies (
μ = .4, .5, .6, .7, .8, .9). If the plots are not large enough, just 
resize them by clicking on them, and then clicking and dragging on one of the 
black boxes that appear in the corners, until you have reached the desired 
size.

\(Show[{Sim[1,  .8], Sim[2,  .8], \ Sim[4,  .8], Sim[6,  .8], \ 

        Sim[8,  .8], Sim[10,  .8], Sim[12,  .8], \ Sim[15,  .8], 

        Sim[20,  .8]}, \ 

      AxesLabel -> {"Time [s]", "Load speed[RPM]"}, 

PlotLabel -> "Load velocity vs. time for various 
gear ratios, and μ= 0.8", 
PlotRange -> \ {0, 

          700}]\)

\(Show[{Sim[5,  .9], Sim[5,  .8], \ Sim[5,  .7], Sim[5,  .6], \ 

        Sim[5,  .5], 

        Sim[5,  .4]}, 
AxesLabel -> {"Time [s]", "
Load speed[RPM]"}, 
PlotLabel -> "Load velocity 
vs. time for various efficiencies, and a gear ratio of 5", 

PlotRange -> \ {0, 700}]\)

Show[{PlotMaxSpeed[ .4], PlotMaxSpeed[ .5],  PlotMaxSpeed[ .6],  

        PlotMaxSpeed[ .7],  PlotMaxSpeed[ .8],  

        PlotMaxSpeed[ .9]}]

These next operations take a while. Please be patient. These cells will 
return a plot of the cost function vs. gear ratio, for various efficiencies (
μ = 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9).

m = 

        1/RPMtoRAD Table[

            MaxSpeed[i, j], {i, 1, 20, 0.1}, {j, 0.5, 0.9, 

              0.05}];

Timeto250 = 

        Table[OmegaLoadFcn[

              t_]  =  (OmegaLoad[t]/

                  RPMtoRAD)  /. 
First[

                NDSolve[{(OmegaLoad^′)[t] == 

                      Acceleration[OmegaLoad[t], i,  j],  

                    OmegaLoad[0] == 0},  

                  OmegaLoad[t], 
{t, 0, 

                    Tmax}]]; 
If[

            1/RPMtoRAD MaxSpeed[i, j] < 250,  Tmax, 

            t /. FindRoot[OmegaLoadFcn[t] == 250, {t, 5}]],  {i, 1, 

            20, 0.1}, {j, 0.5, 0.9, 0.05}];

CostFunction =  

        Table[Table[{ .1*i,  m[[i, j]]/Timeto250[[i, j]]}, {i, 

              191}], {j, 9}];

\(\(\(
\)\(Show[{ListPlot[CostFunction[\([8]\)], 

          PlotJoined -> True], \ 

        ListPlot[\ CostFunction[\([7]\)], PlotJoined -> True], 

        ListPlot[\ CostFunction[\([6]\)], \ PlotJoined -> True], 

        ListPlot[CostFunction[\([5]\)], PlotJoined -> True], 

        ListPlot[\ CostFunction[\([4]\)], PlotJoined -> True], 

        ListPlot[\ CostFunction[\([3]\)], \ PlotJoined -> True], 

        ListPlot[CostFunction[\([2]\)], PlotJoined -> True], \ 

        ListPlot[\ CostFunction[\([1]\)], 

          PlotJoined -> True], 
ListPlot[

          CostFunction[\([9]\)], \ 

          PlotJoined -> True]}, 
	

      AxesLabel -> {"Gear ratio", "Cost function"}, 

	

      PlotLabel -> "Plot of cost function vs. gear ratio for various 
efficiencies"]\)\)\)