Vatvolume calculator

<script language="JavaScript"> function perRound(num, precision) { var precision = 3; //default value if not passed from caller, change if desired // remark if passed from caller precision = parseInt(precision); // make certain the decimal precision is an integer var result1 = num * Math.pow(10, precision); var result2 = Math.round(result1); var result3 = result2 / Math.pow(10, precision); return zerosPad(result3, precision); } function zerosPad(rndVal, decPlaces) { var valStrg = rndVal.toString(); // Convert the number to a string var decLoc = valStrg.indexOf("."); // Locate the decimal point // check for a decimal if (decLoc == -1) { decPartLen = 0; // If no decimal, then all decimal places will be padded with 0s // If decPlaces is greater than zero, add a decimal point valStrg += decPlaces > 0 ? "." : ""; } else { decPartLen = valStrg.length - decLoc - 1; // If there is a decimal already, only the needed decimal places will be padded with 0s } var totalPad = decPlaces - decPartLen; // Calculate the number of decimal places that need to be padded with 0s if (totalPad > 0) { // Pad the string with 0s for (var cntrVal = 1; cntrVal <= totalPad; cntrVal++) valStrg += "0"; } return valStrg; } // send the value in as "num" in a variable // clears field of default value function clear_field(field) { if (field.value==field.defaultValue) { field.value='' } } // data definitions // variables var i=""; function ClearForm(form){ form.rad1.value = ""; form.rad2.value = ""; form.height.value = ""; form.vol.value=""; form.answer.value=""; } function rad1(rad2, height, vol) { stuff1= eval((3*vol)/(Math.PI*height)); stuff1 = eval((stuff1) - eval(rad2*rad2)); stuff1 = Math.abs(eval(stuff1/2)); stuff1 = eval(Math.sqrt(stuff1)); return stuff1; } function rad2(rad1, height, vol) { inside=eval(3*vol/(Math.PI*height)); inside= eval(inside - 2*rad1*rad1); inside=Math.abs(inside); stuff2=eval(Math.sqrt(inside)); return stuff2; } function height(rad1, rad2, vol) { barheight=(eval(eval(2*rad1*rad1)+ eval(rad2*rad2))*Math.PI); barheight=eval((3*vol)/barheight); return barheight; } function vol(rad1, rad2, height) { p = Math.PI; barvol=eval(eval(2*rad1*rad1) + eval(rad2*rad2)); barvol=eval(height * p * barvol/3); return barvol; } function checkform(form) { if (form.rad1.value==""&&form.rad2.value==""&&form.height.value=="") { i = 4; return true; } if (form.rad1.value==""&&form.rad2.value==""&&form.vol.value=="") { i = 4; return true; } if (form.vol.value==""&&form.rad1.value==""&&form.height.value=="") { i = 4; return true; } if (form.vol.value==""&&form.rad2.value==""&&form.height.value=="") { i = 4; return true; } if (form.vol.value==""&&form.height.value=="") { i = 4; return true; } if (form.rad1.value==""&&form.vol.value=="") { i = 4; return true; } if (form.rad2.value==""&&form.height.value=="") { i = 4; return true; } if (form.rad2.value==""&&form.vol.value=="") { i = 4; return true; } if (form.rad1.value==""&&form.rad2.value=="") { i = 4; return true; } if (form.rad1.value==""&&form.height.value=="") { i = 4; return true; } if (form.vol.value==""){ i = 0; return true; } else if (form.rad1.value=="") { i = 1; } else if (form.rad2.value==""){ i = 2; } else if (form.height.value==""){ i = 3; } return true; } function computeform(form) { if (checkform(form)){ if (i ==4) { alert("\n INCOMPLETE DATA! \n Plese complete form first"); } else if (i ==1){ barr1=Math.abs(rad1(form.rad2.value, form.height.value, form.vol.value)); form.rad1.value=barr1; form.answer.value=barr1; } else if (i ==2){ barr2=Math.abs(rad2(form.rad1.value, form.height.value, form.vol.value)); form.rad2.value=barr2; form.answer.value=barr2; } else if (i ==3){ barht=Math.abs(height(form.rad1.value, form.rad2.value, form.vol.value)); form.height.value=barht; form.answer.value=barht; } else if (i ==0) { barvolume=Math.abs(vol(form.rad1.value, form.rad2.value, form.height.value)); form.vol.value=barvolume; form.answer.value=perRound(barvolume); } } return true; } </script>
Barrel End Radius r1 Units
Barrel Center Radius r2 Units
Barrel Height h Units
   
Barrel Volume Cubic Units
Barrel Volume Rounded Cubic Units

Vatvolume-calculator om het volume van een vat te vinden op basis van waarden van de boven- of bodemradius en de middelste straal van het vat. Barrel is een grote ronde container, met platte uiteinden en gebogen zijden.

Barrel Volume Formula & Calculation

Formules

Volume = (H * PI * (2 * R1 2 + R2 2 ) / 3)

Vatvolume calculator