Challenge

Week 6 - Data analysis

DATA ANALYSIS OF ENGINE.

AIM -

  • Calculate the area under the P-V diagram. P is in column 2 and V is in column 8.
  • Calculate the power output of this engine. Assume that RPM is 1500
  • This engine consumed 20 micro grams of fuel (per 1 stroke cycle). Calculate its specific fuel consumption.

Engine Data are given:-

1-crank,2-Pressure, 3-Max_Pressure, 4-Min_Pressure, 5-Mean_Temp, 6-Max_Temp, 7-Min_Temp, 8-Volume, 9-Mass'
+'10-density, 11-integrated_HR, 12-HR_Rate, 13-C_p, 14-C_v, 15-Gamma, 16-kin-Vics, 17-Dyn_Visc

Code Solution:-

#This is a program to make it easier for data analysis using python
#Program by Dakshkumar Jadav

import matplotlib.pyplot as plt
from scipy.integrate import simps

line_count=1


try:
	file= open('engine_data.out')
	print('file opened successfully \n')

except:
	print('file does not exist\n')

print('The plot paramters given below in the series \n')
print('1-crank,2-Pressure, 3-Max_Pressure, 4-Min_Pressure, 5-Mean_Temp, 6-Max_Temp, 7-Min_Temp, 8-Volume, 9-Mass'
 +'10-density, 11-integrated_HR, 12-HR_Rate, 13-C_p, 14-C_v, 15-Gamma, 16-kin-Vics, 17-Dyn_Visc')

first_column=input('Enter the 1st column number for which you want a plot (choose a number between 1(include) and 17(include):' )
second_column=input('Enter the 2nd column number for the plot(please choose different column from column_number_1):' )
print('\n')


first_column=int(first_column)
second_column=int(second_column)

values_of_cloumn_1=[]
values_of_cloumn_2=[]

for line in open('engine_data.out'):
	if line_count is 3:
		column_name_1=line.split()[first_column]
		column_name_2=line.split()[second_column]

	if '#' not in line:
		values_of_cloumn_1.append(float(line.split()[first_column-1]))
		values_of_cloumn_2.append(float(line.split()[second_column-1]))

	line_count+=1

#Area under curve that is work done
area=float(simps( values_of_cloumn_1, values_of_cloumn_2))
print('area:{}\n'.format(area))

rpm=1500 #given
speed=rpm/60
power=area*speed
print('power:{} \n'.format(power))

mass_of_fuel=20*pow(10,-6)
specific_fuel_consumption=mass_of_fuel/power
print('specific_fuel_consumption: {}\n'.format(specific_fuel_consumption))

#plotting
plt.plot(values_of_cloumn_2,values_of_cloumn_1)
plt.xlabel(column_name_1)
plt.ylabel(column_name_2)
print(' {} vs {}'.format( column_name_1,column_name_2))
plt.show()

Calculate the area under the P-V diagram. P is in column 2 and V is in column 8.

Request Graph Volume Vs Pressure.

Area under PV- Diagram.

Result:-

Code Explanation:-

The required libraries including matplotlib.pyplot and numpy is imported.

The rst compaitablity test is done using try and except function.

After this using for loop the the names of the coloumns as well as their units are stored in arrays.

Using input function the x and y axis of the required graph is taken.

using for loop the datat in the required coloumns are stored in respective arrays.

Following this The graph is plotted,displayed and saved.

After this the PV graph is plotted. The data is taken from the respective coloumns using for loop as before.

The area under the PV graph is calculated using special function in Numpy called trapz.

After this the require values of power and Specic fuel consumptios in found out.

Thus,

The power output of Engine is 78.62 KW.

The Specific Fuel Consumption is 3.802*e^-12 g/KW.

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.