Firstly, their are some terms that need to established. The basic terms to know for now are: flange, web, width, height, and thickness of material. Here is a simple diagram that I made using Inkscape. Inkscape was used to make all of the diagrams and formulas. This diagram points out all of the aforementioned terms:
The flanges are the top and bottom, while the web is the center support. The width and height are self explanatory, but the thickness of material is important. You need the thickness in order to use these formulas and calculations.
Now that those are defined, here is how I made the calculator:
I knew that in order to make a working calculator I would need formulas. A calculator needs formulas so that the values can be set to a variable. Then the variables are plugged into the formula and it spits out the answer. So the first thing I did was to get the formulas that Dr. Harris gave us. These were the Moment of Inertia and the Deflection formulas.
The formula for Moment of Inertia is this:
B = base or width of beam
H^3 = height of beam cubed
Multiple both together and then divide by twelve
This formula works for a solid beam, but what about and I beam? An I beam has two empty spaces on either side of the web. These spaces need to be removed from the formula as there is no support there. This can be done by finding that area and subtracting it from the whole area. The whole area is dubbed as positive space, or I-pos. The empty area is dubbed as negative space or I-neg. Here is a diagram to demonstrate positive versus negative space:
How we find I-neg is to remove the top and bottom, known as flanges, from the area. This can be done if we know the thickness of material. We take the thickness of material and multiply it by two and then subtract it from the height. We also need to get rid of the web. This can also be done if we know the thickness of material. Simply subtract the thickness from the base or width.
I then came up with a modified formula to find the negative area:
B = base
H = height
T = thickness
This formula allows you to take the base, height, and thickness of material and plug them in directly. (Base minus thickness) times (height minus 2 thickness) cubed and then divided by twelve. This gives you the actual area known as I-total. This is the Moment of Inertia. The result, I-total, is used in the deflection formula. Here is the deflection formula:
P = concentrated load in Lbs
L = length, typically the span
E = Modulus of Elasticity
I = Inertia
(Load times span) cubed divided by (48 times Elasticity times Inertia)
Span is another term that needs clarification. The span of the beam is the distance between the two points of contact. Another way to think of span is the gap that the beam spans. The length is the overall length. This is used for calculating the weight. Here is a diagram showing length versus span:
I was able to use the deflection formula with any modification. However I did substitute the Modulus of Elasticity for the elasticity of basswood. The calculator is a one trick pony. It will only calculate the Moment of Inertia and Deflection for a basswood I-beam. The elasticity of basswood is 1,460,00 Lbs/in^2 or PSI. This means that basswood will spring back until 1,460,00 pounds of force are applied. Basswood is fairly springy.
Once the formulas were squared away, the next step was programming. I decided not to start from scratch and use some existing code. I used some of my existing unit converter code plus some code that another person wrote. Dr. Harris recommended the class to look at the old classes and I came upon some usable code. The code was basic and in all honesty, pretty bad. Here is the student's page that wrote the code. The calculator had some odd formulas in it, the inputs were basic, and only one output.
I took my code, the aforementioned code, and a little bit of another code and made them into a working calculator. Here is her page for this calculator. I took the main layout of the rough code and stripped down to the bare codding. The only things I kept were the text boxes and the output coding. The main piece of coding that came from the second code was the text withing the text box. This is fairly simple, you create the basic text box code and then write in 'placeholder="namehere" '. Simply replace the namehere with whatever you want the text box to display.
placeholder="name"