Challenge

Project 1 - Parsing NASA thermodynamic data

PROJECT 1:- FILE PARSING NASA THERMODYNAMIC DATA
AIM :- WRITE A CODE IN MATLAB TO PARSE THE NASA THERMODYNAMIC DATA FILE AND THEN CALCULATE THE THERMODYNNAMIC PROPERTIES OF VARIOUS SPECIES
DESCRIPTION :- FILE PARSING BASICALLY REFERS TO HOW INFORMATION CAN BE READE FROM PERTICULAR FILE AND HOW CAN BE USEFUL IN THE COMPUTER
WE HAVE LEARN LOOP AND CONDITIONAL STATEMENTS AND FUNCTION THE FINAL PEARS IS FILE PARSING IF YOU KNOW FILE PASING THEN YOU KNOW HOW TO READ DATA FROM EXTERNAL FILE OR EXTERNAL DATA BASE AND YOU CAN INCLUDE THAT DATA IN YOUR CALCULATION
SO WHEN TALKING ABOUT BIG DATA THEIR IS USUALLY THE PROGRAM AND LARGE AMOUNT OF DATA EITHER THE DATA IS STORED IN A FILE OR IT COMES ON A SERVER WHAT EVER IT IS ABILITE OF FILE TO TAKE WHAT EVER IT IS ABILITE TO STORE USEFULLY TO INFORMATION ONCES WE HAVE COMPLETED THIS CONCEPT WE WILL START WORKING ON IT
OBJECTIVES :-
1 :- WRITE A FUNCTION THAT EXTRACTS THE 14 CO-EFFICIENTS AND CALCULATE
2 :- WE HAVE CALCULATE THE ENTHALPHY,ENTROPHY,SPECIFIC HEAT FOR ALL SPECIES IN THE DATA FILE
3 :- TO CALCULATE THE MOLECULR WEIGHT OF EACH SPECIES AND DISPLAY IN THE COMMAND WINDOW
4 :- FINALLY WE HAVE PLOT THE ENTHALPHY,ENTROPHY,SPECIFIC HEAT FOR THE LOCAL TEMPERATURE RANGE
5 :- WE HAVE CALCULATE THE LOW TEMPERATURES AND HIGHER TEMPERATURE
6 :- THE MAIN PROGRAM WE HAVE SAVED AS 'THERMO.dat' FILE
7 :- INPUT GENERATE cp,H,s
8 :- PLOTS FOR o2,n2,co2, SPECIES
FILE PARSING :- THE FILE PARSING IS THE PROCESS OF ANLYSING A STRIG OF SYMBOLS EITHER IN NATURAL LANGUAGE
THE TERM PARSING COMES FROM PARS MEANS PART OF SPREACH SOME PARSING COMES ALOGRITHMS MAY GENERATE A PARSING IN FRONT OF ITS LIST OF PARSE TREES OF SYNTALLICALLY
THERMO DATA FILE
WHERE R = UNIVERSAL GAS CONSTANT
T = TEMPERATURE
CP = SPECIFIC HEAT [KJ]
S = ENTROPHY[KJ/MOL]
H = ENTHALPHY
a(i) = co-efficents
WHERE i = 1 TO 14
IMPORTENT DEFINATION OF SPECIFIC HEAT,ENTHALPHY,ENTROPHY :-
SPECIFIC HEAT :- SPECIFIC HEAT IT IS THE QUANTITY OF THEAT REQUIRED TO RAISE THE TEMPERATURE OF ONE GRAM OF A SUBSTANCE BY A CELCIUS DEGREE THE INPUTS OF SPECIFIC HEAT ARE USUALLY CALORIES OR JOULES PER GRAM CELCIUS DEGREE
cp = R*(a1=(a2*T)=(a3*T.^2)+(a4*T.^3)+a5(T).^4 ............ (1)
ENTHALPHY :- ENTHALPHY IS THE MEASUREMENT OF ENERGY IN A THERMODYNAMIC SYSTEM THE QUANTITY OF ENTHALPHY EQUALS TO THE TOTAL CONTENT HEAT OF SYSTEM EQUIVALENT TO THE SYSTEMS INTERNAL ENERGY PLUSE THE PRODUCT OF VOLUME AND PRESSURE
H=R*T*(a1+((a2*T)/2)+((a3*T.^2/3)+((a4*(T).^3/4+((a5*(T).^4/5)+((a6./T)) ...............(2)
ENTROPHY :- THE SECOND LAW OF THERMODYNAMIC STATES THAT THE TOTAL ENTROPHY OF A SYSTEM EITHER INCREASE OR REMAINS CONSTANT IN ANY SPONTENOUS PROCESS IT NEVER DECREASES
S = R*(a1.*log(T))+(a2*T)+((a3*T.^2/2)+((a4*T.^3/3)+((a5*T.^4)+a7) ............(3)
STEPS :-
1 :- THERMO.dat file [input parameter]
2 :- fgetl[we read temperature and split the temperature]
3 :- strsplit(convert in to cell arry)
4 :- str2num[to create the file folder]
5 :- mkdir [to creat the file folder]
6 :- cd[change in to the directory]
FINDINGS OF NASA THERMODYNAMIC DATA :-
1:- LOCAL TEMPERATURE AND HIGHER TEMPERATURE
2:- ENTHALPHY,ENTROPHY,SPECIFIC HEAT
3:- MOLECULAR WEIGH
BODY OF THE CONTENT :-
FILE PARSING BASICALLY REFERS TO HOW INFORMATION CAN BE READE FROM PERTICULAR FILE AND HOW CAN BE USEFUL IN THE COMPUTER WE HAVE LEARN LOOP AND CONDITIONAL STATEMENTS AND FUNCTION THE FINAL PEARS IS FILE PARSING IF YOU KNOW FILE PASING THEN YOU KNOW HOW TO READ DATA FROM EXTERNAL FILE OR EXTERNAL DATA BASE AND YOU CAN INCLUDE THAT DATA IN YOUR CALCULATION SO WHEN TALKING ABOUT BIG DATA THEIR IS USUALLY THE PROGRAM AND LARGE AMOUNT OF DATA EITHER THE DATA IS STORED IN A FILE OR IT COMES ON A SERVER WHAT EVER IT IS ABILITE OF FILE TO TAKE WHAT EVER IT IS ABILITE TO STORE USEFULLY TO INFORMATION ONCES WE HAVE COMPLETED THIS CONCEPT WE WILL START WORKING ON IT
CONCLUSION :-
THE FILE PARSING REFERS TO HOW INFORMATION CAN BE READE FROM PERTICULAR FILE AND HOW CAN BE USEFUL IN THE COMPUTER WE HAVE LEARN THIS THE CONCLUSION OF THE FILE PARSING
COODING FOR FILE PARSING :-
clear all
close all
clc
% getting the data file
f1 = fopen('THERMO.dat','r');
fgetl(f1);
% reading the header information
tline = fgetl(f1);
A = strsplit(tline,' ');
global_low_temp = str2num(A{2});
global_mid_temp = str2num(A{3});
global_high_temp = str2num(A{4});
fgetl(f1);
fgetl(f1);
fgetl(f1);
for i = 1:53
l1 = fgetl(f1);
m = strsplit(l1,' ');
species_name = m{1};
endl = length(m);
local_low_temp = str2num(m{endl-3});
local_high_temp = str2num(m{endl-2});
local_mid_temp = str2num(m{endl-1});
tline1 = fgetl(f1);
a = findstr(tline1,'E');
a1= tline1(1:a(1)+3);
a1 = str2num(a1);
a2 = tline1(a(1)+4:a(2)+3);
a2 = str2num(a2);
a3 = tline1(a(2)+4:a(3)+3);
a3 = str2num(a3);
a4 = tline1(a(3)+4:a(4)+3);
a4 = str2num(a4);
a5= tline1(a(4)+4:a(5)+3);
a5 = str2num(a5);
tline2 = fgetl(f1);
b = findstr(tline2,'E');
a6 = tline2(1:b(1) +3);
a6 = str2num(a6);
a7 = tline2(b(1)+4:b(2)+3);
a7= str2num(a7);
a8 = tline2(b(2)+4:b(3)+3);
a8 = str2num(a8);
a9 = tline2(b(3)+4:b(4)+3);
a9 = str2num(a9);
a10 = tline2(b(4)+4:b(5)+3);
a10 = str2num(a10);
tline3 = fgetl(f1);
c = strfind(tline3,'E');
a11 = tline3(1:c(1)+3);
a11 = str2num(a11);
a12 = tline3(c(1)+4:c(2)+3);
a12 = str2num(a12);
a13 = tline3(c(2)+4:c(3)+3);
a13 = str2num(a13);
a14 = tline3(c(3)+4:c(4)+3);
a14 = str2num(a14);
T = linspace(200,350,1000);
R = 8.314;
% to get array of specific heat,enthalphy and entrophy
% for i = 1:length(T)
% to compare the species temperature to assign the co-efficients
% a1-a7(high temperature co-efficients), a8-a14(low temperature
% co-efficients)
if(T>local_mid_temp)
% high temperature coefficients.
cp = (a1+a2*T+a3*T.^2+a4*T.^3+a5*T.^4)*R;
H = (a1+(a2*T)/2+(a3*T.^2)/3+(a4*T.^3)/4+(a5*T.^4)/5+(a6./T))*R.*T;
S = a1*log(T)+a2*T+(a3*T.^3)/2+(a4*T.^3)/3+(a5*T.^4)/4+a7;
% low temperatures coefficients
else
cp = (a8+a9*T+a10*T.^2+a11*T.^3+a12*T.^4)*R;
H = (a8+(a9*T))/2+(a10*T.^2)/3+(a11*T.^3)/4+(a12*T.^4)/5+(a13./T)*R.*T;
S = a8*log(T)+a9*T+(a10*T.^2)/2+(a11*T.^3)/3+(a12*T.^4)/4+a14;
%cd('C:\Users\DELL\Documents\MATLAB\Anirudda V')% changing directory to original mat lab path
mkdir(species_name)
cd(species_name)
end
figure(1)
plot(T,cp)
xlabel('temp');
ylabel('specific heat');
figure(2)
plot(T,S)
xlabel('temp');
ylabel('entropy');
figure(3)
plot(T,H)
xlabel('temp');
ylabel('enthalphy');
grid on
saveas(1,'tempvscp','jpg');
saveas(2,'tempvsentropy','jpg');
saveas(3,'tempvsenthalphy','jpg');
cd ..
% molecular_masscalculation
elements = ['H','C','O','N','A'];
atomic_weight = [1.0079 12.0107 15.999 14.00673 39.948];
mol_mass = 0;
for i = 1:length(species_name)
for m = 1:length(atomic_weight)
if strcmp(species_name(1),elements(m))
mol_mass = mol_mass+atomic_weight(m);
position = m
end
end
n = str2double(species_name(1));
if n>1
mol_mass = mol_mass+atomic_weigtht(position)*(n-1);
end
end
sprintf('Molecular weight of %s:%f u', species_name,mol_mass)
end
fclose(f1)
MAIN FUNCTION :-
function [molecular_wt] = mw(species_name)
elements = ['H','C','N','O','A'];
atomic_wt = [1,12,14,16,40];
molecular_wt = 0;
for 1 = 1:length (species_name) %this loop makes sure that vlue or 1 is exctly the number or elements in the species. if it is o,then 1 is 1 and if the species is o2,then 1 will be 2
for j = 1: length(elements) %this loop makes sure that the value of j is according to the placement of the elements in the elements arry
if strcmp1 (species_name (1),elements(j)) % this line compres the value of 1 value for species with j value for elements and runs only if condition is met
molecular_wt = molecular_wt + atomic_wt(j);
position = j; % storing j value in another variable
end
end
f = str2double(species_name(1)); % converting string to number
if f>1
molecular_wt = molecular_wt + atomic_wt(position)*(f-1);% in order to get the right weight for a species,(f-1) is done. error correction
end
end
sprintf('the molecular weight of %5 is %d', species_name,molecular_wt)
end
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.