Project

Data Analysis using Python

Data Analysis is a process of collecting, transforming, cleaning, and modeling data with the goal of discovering the required information. The results so obtained are communicated, suggesting conclusions, and supporting decision-making.

OBJECTIVE :

  • 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.

INTRODUCTION :

When large simulations are performed , enormous amount of data is generated . In such cases , searching for required data manually becomes tedious . To simplfy this ,programs are written to analyse and visualize data.

In this project will be reading the data file provided by the CONVERGE analysis of an engine and retrieve the required information , the file contains a list of 17 parameters .

The data file and program file must be in the same folder.

CODE :

""" 
DATA ANALYSIS

DATA VISUALIZER

""" 

import math
import matplotlib.pyplot as plt 
import numpy as np 

try : 

	file_content =  open('engine_data.out','r')

except FileNotFoundError :

	print("File not recognized / not found , please provide a valid converge output file !")


data = []

for line in file_content :

	if '#'not in line :

		data.append(line.split())

data1 = np.transpose(data)
data1 = data1.astype(float)

# all parameters name

parameters = ['crank angle','pressure','Max_pres','min_pres','mean_temp','max_temp','min_temp','volume','mass','density','integrted_HR','HR_rate','C_p','C_v','Gamma','Kin_Visc','Dyn_visc']
print(parameters)




choose_parameter = ['crank_angle = 0','pressure=1','Max_pres=2','min_pres=3','mean_temp=4','max_temp=5','min_temp=6','volume=7','mass=8','density=9','integrted_HR=10','HR_rate=11','C_p=12','C_v=13','Gamma=14','Kin_Visc=15','Dyn_visc=16']
print(choose_parameter)
print('select the parameter by inputing corresponding parameter number and press enter : n')

print('1st parameter')
x=int(input())

print('2nd parameter')
y=int(input())


# P vs V
# as per challenge

"""
volume = data1[7,:]  
pressure = data1[1,:]*pow(10,6)          # pascals

"""

plt.plot(data1[x,:],data1[y,:],linewidth = 3,color ='red')
plt.xlabel(choose_parameter[x])
plt.ylabel(choose_parameter[y])
plt.title(choose_parameter[y]+  ' vs '  + choose_parameter[x])
plt.savefig(choose_parameter[y]+  ' vs ' + choose_parameter[x]+ '.png')
plt.show()




# calculating the area under the P-V diagram

area = np.trapz(data1[x],data1[y])
work_done = (area/ 1000 )*pow(10,6)            # Mpa to Pa   #Work done in KJ
print('area under curve =',work_done,'kJ')


# calculating the power output of the engine
# N = 1500 RPM (assumed value)

power = 2*(math.pi)*1500*area/60
print('power =' , power , 'Kw')

# calculating specific fuel consumption i.e SFC
# fuel consumption is given to be 20 micro grams of fuel ( per one stroke cycle)

# let FC be the fuel consumption in grams per stroke
# let FCH be the fuel consumption per hour
# let SFC be the the specific fuel consumption

FC = 20*pow(10,-6)                
FCH = FC* 1500*60          
SFC =FCH / (power)       # g/kWh


print('specific fuel consumption is :' , SFC , 'g/kWh')

Figure :

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.