All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM : To Write code in PYTHON that can solve data visualisation, compatability check and basic performance calcuation. DATA ANALYSIS : Data analysis involves inspecting, cleaning, transforming, and modeling data to draw useful conclusions, make decisions, and derive insights. It's a process of inspecting,…
G Harish Jairaj
updated on 03 Dec 2023
AIM : To Write code in PYTHON that can solve data visualisation, compatability check and basic performance calcuation.
DATA ANALYSIS :
Data analysis involves inspecting, cleaning, transforming, and modeling data to draw useful conclusions, make decisions, and derive insights. It's a process of inspecting, cleaning, and transforming raw data into information that can be used for decision-making.
The types of data analysis:
DESCRIPTIVE DATA ANALYSIS :
This helps with the 'what' statement. example : what is happened to your business. this is done with live data helps in effective visualisation. this analysis the past data.
TOOLS AND TECHNIQUIES USED : metrics and statistics
DIAGNOSTIC DATA ANALYSIS :
this comes up with the 'why' statement. example : why this is happened. this helps to understand the root of your problem. this is also analysis the past data.
TOOLS AND TECHNIQUIES USED : PCA and regression analysis
PREDICTIVE DATA ANALYSIS :
this comes up with the 'if' statement. example: what will happenend if this occurs. this helps to understand the prediction of the future. history helps in predicting the future.
TOOLS AND TECHNIQUIES USED : machine learning algorithms
PERSPECTIVE DATA ANALYSIS :
It help in the 'recommendataion" statement. example : what should i do if this happen, what are the possible recommendation. this is also helps in understanding the future.
TOOLS AND TECHNIQUIES USED : neutral network, recommeder system.
its like a four level of data analysis, as the level increases the value and complexitity of the program is also increased.
INPUT :
it is a array of data points which has an n number of data like pressure, temperature, crankangle, max and min pressure, mean temperature , max and mininum temperature, volume, mass, density, intergrated HR, HR rate, cp, cv, gamma, kinematic viscosity and dynamic viscosity.
total of 17 data's and its data points are provided in the .out format. this is the data got from the ottocycle engine analysis. this data are need to be properly stored and used for analysis and plotting the results. this comes under the descriptive data analysis.
CODE :
import matplotlib.pyplot as plt
import numpy as np
# Initializing empty lists for storing the data
value1 = []
value2 = []
pressure = []
volume = []
label1 = ""
label2 = ""
# Enter the name of the CONVERGE output file
file_name = input("Enter the file name in .out format: ")
# Checking the file name and conditions
if file_name == 'engine_data.out':
with open(file_name, 'r') as file:
lines = file.readlines()
# Extracting labels and units from specific lines
labels = lines[2].split()
units = lines[3].split()
print('List of parameters available for plotting:')
for i, (label, unit) in enumerate(zip(labels[1:], units[1:]), start=0):
print(f"{i}. {label} {unit}")
# User input for parameters for x and y axes
a = int(input("Enter the parameter index for the x-axis: "))
b = int(input("Enter the parameter index for the y-axis: "))
# Reading data and appending to respective lists
for line in lines[5:]: # Start reading from the 6th line
data = line.split()
value1.append(float(data[a]))
value2.append(float(data[b]))
pressure.append(float(data[1]))
volume.append(float(data[7]))
#calculating the area under the P-V diagram using trapz(y,x)
area=np.trapz(pressure,volume)*1000
print('Area under the P-V diagram: ',area,'J')
#calculating the power output of the engine (assuming a RPM of 1500 and 4-stroke)
N = 1500 #engine RPM
n = 2 #no. of revolution per cycle in four stroke engine
power=(area*N)/(n*746)
print('Power: ',power,'HP')
#calculating the engine specific fuel consumption (assuming it consumes 20gm of fuel in one stroke)
fc = 20 #fuel consumed per cycle in micro gram
ffr = (fc*(N/n))/1000000 #fuel flow rate
sfc= ffr/power
print('fuel flow rate: ',ffr,'g/m')
print('Specific Fuel Consumption: ',sfc,'g/hp-m')
# Assigning labels for axes
label1 = labels[a + 1] + f" {units[a + 1]}"
label2 = labels[b + 1] + f" {units[b + 1]}"
# Plotting the data
plt.plot(value1, value2)
plt.xlabel(label1)
plt.ylabel(label2)
plt.title(f"Plot of {label2} vs {label1}")
plt.savefig(f"{label2}vs{label1}.png")
plt.show()
#plotting area under PV
plt.plot(volume,pressure,color='red',label='pv curve')
plt.fill_between(volume, pressure,color='green',label='area under curve')
plt.xlabel("volume")
plt.ylabel("pressure")
plt.legend()
plt.savefig("area under PV curve")
plt.show()
else:
print('File not recognized. Please provide a valid CONVERGE output file')
CODE EXLANATION :
import matplotlib.pyplot as plt
import numpy as np
# Initializing empty lists for storing the data
value1 = []
value2 = []
pressure = []
volume = []
label1 = ""
label2 = ""
# Enter the name of the CONVERGE output file
file_name = input("Enter the file name in .out format: ")
# Checking the file name and conditions
if file_name == 'engine_data.out':
with open(file_name, 'r') as file:
lines = file.readlines()
# Extracting labels and units from specific lines
labels = lines[2].split()
units = lines[3].split()
print('List of parameters available for plotting:')
for i, (label, unit) in enumerate(zip(labels[1:], units[1:]), start=0):
print(f"{i}. {label} {unit}")
[1:]
), as indicated by the slice notation. # User input for parameters for x and y axes
a = int(input("Enter the parameter index for the x-axis: "))
b = int(input("Enter the parameter index for the y-axis: "))
# Reading data and appending to respective lists
for line in lines[5:]: # Start reading from the 6th line
data = line.split()
value1.append(float(data[a]))
value2.append(float(data[b]))
pressure.append(float(data[1]))
volume.append(float(data[7]))
#calculating the area under the P-V diagram using trapz(y,x)
area=np.trapz(pressure,volume)*1000
print('Area under the P-V diagram: ',area,'J')
#calculating the power output of the engine (assuming a RPM of 1500 and 4-stroke)
N = 1500 #engine RPM
n = 2 #no. of revolution per cycle in four stroke engine
power=(area*N)/(n*746)
print('Power: ',power,'HP')
#calculating the engine specific fuel consumption (assuming it consumes 20gm of fuel in one stroke)
fc = 20 #fuel consumed per cycle in micro gram
ffr = (fc*(N/n))/1000000 #fuel flow rate
sfc= ffr/power
print('fuel flow rate: ',ffr,'g/m')
print('Specific Fuel Consumption: ',sfc,'g/hp-m')
# Assigning labels for axes
label1 = labels[a + 1] + f" {units[a + 1]}"
label2 = labels[b + 1] + f" {units[b + 1]}"
# Plotting the data
plt.plot(value1, value2)
plt.xlabel(label1)
plt.ylabel(label2)
plt.title(f"Plot of {label2} vs {label1}")
plt.savefig(f"{label2}vs{label1}.png")
plt.show()
#plotting area under PV
plt.plot(volume,pressure,color='red',label='pv curve')
plt.fill_between(volume, pressure,color='green',label='area under curve')
plt.xlabel("volume")
plt.ylabel("pressure")
plt.legend()
plt.savefig("area under PV curve")
plt.show()
else:
print('File not recognized. Please provide a valid CONVERGE output file')
ERROR WHILE CODING :
OUTPUT RESULTS :
while entering the wrong file name :
plotting list and output results for area under the pv curve, power, specific fuel conspumtion.
when the x axis is enter as 7 (volume) and y axis is enter as 1 (pressure)
when the x axis is enter as 0 (crank angle) and y axis is enter as 7 (volume)
when the x axis is enter as 9 (density) and y axis is enter as 4 (mean temperature)
when the x axis is enter as 15 (kinetic viscosity) and y axis is enter as 1 (pressure)
area under the curve
RESULT :
hence the data analysis using the large no. of data points and the visulatization graph is shown according to the user inputs.
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 - Analysis of a practical automotive wiring circuit
Identify each of the major elements in the above automotive wiring diagram. BATTERY STARTER BREAKER AMMETER CURRENT AND VOLTAGE REGULATOR GENERATOR JUNCTION BLOCK FUSE BATTERY : Its is the power house of the electrical circuit where the chemical energy is converted into the electrical energy. in automotive,…
02 Jan 2024 07:51 PM IST
Week 2 Air standard Cycle
AIM : To Write code in PYTHON that can solve an otto cycle and plot PV diagram. DESCIRPTION : Otto cycle explains the working procedure of convertion of chemical energy throught the thermal energy and that thermal energy is converted into mechanical energy as from the law of conservation of energy…
11 Dec 2023 06:46 PM IST
Week 6 - Data analysis
AIM : To Write code in PYTHON that can solve data visualisation, compatability check and basic performance calcuation. DATA ANALYSIS : Data analysis involves inspecting, cleaning, transforming, and modeling data to draw useful conclusions, make decisions, and derive insights. It's a process of inspecting,…
03 Dec 2023 03:01 PM IST
Week 5 - Curve fitting
AIM : To write a code to perform curve fit for the given cp and temperature data What is curve fitting? curve fit is the process of constructing a curve or a mathematical function that has the best fit to that data points. The goal is to model the underlying relationship between the independent and dependent variables…
02 Sep 2023 09:39 PM 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.