Displacement Calculator

[insert_php]
$pi = 3.141592653589;
//—————————————-
//cylinder volume = pi/4 x bore^2 x stroke
if($_POST[‘a’] == “cv”)
{
$cv_bore = $_POST[‘cv_bore’];
$cv_stroke = $_POST[‘cv_stroke’];
$cv_errors = 0;
if($_POST[‘cv_bore’] == “”) {$cv_errors++;}
else { if(!is_numeric($_POST[‘cv_bore’])) {$cv_errors++;} }

if($_POST[‘cv_stroke’] == “”) {$cv_errors++;}
else { if(!is_numeric($_POST[‘cv_stroke’])) {$cv_errors++;} }

if($cv_errors != 0) {$cv_error_msg = “Please enter proper values!”;}
else
{
$total_cylinder_volume = $pi / 4 * $_POST[‘cv_bore’] * $_POST[‘cv_bore’] * $_POST[‘cv_stroke’];
$view_total_cylinder_volume = ”   Cylinder Volume = “.$total_cylinder_volume;
}
}
//—————————————-
//piston displacment = pi/4 x bore^2 x stroke x number of cylinders
if($_POST[‘a’] == “pd”)
{
$pd_bore = $_POST[‘pd_bore’];
$pd_stroke = $_POST[‘pd_stroke’];
$pd_nr_cylinders = $_POST[‘pd_nr_cylinders’];
$pd_errors = 0;
if($_POST[‘pd_bore’] == “”) {$pd_errors++;}
else { if(!is_numeric($_POST[‘pd_bore’])) {$pd_errors++;} }

if($_POST[‘pd_stroke’] == “”) {$pd_errors++;}
else { if(!is_numeric($_POST[‘pd_stroke’])) {$pd_errors++;} }

if($_POST[‘pd_nr_cylinders’] == “”) {$pd_errors++;}
else { if(!is_numeric($_POST[‘pd_nr_cylinders’])) {$pd_errors++;} }

if($pd_errors != 0) {$pd_error_msg = “Please enter proper values!”;}
else
{
$total_piston_displacement = $pi / 4 * $_POST[‘pd_bore’] * $_POST[‘pd_bore’] * $_POST[‘pd_stroke’] * $_POST[‘pd_nr_cylinders’];
$view_total_piston_displacement = ”   Piston Displacement = “.$total_piston_displacement;
}
}
//—————————————-
//stroke = displacement / (pi/4 x bore^2 x number of cylinders)
if($_POST[‘a’] == “s”)
{
$s_bore = $_POST[‘s_bore’];
$s_displacement = $_POST[‘s_displacement’];
$s_nr_cylinders = $_POST[‘s_nr_cylinders’];
$s_errors = 0;
if($_POST[‘s_bore’] == “”) {$s_errors++;}
else { if(!is_numeric($_POST[‘s_bore’])) {$s_errors++;} }

if($_POST[‘s_displacement’] == “”) {$s_errors++;}
else { if(!is_numeric($_POST[‘s_displacement’])) {$s_errors++;} }

if($_POST[‘s_nr_cylinders’] == “”) {$s_errors++;}
else { if(!is_numeric($_POST[‘s_nr_cylinders’])) {$s_errors++;} }

if($s_errors != 0) {$s_error_msg = “Please enter proper values!”;}
else
{
$total_stroke = $_POST[‘s_displacement’] / ($pi / 4 * $_POST[‘s_bore’] * $_POST[‘s_bore’] * $_POST[‘s_nr_cylinders’]);
$view_total_stroke = ”   Stroke = “.$total_stroke;
}
}
//—————————————-
//bore = sqrt (displacement / (pi/4 x stroke x number of cylinders))
if($_POST[‘a’] == “b”)
{
$b_stroke = $_POST[‘b_stroke’];
$b_displacement = $_POST[‘b_displacement’];
$b_nr_cylinders = $_POST[‘b_nr_cylinders’];
$b_errors = 0;
if($_POST[‘b_stroke’] == “”) {$b_errors++;}
else { if(!is_numeric($_POST[‘b_stroke’])) {$b_errors++;} }

if($_POST[‘b_displacement’] == “”) {$b_errors++;}
else { if(!is_numeric($_POST[‘b_displacement’])) {$b_errors++;} }

if($_POST[‘b_nr_cylinders’] == “”) {$b_errors++;}
else { if(!is_numeric($_POST[‘b_nr_cylinders’])) {$b_errors++;} }

if($b_errors != 0) {$b_error_msg = “Please enter proper values!”;}
else
{
$total_bore = sqrt ( $_POST[‘b_displacement’] / ($pi / 4 * $_POST[‘b_stroke’] * $_POST[‘b_nr_cylinders’]));
$view_total_bore = ”   Bore = “.$total_bore;
}
}
//===============================================
$content = ‘



Cylinder Volume Calculators
$cv_error_msg
Bore:
Stroke:
$view_total_cylinder_volume



Piston Displacement Calculators
$pd_error_msg
Bore:
Stroke:
Number of Cylinders:
$view_total_piston_displacement

 


Stroke Calculators
$s_error_msg
Bore:
Displacement:
Number of Cylinders:
$view_total_stroke



Bore Calculators
$b_error_msg
Stroke:
Displacement:
Number of Cylinders:
$view_total_bore

‘;

$content = addslashes($content);
$content = “\$result=\””.$content.”\”;”;
eval($content);
print stripslashes($result);
[/insert_php]

How to Guides

View All >
10 People Who Made the Ford Motor Company What It Is Today
Slideshow: Ten people who shaped the modern Ford Motor Company.
Read It
Roush Gives the 2024 Ford F-150 Visual and Performance Overhaul
Slideshow: Roush never disappoints when it comes to their takes on Ford vehicles.
Read It
Ford F-150 Lightning Purchase Turns Into a Nightmare for Owner
Slideshow: Luckily, the automaker was willing to help.
Read It
Top 10 WORST Excuses to NOT Buy a Ford Truck!
Slideshow: Ten worst excuses for not buying a Ford truck or SUV.
Read It

All times are GMT -5. The time now is 07:15 AM.