Project

DATA ANALYSIS

1. This program uses the data from the extension(.out) file and It also checks the file.compatibility. If the file is not having a proper format then the code will throw an error statement. \".

If the format is correct following steps:-

2. Data analysis is carried out by extracting the data from the file and plots the respective curve by taking the input from the user the dependent variable and independent variable the program automatically extracts the column name and label the P- V curve

3. In the final step from the PV diagram Area under the P-V curve is calculated using the Trapezoidal Rule As we Know

An area under the P-V diagram is equal to Work Done

4. In the next step Work was done that is calculated is used for calculating the power output

Power = Work *Speed

5. Specific Fuel Consumption = Mass of Fuel Consumption per hour/Power Developed in KW

\"\"\"
DATA VISUALIZE
\"\"\"
import matplotlib.pyplot as plt
import numpy as np
import sys
import math

#Opening the file

try:

  f=open(\'engine_data.out\',\'r\')
except FileNotFoundError:
  print(\'File not recognized. Please provide a valid CONVERGE output file!\')
  sys.exit(1)


value=[]

#reading from file and assigning values to arrays 

for line in f:
      if \'#\' not in line :
       values=line.split()
       
       value.append(values)
     

col1=np.transpose(value)
col1=col1.astype(np.float)


#Area under PV Diagram using Trapezoidal rule 

xvar=col1[1]


yvar=col1[7]


dx=[]
k=0
while k < 8664 :
  
  dif=xvar[k+1]-xvar[k]
  dx.append(dif)
  
  k=k+1


W=[]
Work=0
t=0
while t < 8664 :
   
   W.append(((dx[t])/2)*(yvar[0]+2*(yvar[t+1])+yvar[8664]))

   

   t=t+1


for n in range(0,len(W)):
   Work=Work+W[n]


#Work,Power and Specific fuel consumption calculation and output

Work=Work*1000000
print(\'Work Output in Joules is :\')
print(abs(Work))

print(\'Power Output in Watts is :\')
power=(Work*2*1500*math.pi*0.001)/60
print(abs(power))

print(\'Specific fuel consumption in gram/Joule is :\')
bsfc=0.02/abs(power)
print(bsfc)

name=[\'Crank\',\'Pressure\',\'Max_Pres\',\'Min_Pres\',\'Mean_Temp\',\'Max_Temp\',\'Min_Temp\',\'Volume\',\'Mass\',\'Density\',\'Integrated_HR\',\'HR_Rate\',\'C_p\',\'C_v\',\'Gamma\',\'Kin_Visc\',\'Dyn_Visc\']

print(\'Press \\n 1 for Crank \\n 2 for Pressure \\n 3 for Max_Pres \\n 4 for Min_Pres \\n 5 for Mean_Temp \\n 6 for Max_Temp \\n 7 for Min_Temp \\n 8 for Volume \\n 9 for Mass \\n 10 for Density \\n 11 for Integrated_HR \\n 12 for HR_Rate \\n 13 for C_p \\n 14 for C_v \\n 15 for Gamma \\n 16 for Kin_Visc \\n 17 for Dyn_Visc\')

x=int(input(\'Enter number corresponding to value you want to plot on X-axis & then press enter \\n\'))

y=int(input(\'Enter number corresponding to value you want to plot on Y-axis & then press enter \\n\'))

#PLOTTING the Inputs provided by the user

plt.figure(1)
plt.plot(col1[x-1],col1[y-1])
plt.title(name[y-1]+\'  &  \'+name[x-1]+\'     Plot\',fontsize=20,color=\'red\')
plt.xlabel(name[x-1],fontsize=12)
plt.ylabel(name[y-1],fontsize=12)
plt.savefig(name[x-1] + \' vs \' + name[y-1] + \'.png\')
plt.show()



#PLOTTING P-V diagram

plt.figure(2)
plt.plot(col1[7],col1[1])
plt.title(\'P-V diagram\',fontsize=20,color=\'red\')
plt.xlabel(\'Volume\',fontsize=12)
plt.ylabel(\'Pressure\',fontsize=12)
plt.show()

RESULT :

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.