Challenge

Data analysis using PYTHON

AIM:

Python program for parsing data file and generating desired plots.

THEORY:

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 micrograms of fuel (per 1 stroke cycle). Calculate its specific fuel consumption.

INTRODUCTION:

When large simulations are performed, an enormous amount of data is generated. In such cases, searching for required data manually becomes tedious. To simplify this, programs are written to analyses 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

PYTHON PROGRAM:

""" 
DATA ANALYSIS and VISUALIZATION USING PYTHON
""" 
#IMPORTING MODULES
import math
import matplotlib.pyplot as plt 
import numpy as np 

#Opening File
try : 
	f = open('engine_data.out','r')
except FileNotFoundError:
	print("File not recognized / not found , please provide a valid converge output file !")

Value = []
#Reading from file and assigning in array
for line in f:
	if '#'not in line :
		Value.append(line.split())
column = np.transpose(Value)
column= column.astype(float)

Parameter=['CrankAngle','Pressure','Max_presure','Min_pressure','Mean_temp','Max_temp','Min_temp','Volume','Mass','Density','Integrated_HR','HR_Rate','CP','CV','Gamma','Kine_viscosity','Dyn_viscosity']
print(Parameter)
print('Following are the CODE for the Paraameters,Type the Code You Want\n')
corr_num=['CrankAngle = 0','Pressure = 1','Max_presure = 2','Min_pressure = 3','Mean_temp = 4','Max_temp = 5','Min_temp = 6','Volume = 7','Mass = 8','Density = 9','Integrated_HR = 10','HR_Rate = 11','CP = 12','CV = 13','Gamma = 14','Kine_viscosity = 15','Dyn_viscosity = 16']
print(corr_num)
print('Enter the CODE for X-axis, Then Press Enter: \n')
x=int(input())
print('Enter the CODE for Y-axis, Then Press Enter: \n')
y=int(input())

hold()
#PLOTTING
plt.plot(column[x,:],column[y,:],color='red',linewidth=3)
plt.xlabel(Paraameter[x],color='green',fontsize=12)
plt.ylabel(Paraameter[y],color='green',fontsize=12)
plt.title(Paraameter[x]+' VS '+Paraameter[y])
plt.savefig('Paraameter[x]'+'VS'+'Paraameter[y]'+'.png')
plt.show()

#As per Challenge:
vol=column[7,:]
#Pressure into Pascal
pre=column[1,:]*pow(10,6)

#Area Under the Curve
#Using Trapazodial rule
work=[]
for i in range(0,8664):
	work.append((vol[i+1]-vol[i])*pre[i+1]+pre[i]*0.50)

work_done=0
for j in range(0,len(work)):
	work_done=work_done+work[j]
print('WORK DONE: ', work_done,'J')

Speed=1500/60
power=work_done*Speed
print('POWER: ',power/1000,'KW')

mf=20*pow(10,6)
Specificfuel=(mf*3600)/power
print('Specific fuel Consumption: ',Specificfuel,'g/KWhr')

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.