Python: Engine / Cylinder Volume Calculation Program

I am a 4th year engineering student who has just started the Python Program and aims to extract a resource called 'Python and Automotive' (beginner level) by combining some formulas that he has learned in Automotive Engineering with Python. Of course, I will not be limited to Automotive only and will try to create original codes and programs using basic engineering knowledge and formulas.

You can find the Python code of the Engine/Cylinder Volume Calculation Program below. All explanations about the program are included in the pictures and code.

Process 1: The cylinder volume value of the 6-cylinder F1 engine with a stroke length of 5.3 cm and a cylinder diameter of 8 cm:

Formula 1 Motoru(You can see the values with this link.)


Process 2: The cylinder diameter value of the 6-cylinder F1 engine with a stroke length of 5.3 cm and a cylinder volume of 1598.44 cm3:


Process 3: The stroke length of the 6-cylinder F1 engine with a cylinder diameter of 8 cm and a cylinder volume of 1598.44 cm3:



Program's Python Code

print("""********************
Engine / Cylinder Volume Calculation

V=Stroke volume of a single cylinder(cm3 = cc)
D=Diameter of the cylinder(cm)
L=Stroke length(cm)

********************
Please Select What You Want to Do:

1-Calculating the cylinder volume by entering the stroke length and the cylinder diameter

2-Calculating the cylinder diameter by entering the cylinder volume and the stroke length

3-Calculating the stroke length by entering the cylinder volume and the cylinder diameter

*******BY*************
""")
import math

while True:
Operation = input("Select the Operation:")
Number_of_Cylinders = int(input("Please Enter the Total Number of Cylinders Value:"))
if (Operation == "1"):
D = float(input("Please Enter the Cylinder Diameter Value:"))
L = float(input("Please Enter the Stroke Length Value:"))
V = (math.pi * D ** 2) * L * 0.25 * Number_of_Cylinders
print("Total Stroke Volume Value:",V,"cc")
elif (Operation == "2"):
V = float(input("Please Enter the Total Stroke Volume Value:"))
L = float(input("Please Enter the Stroke Length Value:"))
D = ((V / (L * 0.25 * Number_of_Cylinders * math.pi))) ** 0.5
print("Cylinder Diameter Value:", D, "cm")
elif (Operation == "3"):
V = float(input("Please Enter the Total Stroke Volume Value:"))
D = float(input("Please Enter the Cylinder Diameter Value:"))
L = (((4 * V ) / (math.pi * D ** 2) / Number_of_Cylinders))
print("Stroke Length Value:", L, "cm")


Hiç yorum yok:

Yorum Gönder