Project

Data analysis

CODE :

\"\"\"
		ENGINE DATA ANALYSIS
\"\"\"
\"\"\"
0-Crank		4-Mean_Temp	 8-Mass				12-C_p 16-Gamma 	16.Dyn_Visc 
1-Pressue	5-Max_temp	 9- Desnsity 		13-C_v 
2-Max_Pres	6-Min_temp	10-Integrated_HR	14-Gamma
3-Min_Pres	7-Volume	11-HR_Rate			15-Kin_Visc 
\"\"\"
Enter_x_parameter=8
Enter_y_parameter=9
\"\"\"
	Compatability Check
\"\"\"
if  Enter_x_parameter in range(-1,17) and Enter_y_parameter in range(-1,17):
#import modules
	import matplotlib.pyplot as plt
	import math
	
#Program for data  parsing
	x_parameter=[]
	y_parameter=[]

	a=Enter_x_parameter
	b=Enter_y_parameter


	for line in open(\'engine_data.out\'):
		if \'#\' not in line:
			x_parameter.append(float(line.split()[a]))
			y_parameter.append(float(line.split()[b]))
#TO EXTRACT LABELS:
	parameters= [\'Crank(Deg)\',\'Pressure(MPa)\',\'MaxPres(MPa)\',\'MinPres(MPa)\',\'MeanTemp(K)\',\'MaxTemp(K)\',\'MinTemp(K)\',\'Volume(m^3)\',\'Mass(kg)\',\'Density(kgm^-3)\',\'IntegratedHR(J)\',\'HRRate(Js^-1)\',\'Cp(Jkg^-1K^-1) \',\'Cv(Jkg^-1K^-1)\',\'Gamma\',\'KinVisc(m2s^-1)\',\'dynvisc(Nm^2s^-1)\']		
#PLOT
	filename=parameters[b] +  \'VS\'  + parameters[a] + \'.png\'
	plt.figure()
	plt.plot(x_parameter,y_parameter,linewidth=3)
	plt.xlabel(parameters[a])
	plt.ylabel(parameters[b])
	plt.title(parameters[b] + \'_VS_\' + parameters[a])
	plt.savefig(filename)
	plt.show()
else:
	print(\'File not recognized. Please provide a valid CONVERGE output file\')



\"\"\"
	CALCULATION OF AREA OF PV DIAGRAM
\"\"\"
#import module
from numpy import trapz

pressure=[]
volume=[]

for line in open(\'engine_data.out\'):
	if \'#\' not in line:
		pressure.append(float(line.split()[1]))
		volume.append(float(line.split()[7]))
PV_area=trapz(pressure,volume)
print(\'Area under the PV diagram is\', PV_area,\'m^2\' )

\"\"\"
	CALCULATION OF POWER
\"\"\"
speed=1500 #rpm
power=PV_area*1e+06*speed/9550 #KW

print(\'The Output power of the engine is\',power,\'kW \')

\"\"\"
	CALCULATION OF SPECIFIC FUEL CONSUMPTION
\"\"\"
fuel_mass=20*1e-6
specific_fuel_consumption=20*1e-6*speed*3600/(power*60)
print(\'The specific fuel consumption of the engine is \',specific_fuel_consumption,\'kN\')

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.