Automotive etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
Automotive etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

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")


Python: Fuel Economy Calculation Program

I just started the Python Program, and as soon as I started, I aim to create an entry-level resource called 'Python and Automotive' by combining some of the formulas we have 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 Fuel Economy Calculation Program below. All explanations about the program are included in the pictures and code.

Process 1: Example: If the distance you travel with 50 liters of fuel is 1300 km, the average fuel consumption:


Process 2: Example: The fuel volume to be consumed by a vehicle traveling 750 km with an average fuel consumption of 5 L / 100 km:



Process 3: Example: The way you can get with a vehicle with 40 liters of fuel and 5 L / 100km fuel consumption:




Program's Python Code
print("""
************************************
Fuel Economy Calculator

FE=Fuel Economy,(L/100km)
FVC=Fuel Volume Consumed,(L)
RT=Road Taken,(km)
************************************
Please Select What You Want to Do:

1-Calculating Fuel Economy(L/100 km)

2-Calculating the Volume of Fuel Consumed(L)

3-Calculating the distance that can be taken(km)

************************************
Barış YILDIRIM
""")


while True:
Operation = input("Select the Operation:")

if (Operation == "1"):
FVC = float(input("Please enter the volume of fuel consumed value(L):"))
RT = float(input("Please enter the road taken value(km):"))
FE = (FVC * 100) / RT
print("Fuel Economy:",FE,"L/100 km")

elif (Operation == "2"):
FE = float(input("Please enter Fuel Economy value(L/100 km):"))
RT = float(input("Please enter the road taken value(km):"))

FVC = (FE * RT) / 100

print("Fuel Volume Consumed:",FVC,"L")

elif (Operation == "3"):
FVC = float(input("Please enter the volume of fuel consumed value(L):"))
FE = float(input("Please enter Fuel Economy value(L/100 km):"))
RT = (FVC * 100) / FE

print("The distance that can be taken:",RT,"km")