Challenge

Project 1 - Parsing NASA thermodynamic data

AIM- Parsing NASA thermodynamic data

The program Starts with clear all, close all and clc etc fopen command used for open the thermal file. to read the heading line of the data and for the next line also used fgetl command

Getting the global temperature Information

To get the global temp line fgetl command used, generally information will stored in the string form to get numerical value use str2double command which converts the text in string of numerical value in string to double precision value and use {} instead of () which means the global temperature line is the form of cell array by which we can obtain the global temperature values and to skip the next three lines use fgetl command.

Getting Local temperature information of individual Species

To get the global temp line fgetl command used and stores it as line 1 in which we can observe that the first is the species name and the maximum length of species name is 6

To extract the coefficient values

clear all
close all
clc

% Opening of NASA Thermodynamic Data
f1= fopen('THERMO.dat','r');
first_line= fgetl(f1);

% Opening Global Max, min and medium temperatures

global_temp= fgetl(f1);
temp_range= strsplit(global_temp,' ');
global_min_temp= str2num(temp_range{2})
global_mid_temp= str2num(temp_range{3})
global_max_temp= str2num(temp_range{4})

% Range of Temperatures
T= linspace (global_min_temp,global_max_temp,400);
R= 8.314;

% Skipping the next three comments in the file
for i=3:5
    comments=fgetl(f1);
end

% Getting the coeffs of Species

for i=1:53
    % Extracting line 1 and the name of the speices
    line1= fgetl(f1);
    name= strtok(line1);

     % Extracting higer and lower temperature coeffs
     line2= fgetl(f1);
     line3= fgetl(f1);
     line4= fgetl(f1);

     A= strfind(line2,'E');
     B= strfind(line3,'E');
     C= strfind(line4,'E');

      % Extracting higer Temperature coeffs
      a1= str2num(line2(1:A(1)+3));
      a2= str2num(line2(A(1)+4:A(2)+3));
      a3= str2num(line2(A(2)+4:A(3)+3));
      a4= str2num(line2(A(3)+4:A(4)+3));
      a5= str2num(line2(A(4)+4:A(5)+3));
      a6= str2num(line3(1:B(1)+3));
      a7= str2num(line3(B(1)+4:B(2)+3));

      % Extracting Lower Temperature coeffs

      b1= str2num(line3(B(2)+4:B(3)+3));
      b2= str2num(line3(B(3)+4:B(4)+3));
      b3= str2num(line3(B(4)+4:B(5)+3));
      b4= str2num(line4(1:C(1)+3));
      b5= str2num(line4(C(1)+4:C(2)+3));
      b6= str2num(line4(C(2)+4:C(3)+3));
      b7= str2num(line4(C(3)+4:C(4)+3));

      % Specific Heat Calculations
      cp= specificheat(a1,a2,a3,a4,a5,b1,b2,b3,b4,b5,T,R,global_mid_temp);

      % Enthalpy Calculations
      h= enthalpy(a1,a2,a3,a4,a5,a6,b1,b2,b3,b4,b5,b6,T,R,global_mid_temp);

      % Entropy Calculations
      s= entropy_calc(a1,a2,a3,a4,a5,a7,b1,b2,b3,b4,b5,b7,T,R,global_mid_temp);

      % Calculating molecular weight of species
      Molecular_wt(i) = molecular_weight(name)

      % Creating Individual folder for each speices and plotting
      plotting(cp,h,s,T,name)
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.