Challenge

Project 1 - Parsing NASA thermodynamic data

Explaining the code

Function - 'NASAcalculator' is made for the data extraction

  • Input - File name - 'THERMO.dat'
  • Processes
    • Skipping through the firs 5 header lines
    • Setting up a species counter
    • Running a while loop until find 'END'
      • updating the species counter
      • Reading the Species first line to extract
        • Species name
        • Splitting the line using strsplit(string,' ')
        • Finding the position of the very first letter if the species in the rest of the header from there deducing the string before G
        • splitting this sub string by spaces and extracting number of atoms in a particular species
        • then calculating the total molecular weight from a switch case list which contains atomic weight of individual atoms.
        • Extracting low, mid and high global temperature from the rest of the string. Using strsplit(string,' ')
      • Running a for loop 3 times to traverse through the nexr 3 lines of thar species which contains co-efficients for calculating CP, H & S
        • Reading the line then splitting it using [ strfind(currentLine,"E") ]
        • Running a nested loop to gothrough each split and converting that into num.
          • Using this - str2num(currentLine(E_pos(k1-1)+4:E_pos(k1)+3)
        • Collecting all the co-efficients
      • Doing the calculation part of polynomials from low temperature range to high temperature range
        • For this a funtion is created
          • Inputs
            • Co-efficients for the species 'a'
            • high/low temperature factor 'f' ["a(n+7*f)" so for calculatins in low temperature f = 1 else 0 for high temperature (n is 1,2,3,...)]
            • Temperature range (either high or low)
          • Calculation according to the given equations
          • Output
            • CP Specific Heat
            • H Enthalpy
            • S Entropy
      • Using the above mentioned function CP, H & S are calculated for low temperature range (low_temp:mid_temp, f=1) and high temperature range (mid_temp:6000, f=0) to create unanimus data points for the plot throught all species.
      • Concatenating both low temp. and high temp. ranges.
  • Output
    • speciesName
    • species Molecular Weight
    • low temperature
    • high temperature
    • mid temperature
    • co-efficient
    • CP Specific Heat
    • H Enthalpy
    • S Entropy

Main Program

  • Calling NASAcalculator function passing in the data file name to get
    • speciesName
    • species Molecular Weight
    • low temperature
    • high temperature
    • mid temperature
    • co-efficient
    • CP Specific Heat
    • H Enthalpy
    • S Entropy
  • for all species
  • Creating a folder using mkdir [make directory] to create folder "NASA data Interpreted(Nishant Jain)" in which information of all species is stored
  • Running a for loop for all the species
  • Printing the Spcie's name and moleculer w.t. on the command window
  • Creating the file location and directory using mkdir
  • Creating a text file and writing following information in it
    • speciesName
    • species Molecular Weight
    • low temperature
    • high temperature
    • mid temperature
    • co-efficient
  • Storing it and saving it
  • plotting following graphs
    • CP Specific Heat
    • H Enthalpy
    • S Entropy
  • turining them into .jpg and saving them
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.