Challenge

Week 6 - Data analysis

AIM:

To evaluate the performance of an engine thermodynamics data in line with data parsing and file compatibility check.

THEORY:

Data analytics is an emerging field where huge data is to be evaluated and useful results are extracted for better performance and services ,handling high data is difficult manually and computers with programming language has made it easier for humans .

Trapz function is used to calculate the area under the graph enclosed by two variables,it calculates the approximated area for the given data by splitting them into huge smaller trapezoids and calculating their area for all the trapezoids.

OBJECTIVE:

The main motive of the program is to learn data analytics with python or data parsing in python.

BODY OF THE CONTENT :

Python is used as programming language

"""
program to check the performanc eof an engine  by using data analysis 
written by GAGAN.k
mail id- [email protected]
 in this program we are going to evaluate the engine performance of an engine thermodyanmic data and more 
 task are here to understand data analysis  with python .
 
"""
#importing suitable libraries for the functionalities 
import numpy as np 
import math 
import matplotlib.pyplot as plt 

# checking the file type and compatibility
file_name=input("Enter the file name : ")

if file_name == ("engine_data.out") :
	print("file is compatible for the following tasks ")
	print("                                        ")
else:
	print("File not recognized .Please provide a valid CONVERGE file output ")
	exit()
#-----------------------------------------------------------------------------------------------

#creating  array for storing the data
data=[]
for line in open("C:\\Users\\User\\programinng\\engine_data.out"):
	if "#" in line:
		data.append(line.split( ))

#storing data types in different array 
column_entries=[]   #array for column variable entries
column_units=[]     #aray for units of column variables
column_no=[]        #array having the numerical value pointing the variables
for a in data[2]:
	if a!= "#":
		column_entries.append(a)
for b in data[3]:
	if b!="#":
		column_units.append(b)
for c in data[1]:
	if c !="column" and c!="#":
		column_no.append(c)
#----------------------------------------------------------------------------------------------------

#displaying the data_entries in the file
#making dictionary and storing the values 
column_no_vs_column_entries={}
column_entries_vs_column_units={}
for a in range(0,len(column_no)-1):
	column_no_vs_column_entries[column_no[a]]=column_entries[a]
for b in range(0,len(column_no)-1):
	column_entries_vs_column_units[column_units[b]]=column_entries[b]

print("column entries and their corresponding identification no ")
print(column_no_vs_column_entries)
print("                                                     ")
print("column entries and their corresponding units ")
print(column_entries_vs_column_units)

#-----------------------------------------------------------------------------------------------------

#taking input from the user and plotting the required plots 
xaxis=int(input("enter the column no of your intrested with corresponding no for plotting the graph as (xaxis) : "))
yaxis=int(input("enter the column no of your intrested with corresponding no for plotting the graph as (yaxis) : "))


x=[]           #xaixs values array
y=[]           #yaxis values array
for line   in open("C:\\Users\\User\\programinng\\engine_data.out"):
	if "#" not in line:
		x.append(float(line.split()[xaxis-1]))
		y.append(float(line.split()[yaxis-1]))


#plotting the suitable graphs
plt.plot(x,y)
plt.xlabel(column_entries[xaxis-1] + column_units[xaxis-1])
plt.ylabel(column_entries[yaxis-1] + column_units[yaxis-1])
plt.title(column_entries[yaxis-1] + " VS " + column_entries[xaxis-1])
#plt.savefig("column_entries[xaxis-1].png")
plt.show()
print("-------------------------------------------------------------------------------")

#-------------------------------------------------------------------------------------------------------
#basic performance caluculation of the thermodynamic data
pressure=[]
volume=[]

for line   in open("C:\\Users\\User\\programinng\\engine_data.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)
#print(pressure)
#print(volume)
print("---------------------------------------------------------------------------------------")
#calculating work done from area under the graph
work_done=np.trapz(pressure,volume)
print("work done by the engine ",str(work_done)+"j")
print("---------------------------------------------------------------------------------------")
#calculating the power since RPM is given as 1500
#taking 4stroke and 1 cylinder engine
power=work_done*(1500/(2*60))
print("power_developed is " ,str(power)+"w")
print("---------------------------------------------------------------------------------------")

#calculating the specific fuel consumption (fuel consumed is 20mg)
sfc=(20*pow(10,-3)*3600*(1500/2*60))/(power*1000)
print("specific fuel consumption is ",str(sfc)+"(kg/hr)/kw" )

#-------------------------------------------------------------------------------------------------

RESULTS:The suitable plots and the results displayed in the command prompt are as below

  • Work done or developed by the engine is - 500.6 (j)
  • Power produced from the engine is - 6257.3 (w)
  • Specific fuel consumption of the engine is - 0.52 (kg/hr*kw)
  • CONCLUSION:

    The project has taken ahead to data analytics with data parsing of huge file faced some challenges like memory error while solving the task initially I felt it was difficult for file compatibility check still by checking the name of the file is not a good idea as per my side but i asked my friends and other posts for the challenge and finally done with the task by evaluating its name.

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.