-
Notifications
You must be signed in to change notification settings - Fork 0
/
Formula.java
132 lines (120 loc) · 2.89 KB
/
Formula.java
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/**
* This is the Formula class that stores and calculates variables
*/
public class Formula{
/** r is a double value.*/
private double r = 0;
/** w is a double calculated value.*/
private double w = 0;
/** changeMax is a double calculated value.*/
private double changeMax = 0;
/** mMax is a double calculated value.*/
private double mMax = 0;
/** length is a double beam length.*/
private double length = 0;
/** exi is a double E x I value.*/
private double exi = 0;
/** dl is a double dead load value.*/
private double dl = 0;
/** ll is a double live load value.*/
private double ll = 0;
/** caseNum is an integer case number.*/
private int caseNum = 0;
/** modelName is a String model name.*/
private String modelName = "";
/**
* This constructor sets the saved values into this class' variables.
* @param length is a double
* @param exi is a double
* @param dl is a double
* @param ll is a double
* @param caseNum is an integer
* @param name is a string
*/
public Formula(double length, double exi, double dl, double ll, int caseNum, String name) {
this.length = length;
this.exi = exi;
this.dl = dl;
this.ll = ll;
this.caseNum = caseNum;
this.modelName = name;
}
/**
* This is the getter method for beam length.
* @return length
*/
public double getLength() {
return length;
}
/**
* This is the getter method for E x I.
* @return exi
*/
public double getExI() {
return exi;
}
/**
* This is the getter method for the model name.
* @return modelName
*/
public String getName() {
return modelName;
}
/**
* This is the getter method for the dead load.
* @return dl
*/
public double getDead() {
return dl;
}
/**
* This is the getter method for the live load.
* @return ll
*/
public double getLive() {
return ll;
}
/**
* This is the getter method for the case number.
* @return caseNum
*/
public int getCase() {
return caseNum;
}
/**
* This is the calculate method for W, which is dependent on the case number the user selects.
* @return w
*/
public double calcW() {
if (caseNum == 1) {
w = 1*dl + 1*ll;
}else {
w = 1.25*dl + 1.5*ll;
}
return w;
}
/**
* This is the calculate method for the resistance at the ends of the beam, which is dependent on the W calculated.
* @return r
*/
public double calcR() {
r = calcW() * length /2;
return r;
}
/**
* This is the calculate method for the maximum change in deflection.
* @return changeMax
*/
public double calcChangeMax() {
changeMax = (5*calcW()*Math.pow(length, 4)*Math.pow(10, 12))/(384*exi);
return changeMax;
}
/**
* This is the calculate method for the maximum moment.
* @return mMax
*/
public double calcMmax() {
mMax = (calcW()*Math.pow(length, 2))/8;
return mMax;
}
}