-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransmission.java
More file actions
61 lines (53 loc) · 1.68 KB
/
Transmission.java
File metadata and controls
61 lines (53 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import java.util.*;
public abstract class Transmission {
double mTorque;
double mHorsepower;
double mRPM;
int mGearRatio;
Dictionary<Integer, Double> mRatios = new Hashtable<Integer, Double>();
Clutch mClutch;
Chassis mChassis;
boolean mBrake;
//Transmission receives mTorque from flywheel and mHorsepower from engine. The gearRatios have initialized values.
Transmission(Clutch pClutch, Chassis pChassis, double pTorque, double pGear1, double pGear2, double pGear3, double pGear4, double pGear5, double pGear6) {
mTorque = pTorque;
mRPM = 1;
mGearRatio = 1;
mBrake = false;
mClutch = pClutch;
mChassis = pChassis;
mRatios.put(1, pGear1);
mRatios.put(2, pGear2);
mRatios.put(3, pGear3);
mRatios.put(4, pGear4);
mRatios.put(5, pGear5);
mRatios.put(6, pGear6);
}
//Saves the energy received from the FlyWheel
public void receiveEnergy(double pHorsepower) {
mHorsepower = pHorsepower;
}
//Calculates RPM for wheels
public double outputRPM() {
if(mBrake == false) {
//mTorque = (mHorsepower * 5252) / (mRPM );
double vRPM = (mHorsepower * 5252) / mTorque;
mRPM = vRPM;
return vRPM;
}
else {
return 0;
}
}
public double outputMPH() {
return mRPM / (mGearRatio * mChassis.mWheelAxisRatio);
}
void releaseBrake(){
mBrake = false;
}
void pressBrake(){
mBrake = true;
}
//How the mGearRatio is determined
abstract void changeGear(int x);
}