Class GearBox
java.lang.Object
yams.core.gearing.GearBox
GearBox class to calculate input and output conversion factors and check if the current
configuration is supported.
A GearBox models a multi-stage gear reduction (or increase). Each stage is defined by
a reduction, such as 5.0 or "5:1" for a 5:1 reduction. The overall reduction is
the product of all individual stage reductions.
You can construct a GearBox in several ways:
fromTeeth(int...)provide the tooth counts of a train of meshing gears, from the driving gear to the last driven gear. Gears in between are idlers.fromStages(String...)provide stage reductions as"IN:OUT"stringsfromReductionStages(double...)provide per-stage reductions directly
Example
// 5:1 single-stage gearbox (12-tooth driver meshing with a 60-tooth driven gear)
GearBox fiveToOne = GearBox.fromTeeth(12, 60);
// Still 5:1: every gear meshes with the next one, so the 30-tooth gear is an idler
GearBox withIdler = GearBox.fromTeeth(12, 30, 60);
// 25:1 two-stage gearbox (each stage is 5:1) using "IN:OUT" stage strings
GearBox twoStage = GearBox.fromStages("5:1", "5:1");
// Equivalent using reductions (driven teeth / driver teeth per stage)
GearBox fromRatios = GearBox.fromReductionStages(60.0 / 12.0, 60.0 / 12.0);
// Get the overall input-to-output conversion factor (< 1.0 means reduction)
double factor = fiveToOne.getInputToOutputConversionFactor(); // 0.2 (1/5)
// Get the overall output-to-input conversion factor (the reduction ratio itself)
double reduction = fiveToOne.getOutputToInputConversionFactor(); // 5.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiv(double x) Divide the gear reduction ratio by X.static GearBoxfromReductionStages(double... reductionStages) Create the gearbox given the reduction stages of the gearbox.static GearBoxfromStages(String... stages) Create the gearbox given the reduction stages of the gearbox.static GearBoxfromTeeth(int... teeth) Create the gearbox given the teeth of each gear in a train of meshing gears.doubleGet the conversion factor to transform the gearbox input into the gear box output rotations.doubleGet the conversion factor to transform the gearbox output value into the gear box input value.times(double x) Multiply the gear reduction ratio by X.
-
Constructor Details
-
GearBox
public GearBox(double[] reductionStage) Construct theGearBoxwith the reduction stages given.- Parameters:
reductionStage- Reduction stages where the number is > 0 to indicate a reduction.- Throws:
NoStagesGivenException- ifreductionStageis empty.
-
GearBox
Construct theGearBoxwith the reduction stages given.- Parameters:
reductionStage- List of stages in the format of "IN:OUT".- Throws:
InvalidStageGivenException- if any stage string does not contain a':'separator.NoStagesGivenException- ifreductionStageis empty.
-
-
Method Details
-
fromReductionStages
Create the gearbox given the reduction stages of the gearbox.- Parameters:
reductionStages- Reduction stages where the number is > 0 to indicate a reduction.- Returns:
GearBox.- Throws:
NoStagesGivenException- if no reduction stages are given.
-
fromStages
Create the gearbox given the reduction stages of the gearbox.- Parameters:
stages- Stages in the format of "IN:OUT". For example, "3:1"- Returns:
GearBox- Throws:
InvalidStageGivenException- if any stage string does not contain a':'separator.NoStagesGivenException- if no stages are given.
-
fromTeeth
Create the gearbox given the teeth of each gear in a train of meshing gears. Every gear meshes with the next one, so the reduction is the last tooth count divided by the first and the gears in between are idlers. For compound stages, where two gears share a shaft, usefromReductionStages(double...)orfromStages(String...)instead.- Parameters:
teeth- Gear teeth from the driving gear to the last driven gear.- Returns:
GearBox- Throws:
IllegalArgumentException- ifteethis null.IllegalArgumentException- ifteethhas fewer than two entries.IllegalArgumentException- if any tooth count is zero or negative.
-
times
-
div
-
getInputToOutputConversionFactor
public double getInputToOutputConversionFactor()Get the conversion factor to transform the gearbox input into the gear box output rotations.- Returns:
- OUT/IN or OUT:IN
-
getOutputToInputConversionFactor
public double getOutputToInputConversionFactor()Get the conversion factor to transform the gearbox output value into the gear box input value.- Returns:
- IN:OUT or IN/OUT
-