DATA ANALYSIS
INTRODUCTION:-
Here we are writing a program for reading a data file and plotting the graph for whatever parameters we want
EXPLANATION OF PROGRAM:-
I imported matplotlib.pyplot, math, numpy to use them in the program.
I created empty arrays of each parameter in the data file.
By using try and except function we can tell whether the file is recognized or not.
By open function we can access and read the data file and assign all the values for respective parameters in the empty arrays created.
As I was using sublime text 3, I had to install sublimeREPL package so that I can take input from the user for the plot which the user wants.
input statement is used to take inputs.
if statements are used for giving the outputs for the options selected by the user.
trapz command is used to calculate the area under the graph.
\"\"\"
Data analyser for converge file
\"\"\"
import matplotlib.pyplot as plt
import math
import numpy as np
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 = []
try:
open(\'engine_data.out\',\'r\')
except:
print(\"file not recognized. Please provide valid input file\")
line_count = 1
for line in open(\'engine_data.out\'):
if \'#\' not in line:
Crank.append(float(line.split()[0]))
Pressure.append(float(line.split()[1]))
Max_pres.append(float(line.split()[2]))
Min_pres.append(float(line.split()[3]))
Mean_temp.append(float(line.split()[4]))
Max_temp.append(float(line.split()[5]))
Min_temp.append(float(line.split()[6]))
Volume.append(float(line.split()[7]))
Mass.append(float(line.split()[8]))
Density.append(float(line.split()[9]))
Integrated_HR.append(float(line.split()[10]))
HR_Rate.append(float(line.split()[11]))
C_p.append(float(line.split()[12]))
C_v.append(float(line.split()[13]))
Gamma.append(float(line.split()[14]))
Kin_visc.append(float(line.split()[15]))
Dyn_visc.append(float(line.split()[16]))
line_count=line_count+1
print(\'select the two options for which you want see the plot\\n\',\'1. Crank\\n\',\'2. Pressure\\n\',\'3. Max_pres\\n\',\'4. Min_pres\\n\',\'5. Mean_temp\\n\',\'6. Max_temp\\n\',\'7. Min_temp\\n\',\'8. Volume\\n\',\'9. Mass\\n\',\'10. Density\\n\',\'11.Integrated_HR\\n\',\'12. HR_Rate\\n\',\'13. C_p\\n\',\'14. C_v\\n\',\'15. Gamma\\n\',\'16. Kin_visc\\n\',\'17. Dyn_visc\\n\')
i = int(input(\"Enter: \"))
j = int(input(\"Enter: \"))
if (i==1 and j==1):
print(\"error\")
if (i==1 and j==2):
plt.plot(Crank,Pressure)
plt.xlabel(\'Crank\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==1 and j==3):
plt.plot(Crank,Max_pres)
plt.xlabel(\'Crank\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==1 and j==4):
plt.plot(Crank,Min_pres)
plt.xlabel(\'Crank\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==1 and j==5):
plt.plot(Crank,Mean_temp)
plt.xlabel(\'Crank\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==1 and j==6):
plt.plot(Crank,Max_temp)
plt.xlabel(\'Crank\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==1 and j==7):
plt.plot(Crank,Min_temp)
plt.xlabel(\'Crank\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==1 and j==8):
plt.plot(Crank,Volume)
plt.xlabel(\'Crank\')
plt.ylabel(\'Volume\')
plt.show()
if (i==1 and j==9):
plt.plot(Crank,Mass)
plt.xlabel(\'Crank\')
plt.ylabel(\'Mass\')
plt.show()
if (i==1 and j==10):
plt.plot(Crank,Density)
plt.xlabel(\'Crank\')
plt.ylabel(\'Density\')
plt.show()
if (i==1 and j==11):
plt.plot(Crank,Integrated_HR)
plt.xlabel(\'Crank\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==1 and j==12):
plt.plot(Crank,HR_Rate)
plt.xlabel(\'Crank\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==1 and j==13):
plt.plot(Crank,C_p)
plt.xlabel(\'Crank\')
plt.ylabel(\'C_p\')
plt.show()
if (i==1 and j==14):
plt.plot(Crank,C_v)
plt.xlabel(\'Crank\')
plt.ylabel(\'C_v\')
plt.show()
if (i==1 and j==15):
plt.plot(Crank,Gamma)
plt.xlabel(\'Crank\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==1 and j==16):
plt.plot(Crank,Kin_visc)
plt.xlabel(\'Crank\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==1 and j==17):
plt.plot(Crank,Dyn_visc)
plt.xlabel(\'Crank\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==2 and j==1):
plt.plot(Pressure,Crank)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Crank\')
plt.show()
if (i==2 and j==2):
print(\"error\")
if (i==2 and j==3):
print(\"no plot\")
if (i==2 and j==4):
print(\"no plot\")
if (i==2 and j==5):
plt.plot(Pressure,Mean_temp)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==2 and j==6):
plt.plot(Pressure,Max_temp)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==2 and j==7):
plt.plot(Pressure,Min_temp)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==2 and j==8):
plt.plot(Pressure,Volume)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Volume\')
plt.show()
if (i==2 and j==9):
plt.plot(Pressure,Mass)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Mass\')
plt.show()
if (i==2 and j==10):
plt.plot(Pressure,Density)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Density\')
plt.show()
if (i==2 and j==11):
plt.plot(Pressure,Integrated_HR)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==2 and j==12):
plt.plot(Pressure,HR_Rate)
plt.xlabel(\'Pressure\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==2 and j==13):
plt.plot(Pressure,C_p)
plt.xlabel(\'Pressure\')
plt.ylabel(\'C_p\')
plt.show()
if (i==2 and j==14):
plt.plot(Pressure,C_v)
plt.xlabel(\'Pressure\')
plt.ylabel(\'C_v\')
plt.show()
if (i==2 and j==15):
plt.plot(Pressure,Gamma)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==2 and j==16):
plt.plot(Pressure,Kin_visc)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==2 and j==17):
plt.plot(Pressure,Dyn_visc)
plt.xlabel(\'Pressure\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==3 and j==1):
print(\"error\")
if (i==3 and j==2):
print(\"error\")
if (i==3 and j==3):
print(\"error\")
if (i==3 and j==4):
print(\"error\")
if (i==3 and j==5):
print(\"error\")
if (i==3 and j==6):
print(\"error\")
if (i==3 and j==7):
print(\"error\")
if (i==3 and j==8):
print(\"error\")
if (i==3 and j==9):
print(\"error\")
if (i==3 and j==10):
print(\"error\")
if (i==3 and j==11):
print(\"error\")
if (i==3 and j==12):
print(\"error\")
if (i==3 and j==13):
print(\"error\")
if (i==3 and j==14):
print(\"error\")
if (i==3 and j==15):
print(\"error\")
if (i==3 and j==16):
print(\"error\")
if (i==3 and j==17):
print(\"error\")
if (i==4 and j==1):
print(\"error\")
if (i==4 and j==2):
print(\"error\")
if (i==4 and j==3):
print(\"error\")
if (i==4 and j==4):
print(\"error\")
if (i==4 and j==5):
print(\"error\")
if (i==4 and j==6):
print(\"error\")
if (i==4 and j==7):
print(\"error\")
if (i==4 and j==8):
print(\"error\")
if (i==4 and j==9):
print(\"error\")
if (i==4 and j==10):
print(\"error\")
if (i==4 and j==11):
print(\"error\")
if (i==4 and j==12):
print(\"error\")
if (i==4 and j==13):
print(\"error\")
if (i==4 and j==14):
print(\"error\")
if (i==4 and j==15):
print(\"error\")
if (i==4 and j==16):
print(\"error\")
if (i==4 and j==17):
print(\"error\")
if (i==5 and j==1):
plt.plot(Mean_temp,Crank)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Crank\')
plt.show()
if (i==5 and j==2):
plt.plot(Mean_temp,Pressure)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==5 and j==3):
plt.plot(Mean_temp,Max_pres)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==5 and j==4):
plt.plot(Mean_temp,Min_pres)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==5 and j==5):
print(\"error\")
if (i==5 and j==6):
print(\"error\")
if (i==5 and j==7):
print(\"error\")
if (i==5 and j==8):
plt.plot(Mean_temp,Volume)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Volume\')
plt.show()
if (i==5 and j==9):
plt.plot(Mean_temp,Mass)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Mass\')
plt.show()
if (i==5 and j==10):
plt.plot(Mean_temp,Density)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Density\')
plt.show()
if (i==5 and j==11):
plt.plot(Mean_temp,Integrated_HR)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==5 and j==12):
plt.plot(Mean_temp,HR_Rate)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==5 and j==13):
plt.plot(Mean_temp,C_p)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'C_p\')
plt.show()
if (i==5 and j==14):
plt.plot(Mean_temp,C_v)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'C_v\')
plt.show()
if (i==5 and j==15):
plt.plot(Mean_temp,Gamma)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==5 and j==16):
plt.plot(Mean_temp,Kin_visc)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==5 and j==17):
plt.plot(Mean_temp,Dyn_visc)
plt.xlabel(\'Mean_temp\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==6 and j==1):
print(\"error\")
if (i==6 and j==2):
print(\"error\")
if (i==6 and j==3):
print(\"error\")
if (i==6 and j==4):
print(\"error\")
if (i==6 and j==5):
print(\"error\")
if (i==6 and j==6):
print(\"error\")
if (i==6 and j==7):
print(\"error\")
if (i==6 and j==8):
print(\"error\")
if (i==6 and j==9):
print(\"error\")
if (i==6 and j==10):
print(\"error\")
if (i==6 and j==11):
print(\"error\")
if (i==6 and j==12):
print(\"error\")
if (i==6 and j==13):
print(\"error\")
if (i==6 and j==14):
print(\"error\")
if (i==6 and j==15):
print(\"error\")
if (i==6 and j==16):
print(\"error\")
if (i==6 and j==17):
print(\"error\")
if (i==7 and j==1):
print(\"error\")
if (i==7 and j==2):
print(\"error\")
if (i==7 and j==3):
print(\"error\")
if (i==7 and j==4):
print(\"error\")
if (i==7 and j==5):
print(\"error\")
if (i==7 and j==6):
print(\"error\")
if (i==7 and j==7):
print(\"error\")
if (i==7 and j==8):
print(\"error\")
if (i==7 and j==9):
print(\"error\")
if (i==7 and j==10):
print(\"error\")
if (i==7 and j==11):
print(\"error\")
if (i==7 and j==12):
print(\"error\")
if (i==7 and j==13):
print(\"error\")
if (i==7 and j==14):
print(\"error\")
if (i==7 and j==15):
print(\"error\")
if (i==7 and j==16):
print(\"error\")
if (i==7 and j==17):
print(\"error\")
if (i==8 and j==1):
plt.plot(Volume,Crank)
plt.xlabel(\'Volume\')
plt.ylabel(\'Crank\')
plt.show()
if (i==8 and j==2):
plt.plot(Volume,Pressure)
plt.xlabel(\'Volume\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==8 and j==3):
plt.plot(Volume,Max_pres)
plt.xlabel(\'Volume\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==8 and j==4):
plt.plot(Volume,Min_pres)
plt.xlabel(\'Volume\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==8 and j==5):
plt.plot(Volume,Mean_temp)
plt.xlabel(\'Volume\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==8 and j==6):
plt.plot(Volume,Max_temp)
plt.xlabel(\'Volume\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==8 and j==7):
plt.plot(Volume,Min_temp)
plt.xlabel(\'Volume\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==8 and j==8):
print(\"error\")
if (i==8 and j==9):
plt.plot(Volume,Mass)
plt.xlabel(\'Volume\')
plt.ylabel(\'Mass\')
plt.show()
if (i==8 and j==10):
plt.plot(Volume,Density)
plt.xlabel(\'Volume\')
plt.ylabel(\'Density\')
plt.show()
if (i==8 and j==11):
plt.plot(Volume,Integrated_HR)
plt.xlabel(\'Volume\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==8 and j==12):
plt.plot(Volume,HR_Rate)
plt.xlabel(\'Volume\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==8 and j==13):
plt.plot(Volume,C_p)
plt.xlabel(\'Volume\')
plt.ylabel(\'C_p\')
plt.show()
if (i==8 and j==14):
plt.plot(Volume,C_v)
plt.xlabel(\'Volume\')
plt.ylabel(\'C_v\')
plt.show()
if (i==8 and j==15):
plt.plot(Volume,Gamma)
plt.xlabel(\'Volume\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==8 and j==16):
plt.plot(Volume,Kin_visc)
plt.xlabel(\'Volume\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==8 and j==17):
plt.plot(Volume,Dyn_visc)
plt.xlabel(\'Volume\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==9 and j==1):
plt.plot(Mass,Crank)
plt.xlabel(\'Mass\')
plt.ylabel(\'Crank\')
plt.show()
if (i==9 and j==2):
plt.plot(Mass,Pressure)
plt.xlabel(\'Mass\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==9 and j==3):
plt.plot(Mass,Max_pres)
plt.xlabel(\'Mass\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==9 and j==4):
plt.plot(Mass,Min_pres)
plt.xlabel(\'Mass\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==9 and j==5):
plt.plot(Mass,Mean_temp)
plt.xlabel(\'Mass\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==9 and j==6):
plt.plot(Mass,Max_temp)
plt.xlabel(\'Mass\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==9 and j==7):
plt.plot(Mass,Min_temp)
plt.xlabel(\'Mass\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==9 and j==8):
plt.plot(Mass,Volume)
plt.xlabel(\'Mass\')
plt.ylabel(\'Volume\')
plt.show()
if (i==9 and j==9):
print(\"error\")
if (i==9 and j==10):
plt.plot(Mass,Density)
plt.xlabel(\'Mass\')
plt.ylabel(\'Density\')
plt.show()
if (i==9 and j==11):
plt.plot(Mass,Integrated_HR)
plt.xlabel(\'Mass\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==9 and j==12):
plt.plot(Mass,HR_Rate)
plt.xlabel(\'Mass\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==9 and j==13):
plt.plot(Mass,C_p)
plt.xlabel(\'Mass\')
plt.ylabel(\'C_p\')
plt.show()
if (i==9 and j==14):
plt.plot(Mass,C_v)
plt.xlabel(\'Mass\')
plt.ylabel(\'C_v\')
plt.show()
if (i==9 and j==15):
plt.plot(Mass,Gamma)
plt.xlabel(\'Mass\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==9 and j==16):
plt.plot(Mass,Kin_visc)
plt.xlabel(\'Mass\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==9 and j==17):
plt.plot(Mass,Dyn_visc)
plt.xlabel(\'Mass\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==10 and j==1):
plt.plot(Density,Crank)
plt.xlabel(\'Density\')
plt.ylabel(\'Crank\')
plt.show()
if (i==10 and j==2):
plt.plot(Density,Pressure)
plt.xlabel(\'Density\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==10 and j==3):
plt.plot(Density,Max_pres)
plt.xlabel(\'Density\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==10 and j==4):
plt.plot(Density,Min_pres)
plt.xlabel(\'Density\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==10 and j==5):
plt.plot(Density,Mean_temp)
plt.xlabel(\'Density\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==10 and j==6):
plt.plot(Density,Max_temp)
plt.xlabel(\'Density\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==10 and j==7):
plt.plot(Density,Min_temp)
plt.xlabel(\'Density\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==10 and j==8):
plt.plot(Density,Volume)
plt.xlabel(\'Density\')
plt.ylabel(\'Volume\')
plt.show()
if (i==10 and j==9):
plt.plot(Density,Mass)
plt.xlabel(\'Density\')
plt.ylabel(\'Mass\')
plt.show()
if (i==10 and j==10):
print(\"error\")
if (i==10 and j==11):
plt.plot(Density,Integrated_HR)
plt.xlabel(\'Density\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==10 and j==12):
plt.plot(Density,HR_Rate)
plt.xlabel(\'Density\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==10 and j==13):
plt.plot(Density,C_p)
plt.xlabel(\'Density\')
plt.ylabel(\'C_p\')
plt.show()
if (i==10 and j==14):
plt.plot(Density,C_v)
plt.xlabel(\'Density\')
plt.ylabel(\'C_v\')
plt.show()
if (i==10 and j==15):
plt.plot(Density,Gamma)
plt.xlabel(\'Density\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==10 and j==16):
plt.plot(Density,Kin_visc)
plt.xlabel(\'Density\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==10 and j==17):
plt.plot(Density,Dyn_visc)
plt.xlabel(\'Density\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==11 and j==1):
plt.plot(Integrated_HR,Crank)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Crank\')
plt.show()
if (i==11 and j==2):
plt.plot(Integrated_HR,Pressure)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==11 and j==3):
plt.plot(Integrated_HR,Max_pres)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==11 and j==4):
plt.plot(Integrated_HR,Min_pres)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==11 and j==5):
plt.plot(Integrated_HR,Mean_temp)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==11 and j==6):
plt.plot(Integrated_HR,Max_temp)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==11 and j==7):
plt.plot(Integrated_HR,Min_temp)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==11 and j==8):
plt.plot(Integrated_HR,Volume)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Volume\')
plt.show()
if (i==11 and j==9):
plt.plot(Integrated_HR,Mass)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Mass\')
plt.show()
if (i==11 and j==10):
plt.plot(Integrated_HR,Density)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Density\')
plt.show()
if (i==11 and j==11):
print(\"error\")
if (i==11 and j==12):
plt.plot(Integrated_HR,HR_Rate)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==11 and j==13):
plt.plot(Integrated_HR,C_p)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'C_p\')
plt.show()
if (i==11 and j==14):
plt.plot(Integrated_HR,C_v)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'C_v\')
plt.show()
if (i==11 and j==15):
plt.plot(Integrated_HR,Gamma)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==11 and j==16):
plt.plot(Integrated_HR,Kin_visc)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==11 and j==17):
plt.plot(Integrated_HR,Dyn_visc)
plt.xlabel(\'Integrated_HR\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==12 and j==1):
plt.plot(HR_Rate,Crank)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Crank\')
plt.show()
if (i==12 and j==2):
plt.plot(HR_Rate,Pressure)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==12 and j==3):
plt.plot(HR_Rate,Max_pres)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==12 and j==4):
plt.plot(HR_Rate,Min_pres)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==12 and j==5):
plt.plot(HR_Rate,Mean_temp)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==12 and j==6):
plt.plot(HR_Rate,Max_temp)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==12 and j==7):
plt.plot(HR_Rate,Min_temp)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==12 and j==8):
plt.plot(HR_Rate,Volume)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Volume\')
plt.show()
if (i==12 and j==9):
plt.plot(HR_Rate,Mass)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Mass\')
plt.show()
if (i==12 and j==10):
plt.plot(HR_Rate,Density)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Density\')
plt.show()
if (i==12 and j==11):
plt.plot(HR_Rate,Integrated_HR)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==12 and j==12):
print(\"error\")
if (i==12 and j==13):
plt.plot(HR_Rate,C_p)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'C_p\')
plt.show()
if (i==12 and j==14):
plt.plot(HR_Rate,C_v)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'C_v\')
plt.show()
if (i==12 and j==15):
plt.plot(HR_Rate,Gamma)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==12 and j==16):
plt.plot(HR_Rate,Kin_visc)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==12 and j==17):
plt.plot(HR_Rate,Dyn_visc)
plt.xlabel(\'HR_Rate\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==13 and j==1):
plt.plot(C_p,Crank)
plt.xlabel(\'C_p\')
plt.ylabel(\'Crank\')
plt.show()
if (i==13 and j==2):
plt.plot(C_p,Pressure)
plt.xlabel(\'C_p\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==13 and j==3):
plt.plot(C_p,Max_pres)
plt.xlabel(\'C_p\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==13 and j==4):
plt.plot(C_p,Min_pres)
plt.xlabel(\'C_p\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==13 and j==5):
plt.plot(C_p,Mean_temp)
plt.xlabel(C_p)
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==13 and j==6):
plt.plot(C_p,Max_temp)
plt.xlabel(\'C_p\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==13 and j==7):
plt.plot(C_p,Min_temp)
plt.xlabel(\'C_p\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==13 and j==8):
plt.plot(C_p,Volume)
plt.xlabel(\'C_p\')
plt.ylabel(\'Volume\')
plt.show()
if (i==13 and j==9):
plt.plot(C_p,Mass)
plt.xlabel(\'C_p\')
plt.ylabel(\'Mass\')
plt.show()
if (i==13 and j==10):
plt.plot(C_p,Density)
plt.xlabel(\'C_p\')
plt.ylabel(\'Density\')
plt.show()
if (i==13 and j==11):
plt.plot(C_p,Integrated_HR)
plt.xlabel(\'C_p\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==13 and j==12):
plt.plot(C_p,HR_Rate)
plt.xlabel(\'C_p\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==13 and j==13):
print(\"error\")
if (i==13 and j==14):
plt.plot(C_p,C_v)
plt.xlabel(\'C_p\')
plt.ylabel(\'C_v\')
plt.show()
if (i==13 and j==15):
plt.plot(C_p,Gamma)
plt.xlabel(\'C_p\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==13 and j==16):
plt.plot(C_p,Kin_visc)
plt.xlabel(\'C_p\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==13 and j==17):
plt.plot(C_p,Dyn_visc)
plt.xlabel(\'C_p\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==14 and j==1):
plt.plot(C_v,Crank)
plt.xlabel(\'C_v\')
plt.ylabel(\'Crank\')
plt.show()
if (i==14 and j==2):
plt.plot(C_v,Pressure)
plt.xlabel(\'C_v\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==14 and j==3):
plt.plot(C_v,Max_pres)
plt.xlabel(\'C_v\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==14 and j==4):
plt.plot(C_v,Min_pres)
plt.xlabel(\'C_v\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==14 and j==5):
plt.plot(C_v,Mean_temp)
plt.xlabel(\'C_v\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==14 and j==6):
plt.plot(C_v,Max_temp)
plt.xlabel(\'C_v\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==14 and j==7):
plt.plot(C_v,Min_temp)
plt.xlabel(\'C_v\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==14 and j==8):
plt.plot(C_v,Volume)
plt.xlabel(\'C_v\')
plt.ylabel(\'Volume\')
plt.show()
if (i==14 and j==9):
plt.plot(C_v,Mass)
plt.xlabel(\'C_v\')
plt.ylabel(\'Mass\')
plt.show()
if (i==14 and j==10):
plt.plot(C_v,Density)
plt.xlabel(\'C_v\')
plt.ylabel(\'Density\')
plt.show()
if (i==14 and j==11):
plt.plot(C_v,Integrated_HR)
plt.xlabel(\'C_v\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==14 and j==12):
plt.plot(C_v,HR_Rate)
plt.xlabel(\'C_v\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==14 and j==13):
plt.plot(C_v,C_p)
plt.xlabel(\'C_v\')
plt.ylabel(\'C_p\')
plt.show()
if (i==14 and j==15):
plt.plot(C_v,Gamma)
plt.xlabel(\'C_v\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==14 and j==16):
plt.plot(C_v,Kin_visc)
plt.xlabel(\'C_v\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==14 and j==17):
plt.plot(C_v,Dyn_visc)
plt.xlabel(\'C_v\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==15 and j==1):
plt.plot(Gamma,Crank)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Crank\')
plt.show()
if (i==15 and j==2):
plt.plot(Gamma,Pressure)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==15 and j==3):
plt.plot(Gamma,Max_pres)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==15 and j==4):
plt.plot(Gamma,Min_pres)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==15 and j==5):
plt.plot(Gamma,Mean_temp)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==15 and j==6):
plt.plot(Gamma,Max_temp)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==15 and j==7):
plt.plot(Gamma,Min_temp)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==15 and j==8):
plt.plot(Gamma,Volume)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Volume\')
plt.show()
if (i==15 and j==9):
plt.plot(Gamma,Mass)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Mass\')
plt.show()
if (i==15 and j==10):
plt.plot(Gamma,Density)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Density\')
plt.show()
if (i==15 and j==11):
plt.plot(Gamma,Integrated_HR)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==15 and j==12):
plt.plot(Gamma,HR_Rate)
plt.xlabel(\'Gamma\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==15 and j==13):
plt.plot(Gamma,C_p)
plt.xlabel(\'Gamma\')
plt.ylabel(\'C_p\')
plt.show()
if (i==15 and j==14):
plt.plot(Gamma,C_v)
plt.xlabel(\'Gamma\')
plt.ylabel(\'C_v\')
plt.show()
if (i==15 and j==15):
print(\"error\")
if (i==15 and j==16):
plt.plot(Gamma,Kin_visc)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==15 and j==17):
plt.plot(Gamma,Dyn_visc)
plt.xlabel(\'Gamma\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==16 and j==1):
plt.plot(Kin_visc,Crank)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Crank\')
plt.show()
if (i==16 and j==2):
plt.plot(Kin_visc,Pressure)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==16 and j==3):
plt.plot(Kin_visc,Max_pres)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==16 and j==4):
plt.plot(Kin_visc,Min_pres)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==16 and j==5):
plt.plot(Kin_visc,Mean_temp)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==16 and j==6):
plt.plot(Kin_visc,Max_temp)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==16 and j==7):
plt.plot(Kin_visc,Min_temp)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==16 and j==8):
plt.plot(Kin_visc,Volume)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Volume\')
plt.show()
if (i==16 and j==9):
plt.plot(Kin_visc,Mass)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Mass\')
plt.show()
if (i==16 and j==10):
plt.plot(Kin_visc,Density)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Density\')
plt.show()
if (i==16 and j==11):
plt.plot(Kin_visc,Integrated_HR)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==16 and j==12):
plt.plot(Kin_visc,HR_Rate)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==16 and j==13):
plt.plot(Kin_visc,C_p)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'C_p\')
plt.show()
if (i==16 and j==14):
plt.plot(Kin_visc,C_v)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'C_v\')
plt.show()
if (i==16 and j==15):
plt.plot(Kin_visc,Gamma)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==16 and j==16):
print(\"error\")
if (i==16 and j==17):
plt.plot(Kin_visc,Dyn_visc)
plt.xlabel(\'Kin_visc\')
plt.ylabel(\'Dyn_visc\')
plt.show()
if (i==17 and j==1):
plt.plot(Dyn_visc,Crank)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Crank\')
plt.show()
if (i==17 and j==2):
plt.plot(Dyn_visc,Pressure)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Pressure\')
plt.show()
if (i==17 and j==3):
plt.plot(Dyn_visc,Max_pres)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Max_pres\')
plt.show()
if (i==17 and j==4):
plt.plot(Dyn_visc,Min_pres)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Min_pres\')
plt.show()
if (i==17 and j==5):
plt.plot(Dyn_visc,Mean_temp)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Mean_temp\')
plt.show()
if (i==17 and j==6):
plt.plot(Dyn_visc,Max_temp)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Max_temp\')
plt.show()
if (i==17 and j==7):
plt.plot(Dyn_visc,Min_temp)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Min_temp\')
plt.show()
if (i==17 and j==8):
plt.plot(Dyn_visc,Volume)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Volume\')
plt.show()
if (i==17 and j==9):
plt.plot(Dyn_visc,Mass)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Mass\')
plt.show()
if (i==17 and j==10):
plt.plot(Dyn_visc,Density)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Density\')
plt.show()
if (i==17 and j==11):
plt.plot(Dyn_visc,Integrated_HR)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Integrated_HR\')
plt.show()
if (i==17 and j==12):
plt.plot(Dyn_visc,HR_Rate)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'HR_Rate\')
plt.show()
if (i==17 and j==13):
plt.plot(Dyn_visc,C_p)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'C_p\')
plt.show()
if (i==17 and j==14):
plt.plot(Dyn_visc,C_v)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'C_v\')
plt.show()
if (i==17 and j==15):
plt.plot(Dyn_visc,Gamma)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Gamma\')
plt.show()
if (i==17 and j==16):
plt.plot(Dyn_visc,Kin_visc)
plt.xlabel(\'Dyn_visc\')
plt.ylabel(\'Kin_visc\')
plt.show()
if (i==17 and j==17):
print(\"error\")
area = np.trapz(Pressure,Volume)
print(\'Area under PV diagram\', area)
rpm = 1500
rps = rpm/60
power_watt = area*rps*1000
print(\'power of the engine is\', power_watt)
sfc = (20*pow(10,-6)*3600)/(0.08*power_watt)
print(\'Specific fuel consumption is\',sfc)
RESULTS:-
Below figure is out put shown by the figure when inputs are 1 and 8.
and the plot obtained between 1 and 8 is shown below.