Challenge

Project 1 - Parsing NASA thermodynamic data

  • Aim :- the main aim of project is write the programm to evaluate the thermodynamic data such as specific heat,enthalpy, Entropy of the NASA thermodynamic data and creating the plots for all the species and to display the molicular weight calculatoin using MATLAB

Objective:- NASA came up with polynomials that can be used to evaluate thermodynamic properties such as Cp, H and S. They have also documented the co-efficients that are required to evaluate these polynomials for 1000+ species.

Definatio :- 1 specific heat :- the specific heat of a substance is the amount of energy required to change the temparature of unit of mass substance by the unity

  • Mathematically :-`c = Q/(m deltaT)`

whare c is the specific heat in J/KgK. Q is the amount of heat transfer in J , M is the mass of substance in Kg

2 Enthalpy :-the enthalpy of thermodynamic system is define as a sum of internal energy and work requiresd to achive it pressure and temparature . internal energy of fluid along with flow work is called enthalpy

3 Entropy:- entropy is a mesure of degree of disorderness in the system unit : j/k

file parsing : in given data is that clear total 1000+species are thear each species are difrent cofficent and each are unic specific heat , entropy and enthalpy so we are calculating all this perameters in ower matlab programming

ite a function that extracts the 14 co-efficients and calculates the enthalpy, entropy and specific heats for all the species in the data file. You will be reading this file NASA thermodynamic dataThe formulae are shown below.

Here R is the universal gas constant, T is the temeprature

EXPLANATION;- the program start with clear all ,close all. and clc commond whiche clear previos recorder data and figure or open fills on there now open the the thermal fille use commond fopen to read heading line of data use commond fgetl .

to get the global temparture line fgetl commond are use commonly information will be start with the string values , to get the numerical value of string valuve use commond str2double which is use to covert text in string numarical values in dtring double precision value are use {} insete os () which mean the global temparature line is the form of an arrey by which we can obtine the global temparature value and to skip the nest three line .

To get the locsl temparature line use fgetl and store it as a line1 in which we can observ that the first is the species name and maximum length of species name is 6 hance is that given on the comments line (1:6) matlab can read the species name whose maximum length is 6 and the same line we can observe the local temparature nad local low temparature is located at mid of data in this loction we are using to str2double commond to convert the string from numerical value and store the low temparature and repit the same prosses for high temparature as well as midele temparature

TO EXTRACT THE COFFICENT VALUE

To extract the value of coofficient which is use to calculate a specific heat , enthalpy , entropy use fgetl commond one we get cofficients line of thermal data we can observe that latter is 'E' which is reprent as a cofficient and use strfind commond usde to find the string 'E' and store its is as a,b,c and commond windonw it will we show the loction E by which we can extract first cofficient and it will we form of string and to get a numerical vvalues use srt2double commond by this we csn ofaint all 14 cofficents value

Specific heat function :-

from the formula it is obtain the specific heat value if the function of cofficients of specific heat and univesal gass costant represented by R and temparature if Loop is used to becouse thair is a condition that first 7 Cofficients are higher temparaturer cofficient and second 7 cofficents are low temparaturer cofficients . hance the fuction are closed as above

Enthalpy function:-

from the formula we can calculate the Enthalpy is a function of cofficients and universal gas costant R and temparature . useing if loop is used to becouse thair are is a condition as a specific heat function so we are calculating the value of enthalpy as a priveas function

Entropy function :-

using the same consept as a priveas function for solving this problem we are using fuction commond and from the formula we can calculate the Enthalpy is a function of cofficients and universal gas costant R and temparature . useing if loop is used to becouse thair are is a condition as a specific heat function so we are calculating the value of entropy as a priveas function

main program

clear all
close all 
clc
%loading the file in matlsb for using file data'
F1 = fopen('THERMO.dat','r');
heading = fgetl(F1);

%glowbal temparture value 

glo_temp = fgetl(F1)

x = strsplit(glo_temp)
glob_low_temp = str2double(x{2})
glob_mid_temp = str2double(x{3})
glob_hig_temp = str2double(x{4})

fgetl(F1)
fgetl(F1)
fgetl(F1)

