Challenge

Project 1 - Parsing NASA thermodynamic data

. FILE PARSING

AIM:

To parse the NASA thermodynamic data and to calculate the molecular weight of the species and to plot the cp,entropy for the local temperature range for O2,N2,C02.

THEORY:

DEFINITION:

file parsing: parsing a file means to split a file or other input into pieces of data that can easily stored or manipulted.so we are spilting a string into parts then recognizing the parts convert it into something simpler than a string.

ENTHALPY: A thermodynamic quantity equivalent to the total heat content of a system.it is equal to the internal energy of the system plus the product of pressure and volume.

ENTROPY: A thermodynamic quantity representing the unavailability of a system thermal energy for conversion into mechanical work often interpreted as the degree of disorder of randomness in the system

SPECIFIC HEAT: it is the amount of heat per unit mass required to raise the temperature by one degree celsius.

MOLECULAR WEIGHT: Molecular weight is the weight of given molecule.

ATOMIC MASS:the mass of an atom of a chemical expressed in atomic mass units.it is approximately equivalant to the number of protons and neutrons in the atom or to the average number allowing for the relative abundances of different isotopes.

EQUATIONS:

Cp= a1 + a2 T + a3 T^2 + a4 T^3 + a5 T^4
h = a1 + a2 T/2+ a3 T^2/3 + a4 T^3/4 + a5 T^4/5 +a6/T
s/R = a1 lnT + a2 T + a3 T^2/2 + a4 T^3/3 a5T^4/4 +a7
where,
cp= specific heat
R= universal gas constant
h= enthalpy
s= entropy
T= temperature.
SPECIFIC HEAT FUNCTION:
function [c_p] =specific_heat(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,local_low_temp,local_mid_temp,local_high_temp,T)
if (T>local_mid_temp)
c_p = (a1+ (a2*T) + (a3 *(T.^2)) + (a4*(T.^3))+(a5* (T.^4)));
else
c_p = (a8+(a9*T)+(a10*(T.^2))+(a11*(T.^3))+(a12*(T.^4)));
end
ENTHALPY FUNCTION:
function [h] = enthalpy(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,local_low_temp,local_mid_temp,local_high_temp,T)
if (T>local_mid_temp)
h= (a1*T + ((a2*(T.^2))/2) +((a3*(T.^3))/3) + ((a4*(T.^4))/4) + (a5*(T.^5)/5)+a6);
else
h=(a8*T+(a9*(T.^2)/2)+(a10*(T.^3)/3)+(a11*(T.^4)/4)+(a12*(T.^5)/5)+a13);
end

ENTROPY FUNCTION:

function [s]= entropy(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,local_low_temp,local_mid_temp,local_high_temp,T)
if(T>local_mid_temp)
s=((a1*log(T))+(a2*T)+((a3*(T.^2))/2)+((a4*(T.^4))/4)+(a7));
else
s=(a8*log(T)+(a9*T)+(a10*(T.^2)/2)+(a11*(T.^3))+(a12*(T.^4)/4)+a14);
end

MOLECULAR WEIGHT FUNTION:

function [M] = MW(species_name)
Atomic_mass=[15.999,1.008,12.011,14.007,39.948];
Elements=['O','H','C','N','A'];
Mol_wt=0;
for i=1:length(species_name)
for j=1:length(Elements)
if strcmpi(species_name(i),Elements(j))
Mol_wt= Mol_wt+Atomic_mass(j);
z=j;
end
end
var=str2double(species_name(i));
if (var>1)
Mol_wt=Mol_wt+(Atomic_mass(z)*(var-1));
end
end
M=Mol_wt;
SETPS:
  1. clear all, close all and clc is commad to claer all.
  2. R= 8.314 U.gas constant.using 'fopen' command open the require file.then'fgetl' command to get in particular line in particlar file.
  3. 'tline' its refer to file lines,"str2num" commad is used to convert to array.
  4. "strspilt"use split the string."strfind' is find the value of string,"str2dobule"is covert string to dobule characters values.
  5. Using the above commands get all 'E' value ,'T' value,'spicies value'.
  6. then write the seprate function for ,'cp','h','s','mw'.
  7. this all are get finally,plot the required values.and save the file to jpg.formet using the saves command.
RESULTS:
CP vs T PLOT.O2
S vs T PLOT:O2
H vs T PLOT:O2
CP vs T:CO2
H vs T:CO2
S vs T :CO2
CP vs T: N2
H vs T:N2
S vs T :N2
THE MAIN SPEICIES RESULT MOLECULAR WEIGHT:
O2 =31.9980
N2= 28.0140
CO2=44.0090
ALL SPEICIES FOLDER LOCATION:
ERRORS:
I am get not difficult errors.
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.