Project

Data parsing of Combustion Engine Using a PYTHON code

Objective:

The objective of this project is to write a PYTHON code to extract the data from the \'engine_data.out\' and calculate the work done, power output and specific fuel consumption of the engine.

Definitions and Formulas:

Power Output:

Engine power or horsepower is the maximum power that an engine can put out. It can be expressed in kilowatts or horsepower. The power output depends on the size and design of the engine, but also on the speed at which it is running and the load or torque. Maximum power is achieved at relatively high speeds and high load.

The formula for calculation of the power output is given by

`Power=workdone*(rpm/120)`

where work-done is the area under the P-V curve and the rpm is given as 1500.

Specific Fuel Consumption:

Brake-specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational or shaft power. It is typically used for comparing the efficiency of the internal combustion engine with a shaft output. It is the rate of fuel consumption divided by the power produced. It may also be thought of as power-specific fuel consumption, for this reason. BSFC allows the fuel efficiency of different engines to be directly compared.

The Specific fuel consumption of an engine is the rate of fuel burnt to produce a unit of thrust.

The formula for calculation of specific fuel consumption is given by

`S_fc= (fuel consumption per second)/Power`

`S_fc`is specific fuel consumption.

Procedure:

  • Import the numpy, matplotlib and math modules to perform the array, plotting and the math operations respectively.
  • Define the empty arrays pm1 and pm2 which defines the parameters that are inputeed by the user and are to be plotted against each other.
  • Read the data from the file \'engine_data.out\' and doesn\'t include the comment lines (i.e do not read the lines with #).
  • Assign the labels using the column number inputted by user and extract them from the given data using line.split() command.
  • Append the values to the empty arrays that we had defined as per the column number inputted by user.
  • Plot the parameter arrays pm1 and pm2 against each other and assign labels.
  • Using the array indexing plot the graph between the pressure and volume specifically.
  • calculate the area under the PV curve ( work done) using np.trapz.
  • Specific fuel consumption and the power of the engine shall be calculated usiing the standard formulas.

The data file is present in the below format.

\"\"

The code for creating graphs according to the column number entered by the user is given as follows.

The OUTPUT Repl screen will be as follows.

\"\"

\"\"

THE Plots will be saved in the same folder.Exemplar of the plots are as follows-

\"\"

\"\"

The code for finding the work done,power and the specific fuel consumption is given as

import matplotlib.pyplot as plt
import os.path
from os import path
import numpy as np
from numpy import trapz
import math

rpm = 1500
fuelrate = 20e-6*(1500/2)*60 #kg/hr
pm1 = [] #array of the parameter whose column number is provided and is to be ploteted on y axis
pm2 = [] #array of the parameter whose column number is provided and is to be ploteted on x axis
press=[]
vol=[]
linecount=1


for line in open(\'engine_data.out\'):
	if \'#\' not in line:
		press.append(float(line.split()[7]))
		vol.append(float(line.split()[1]))
	if linecount is 3:
		xl1=line.split()[8]
		yl1=line.split()[2]
	if linecount is 4:
			yl2 = line.split()[2]
			xl2 = line.split()[8]
	linecount = linecount+1
cross = \" vs \"
filename = yl1+yl2+cross+xl1+xl2+\".png\"

plt.figure()
plt.plot(press,vol,\'-\')
plt.xlabel(xl1+xl2)
plt.ylabel(yl1+yl2)
plt.title(yl1+yl2+cross+xl1+xl2)
#plt.savefig(filename)
plt.show()

#calculate the area
#print(press)
#print(vol)
area=np.trapz(press,vol)
area=area*1000
print(\'The work done as per the given data is\', area,\'kj\')
power=(rpm*area)/120
print(\'The power of the given engine is\',power,\'KW\')
fuelperstroke=20*pow(10,-6)
fuelpersec=fuelperstroke*rpm*60
specificfuelconsumption=fuelpersec/(power*10*3)
print(\'specific fuel consumption is\',specificfuelconsumption,\'g/kwh\')

The Pressure-volume plot and the Output screen is obtained as-

\"\"

\"\"

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.