

Aim: To aim of the project is to write a python code to parse the given file and extract the required data from the file and perform the following tasks
•Calculate the area under the P-V diagram.
•Calculate the power output of this engine by assuming that RPM is 1500
•This engine consumed 20 micrograms of fuel (per 1 stroke cycle). Calculate its specific fuel consumption.
Challenges-
1. Calculate the area under the P-V diagram.
Python Code:
import matplotlib.pyplot as plt
import numpy as np
from scipy import integrate
a = input('enter file name:')
if a == 'engine_data(1).out':
print('file recognise')
pressure = []
volume = []
for line in open('engine_data(1).out'):
if '#' not in line:
pressure.append(float(line.split()[1]))
volume.append(float(line.split()[7]))
pressure = 1e6*np.array(pressure)
volume = np.array(volume)
plt.plot(volume, pressure)
plt.xlabel('volume')
plt.ylabel('pressure')
plt.fill_between(volume,pressure,color ='r',alpha = 0.2)
plt.show()
#Area Calculation under P-V diagram
area1 = np.trapz(pressure,volume)
print('area under the p-v curve=',area1,'J')
#Power Output of the engine calculation
work_done = area1/2
Rev_sec = 1500/60
Power_output = work_done*Rev_sec
print('Power output of engine=',Power_output,'kW)
#caluclation of BSFC of an engine
r = 20*pow(10,-6)
p = area1
BSFC = (r/p)*3.6*pow(10,6)
print('specific fuel consumption=',BSFC,'g/KW.hr')
else:
print('file not recognised please provide valid file')
•Firstly, started with opening the file and extracting the data from the file. The necessary data Pressure and volume from the file is extracted and stored in the form of the arrays
•With the help of these values from the file plotted the pv diagram
•The task is to find the area under this pv diagram this is nothing but the work done
•There are several methods to calculate the area of the curve. The methods used here is the trapezoidal rule and Simpson’s Arule
•Python has inbuilt commands with which these calculations can be performed
•Using these commands and pressure and volume as inputs the area of the curve is obtained as shown in the code
2. Calculate the power output of this engine by assuming that RPM is 1500
•The power output of this engine is calculated by using the following formula
Power = work done * RPS (Revolution per second)
•Here work done is considered in J/rev
•Work done calculated is 500.6 J/cycle. For a 4-stroke engine, 1 cycle is 2 crank revolutions. Therefore, the work done is 250.3 J/rev
• Power = 250 J/rev* 1500/60 rev/sec = 6250 J/s
3. This engine consumed 20 micrograms of fuel (per 1 stroke cycle). Calculate its specific fuel consumption
•BSFC (Break specific fuel consumption) of an engine is a measure of the rate of fuel consumption for the unit power produced
BSFC = r/P
r = fuel consumption rate in grams per sec
p = power produced in watts
the units of BSFC are g/(kW⋅h)
results: