All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM : To read the data from the file provided and perform some calculations and also to plot the graphs between different parameter. OBJECTIVE : 1.Data visualizer 2.Compatability check 3.Basic performance calculations CONCEPT : The concept is to read the data file(engine_data.out) provided.Actually the data…
Praveen kumar
updated on 14 Jun 2021
AIM :
To read the data from the file provided and perform some calculations and also to plot the graphs between different parameter.
OBJECTIVE :
1.Data visualizer
2.Compatability check
3.Basic performance calculations
CONCEPT :
The concept is to read the data file(engine_data.out) provided.Actually the data file name with extension is taken from the user and then the data file is read.Then the parameters present in the data file is printed with the numbers.The user is asked to enter the parameters for which the plot is to be obtained.
Then Basic performance calculations are calculated but not manually.
FORMULAS :
1.W=(Area)⋅(100)
2. Power=2⋅π⋅RPM⋅W60
3. Fuel consumption(F) = 20⋅(1e−6)⋅RPM⋅0.560
4. BSFC=(FP)⋅3600
PROCEDURE(CODE EXPLANATION) :
1.Import the required libraries.
2.Accepting the data file name with extension as a input from the user.
3.Then validate that the input given by the user is correct or not by using try and except() method.
4.Then read the data file.
5.Print all the parameters name so that the user can choose to plot the graph between them.
6.Plot the graphs according to the user input.
7.The basic performance calculations should be done only when the user input is pressure and volume.So if condition is used.
PYTHON CODE :
import matplotlib.pyplot as plt
import numpy as np
import math
#ACCEPTING THE FILE WITH EXTENSION .OUT ONLY
try:
var1 = input("Please enter the file name with .out extension: ")
print("Input received from the user:",var1)
except FileNotFoundError:
print("File not recognized. Please provide a valid CONVERGE output file")
#READING THE DATA FROM THE DATAFILE
file_object = open(var1,'r')
name=[]
units=[]
crank=[]
line_count = 1
#TO PRINT THE PARAMETERS PRESENT INSIDE THE DATAFILE
for i in file_object:
crank.append(i)
if len(crank)==5:
a=crank[2]
b=crank[3]
a=a.split()
b=b.split()
c=0
a.pop(0)
for i in a:
c=c+1
name.append(i)
units.append(b[c])
print(str(c)+" "+i+" "+b[c])
def value(var2,var3):
x_data = []
y_data = []
file_object = open(var1,'r')
for line in file_object:
if '#' not in line:
x_data.append(float(line.split()[var2-1])) #STORING THE VALUES OF DIFFERENT PARAMETERS
y_data.append(float(line.split()[var3-1]))
#PLOTTING THE GRAPHS
ax=plt.axes()
ax.set_facecolor('lightgrey')
plt.figure(1)
plt.xlabel(name[var2-1]+units[var2-1],color='green',fontsize='large',fontweight='bold')
plt.ylabel(name[var3-1]+units[var3-1],color='purple',fontsize='large',fontweight='bold')
plt.title(name[var2-1]+units[var2-1] + ' V/S '+ name[var3-1]+units[var3-1])
plt.plot(x_data,y_data)
plt.show()
#BASIC PERFORMANCE CALCULATIONS
if (var2==8 and var3==2):
rpm=1500
area=np.trapz(y_data,x_data) #IN MJ
print("AREA =",area,"MJ")
Workdone=area*1000 #IN KJ
print("WORKDONE =",Workdone,"KJ")
Power = 2*math.pi*rpm*Workdone/60 #IN KW
print("POWER =",Power,"KW")
Fuelconsumption = (20*(1e-6))*rpm*(0.5/60) #IN GRAMS PER HOUR
BSFC = ((Fuelconsumption)/(Power))*3600 #IN G/KW HR
print("BSFC = ",BSFC,"g/KWhr")
loop='yes'
while loop=='yes':
g = int(input("Enter the number from the above list to plot at x-axis:")) #TAKING THE INPUT FROM THE USER WHAT VALUES TO TAKE AT X AXIS
u = int(input("Enter the number from the above list to plot at y axis:")) #TAKING THE INPUT FROM THE USER WHAT VALUES TO TAKE AT Y AXIS
value(g,u) #FUNCTION CALL
loop=input('If you want to give more inputs for x and y press yes or no: ')
OUTPUT :
GRAPHS/PLOTS :
CONCLUSION :
The basic performance calculations and the plots has been obtained using python code.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Project 2 - Supply and Demand Gap Analysis
Aim: The aim of this analysis is to identify the supply and demand gap in the Uber network and provide recommendations to improve the efficiency of their service. Introduction: Uber is a ride-hailing platform that connects passengers with drivers through a mobile app. The company has revolutionized the transportation industry…
04 Apr 2023 05:08 AM IST
Project 1 - COVID-19 Vaccinations Trend Analysis
Aim The aim of this report is to analyze the vaccination data for various countries and vaccine types and provide insights and recommendations for improving vaccination efforts. Introduction Vaccination is an important tool in preventing the spread of infectious diseases and protecting public health. With the ongoing COVID-19…
31 Mar 2023 08:30 AM IST
Project 2 - Create a report using PowerQuery, Macro VBA, List Functions and Data Validation functions for Data Reporting of Supply Chain Management companies
Link to the Excel File is below: https://drive.google.com/file/d/1cQHJ0eiA47Tf9xFVaur1z6_5h0RdfVki/view?usp=share_link Project Report: Analysis of Loan Applicant Data at IJS Bank Limited Introduction: The purpose of this project is to analyze the data of loan applicants at IJS Bank Limited for the current…
13 Feb 2023 07:49 AM IST
Project 1 - Data Cleaning and Transformation using Pivot table and Charts for the Report on requirement of Team Hiring
PLEASE CHECK THE EXCEL FILE ATTACHED BELOW I HAVE ANSWERED ALL THE QUESTIONS. b. d.
04 Feb 2023 10:07 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.