%thear are 53 species
for i = 1:length(F1)
line1 = fgetl(F1);
 species_name = line1(1:6)
 local_temp1 = line1(49:55)
 low_temp = str2double(local_temp1)
 
 local_temp2 = line1(58:65)
 high_temp = str2double(local_temp2)
 
 local_temp3 = line1(68:75)
 mid_temp = str2double(local_temp3)
 
 %coefficint values are extracting 
 line2 = fgetl(F1);
 line3 = fgetl(F1);
 line4 = fgetl(F1);
a = strfind(line2,'E');
b= strfind(line3,'E');
c= strfind(line4,'E');

%extract cofficent oh high temparture

a1 = str2double(line2(1:a(1)+3));
a2 = str2double(line2(a(1)+4:a(2)+3));
a3 = str2double(line2(a(2)+4:a(3)+3));
a4 = str2double(line2(a(3)+4:a(4)+3));
a5 = str2double(line2(a(4)+4:a(5)+3));
a6 = str2double(line3(1:b(1)+3));
a7 = str2double(line3(b(1)+4:b(2)+3));
a8 = str2double(line3(b(2)+4:b(3)+3));
a9 = str2double(line3(b(3)+4:b(4)+3));
a10 = str2double(line4(b(4)+4:b(5)+3));
a11 = str2double(line4(1:c(1)+3));
a12 = str2double(line4(c(1)+4:c(2)+3));
a13 = str2double(line4(c(2)+4:c(3)+3));
a14 = str2double(line4(c(3)+4:c(4)+3));

%univesal gas costant 


R = 8.314
t = linspace(low_temp,high_temp,500);

%calculatig the specific heat 
c_p  = specific_heat(a1,a2,a3,a4,a5,a8,a9,a10,a11,a12,mid_temp,R,t);
%calculating enthalpy
H = enthalpy(a1,a2,a3,a4,a5,a6,a8,a9,a10,a11,a12,a13,R,t,mid_temp);
%calculating entropy
S = entropy(a1,a2,a3,a4,a5,a7,a8,a9,a10,a11,a12,a14,R,t,mid_temp);

%creaating folder 
data = strcat('data',species_name);
mkdir('data');
file = pwd;
    %ploting
    
    
    
    figure(1)
    plot(t,c_p)
    data1 = strcat(species_name,'temperature vs especific_heat');
    xlabel('temperature')
    ylabel('specific_heat')
    title(species_name)
    f = fullfile(data)
   
    saveas(gcf,[pwd '/specific_heat vs temperature.jpg'])
    
    
   
    figure(2)
    plot(H,t)
    data2 = strcat(species_name,'temperature vs enthalpy');
    xlabel('temperature')
    ylabel('enthalpy')
    title(species_name)
    f = fullfile(data)
   cd 
'C:\Users\amulk\Downloads\matlab'
    saveas(gcf,[pwd '/enthalpy vs temperature.jpg'])
    cd(file)
    
    
    
    figure(3)
    plot(t,S)
    data3 = strcat(species_name,'temperature vs enthropy');
    xlabel('temperature')
    ylabel('enthropy')
    title(species_name)
    
    saveas(gcf,[pwd '/enthropy vs temperature.jpg'])
    
    
    molecular_weight_clu = molecular_weight(species_name);
    k = sprintf('%s mol_wt = %f',species_name,molecular_weight_clu);
    disp(k)
end 
    
    fclose(F1)
      
    

Ploting the temparature vs specific heat value using plot commond and strcat commond is used to concantentate srings horizantally which mean its combines both the springs and store it as a data and given the Xlebal and ylebal and tittel of the graph and fullfile commond is used to store entri information in the data fille and cd commond are use to locating the file loction and disply in the curant folder and graph are save using the saveas commond is store the entire information using .jpg for making immage in jpg formate

whene i using the hold on commond for seenig all perameter in one graph

showing the graph of CH2CHO

CH2CHO2

main error are coming in meny time

OVER COME BY THE ERROR

firsty using the brecets properly and than puting the right value here and relocting the current folder in matlab

and than Run the programm and now i am geting the right output by MATLAB

NOTE:- all data take by given file whos name is tharmo.dat its providing in the challange

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.