Project

Data Analysis With Python

# File paring with python - Engine Data


import matplotlib.pyplot as plt 
import numpy
# emptry array for all parameters from engine test data
Crank = []
Pressure = []
Max_P = []
Min_P = []
Mean_Temp = []
Max_Temp = []
Min_Temp = []
Volume =[]
Mass = []
Rho = []
HR_int = []
HR_rate = []
Cp = []
Cv = []
gamma = []
k_vis = []
d_vis = []

line_count = 1
for line in open(\'engine_data.out\'):
	if \'#\' not in line:
		Crank.append(float(line.split()[0]))
		Pressure.append(float(line.split()[1]))
		Max_P.append(float(line.split()[2]))
		Min_P.append(float(line.split()[3]))
		Mean_Temp.append(float(line.split()[4]))
		Max_Temp.append(float(line.split()[5]))
		Min_Temp.append(float(line.split()[6]))
		Volume.append(float(line.split()[7]))
		Mass.append(float(line.split()[8]))
		Rho.append(float(line.split()[9]))
		HR_int.append(float(line.split()[10]))
		HR_rate.append(float(line.split()[11]))
		Cp.append(float(line.split()[12]))
		Cv.append(float(line.split()[13]))
		gamma.append(float(line.split()[14]))
		k_vis.append(float(line.split()[15]))
		d_vis.append(float(line.split()[16]))

	line_count = line_count + 1

Engine_Parameter = [Crank,Pressure,Max_P,Min_P,Mean_Temp,Max_Temp,Min_Temp,Volume,Mass,Rho,HR_int,HR_rate,Cp,Cv,gamma,k_vis,d_vis]
title = [\'Crank_Angle\',\'Pressure\',\'Maximum_Pressure\',\'Minimum_Pressure\',\'Mean_Temperature\',\'Maximum_Temperature\',\'Minimum_Temperature\',\'Volume\',\'Mass\',\'Density\',\'Integrated_HR\',\'HR_Rate\',\'Cp\',\'Cv\',\'Gamma\',\'Kinematic_Viscosity\',\'Dyna,ic_Viscosity\']


# Plot Pressure vs Volume
plt.plot(Engine_Parameter[7],Engine_Parameter[1],color = \'r\',linewidth = 1)
plt.title(title[7] + \'_vs._\'  + title[1])  
plt.xlabel(title[7] + \'(m^3)\')
plt.ylabel(title[1] +\'(MPa)\')

plt.show()

# work done - integrate the area under curve by using trapezoidal reule - numpy.trapz  function 
# Work Done = Pressure * Volume

Work = 1e3*numpy.trapz(Engine_Parameter[2],Engine_Parameter[7])
print(\'The Work Done in Cycle:\',\"{0:.3f}\".format(Work),\'KJ\')  # Print output upto three digit

# Power = Workdone per unit time
rpm = 1500

Power = Work * (rpm/(60*2))
print(\'Power:\',\"{0:.3f}\".format(Power),\'KW\')

# Fule Consumption

Mf = 20e-6  # micro gram to kg
Fuel_Consumption = Mf * 3600 * 1000
sfc = Fuel_Consumption/Power
print(\'Specific Fuel Consumption:\',\"{0:.3f}\".format(sfc),\"g/KWhr\")

PV Diagram

\"PV

Output

\"Output\"

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.