Menu

Executive Programs

Workshops

Projects

Blogs

Careers

Placements

Student Reviews


For Business


More

Academic Training

Informative Articles

Find Jobs

We are Hiring!


All Courses

Choose a category

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

All Courses

All Courses

logo

CHOOSE A CATEGORY

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

Top Job Leading Courses

Automotive

CFD

FEA

Design

MBD

Med Tech

Courses by Software

Design

Solver

Automation

Vehicle Dynamics

CFD Solver

Preprocessor

Courses by Semester

First Year

Second Year

Third Year

Fourth Year

Courses by Domain

Automotive

CFD

Design

FEA

Tool-focused Courses

Design

Solver

Automation

Preprocessor

CFD Solver

Vehicle Dynamics

Machine learning

Machine Learning and AI

POPULAR COURSES

coursePost Graduate Program in Hybrid Electric Vehicle Design and Analysis
coursePost Graduate Program in Computational Fluid Dynamics
coursePost Graduate Program in CAD
coursePost Graduate Program in CAE
coursePost Graduate Program in Manufacturing Design
coursePost Graduate Program in Computational Design and Pre-processing
coursePost Graduate Program in Complete Passenger Car Design & Product Development
Executive Programs
Workshops
For Business

Success Stories

Placements

Student Reviews

More

Projects

Blogs

Academic Training

Find Jobs

Informative Articles

We're Hiring!

phone+91 9342691281Log in
  1. Home/
  2. Asad Ali Baig Mirza/
  3. Project 1 - Parsing NASA thermodynamic data

Project 1 - Parsing NASA thermodynamic data

Aim: To write a code to parse the thermodynamic data file provided and then calculate the thermodynamic properties of various gas species Objective: 1)Write a function that extracts the 14 co-efficients and calculates the enthalpy, entropy and specific heats for all the species in the data file.   2. Calculate the…

    • Asad Ali Baig Mirza

      updated on 01 Apr 2022

    Aim: To write a code to parse the thermodynamic data file provided and then calculate the thermodynamic properties of various gas species

    Objective:

    1)Write a function that extracts the 14 co-efficients and calculates the enthalpy, entropy and specific heats for all the species in the data file.

     

    2. Calculate the molecular weight of each species.

    3. Plot the Cp, Enthalpy and Entropy for the local temperature range 

    4. Save the plots as images with appropriate names and dump them in separate folders for each species with suitable name. 

    Theory:

    File parsing is a string or symbol either in a natural language,computer language conferning to the rules of former grammer

    Mathematical equations:

    For specific heat

    For enthalpy

    For entropy

    Where 

    T=Local temperature

    b1-b7 =High temperature coefficient

    b8-b14=low temperature coefficient

     

    R=Gas constant =8.314

     

    Program:

    The Program for File parsing is as follows

    %NASA thermodynamic data file parsing
    clear all
    close all
    clc
    
    %universal gas constant
    
    R=8.314;
    
    
    %reader header information
    
    f1=fopen('THERMO.dat','r');
    tline1=fgetl(f1);
    tline2=fgetl(f1);
    temp=strsplit(tline2,' ');
    global_low_temp=str2num(temp{2});
    global_mid_temp=str2num(temp{3});
    global_high_temp=str2num(temp{4});
    
    %skipping next three lines
    
    for i=3
        skippedlines=fgetl(f1);
    end
        for i=1:53
        tline3=fgetl(f1)
        S=strsplit(tline3,' ');
        species_name=S{1};
        A=strfind(tline3,'G');
        temp_values=tline3(A+4:length(tline3));
        B=strsplit(temp_values,' ');
    local_low_temp=str2double(B{1});
    local_mid_temp=str2double(B{3});
    local_high_temp=str2double(B{2});
    
    tline4=fgetl(f1);
    f=strfind(tline4,'E');
    a1=str2double(tline4(1:(f(1)+3)));
    a2=str2double(tline4(f(1)+4:f(2)+3));
    a2=str2double(tline4(f(2)+4:f(3)+3));
    a2=str2double(tline4(f(3)+4:f(4)+3));
    a2=str2double(tline4(f(4)+4:f(5)+3));
    
    tline5=fgetl(f1);
    a6=str2double(tline5(1:(f(1)+3)));
    a7=str2double(tline5(f(1)+4:f(2)+3));
    a8=str2double(tline5(f(2)+4:f(3)+3));
    a9=str2double(tline5(f(3)+4:f(4)+3));
    a10=str2double(tline5(f(4)+4:f(5)+3));
    
    tline6=fgetl(f1);
    a11=str2double(tline6(1:(f(1)+3)));
    a12=str2double(tline6(f(1)+4:f(2)+3));
    a13=str2double(tline6(f(2)+4:f(3)+3));
    a14=str2double(tline6(f(3)+4:f(4)+3));
    
    
    t=linspace(local_low_temp,local_high_temp,100)
    
    %to calculate specific heat using function
    
    C_p=R*specific_heat_cal(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,local_low_temp,local_mid_temp,local_high_temp,T,R);
    s=R*entropy_cal(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,local_low_temp,local_mid_temp,local_high_temp,T,R);
    h=R*enthalpy_cal(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,local_low_temp,local_mid_temp,local_high_temp,T,R);
    
    %Creating a folder
    
    mkdir(['G:',species_name])
    cd(species_name)
    
    %Plotting for
    
    %temperature vs specific heat
    
    figure(1)
    plot(t,c_p)
    xlabel('temperature')
    ylabel('specific heat')
    title('temperature vs specific heat')
    image=getframe(gcf);
    imwrite(image.cdata,'t vs cp.png')
    saveas(1,'specific heat','jpg')
    
    %temperature vs enthalpy
    
    figure(2)
    plot(t,H)
    xlabel('temperature')
    ylabel('enthalpy')
    title('temperature vs enthalpy')
    image=getframe(gcf);
    imwrite(image.cdata,'t vs H.png')
    saveas(2,'enthalpy','jpg')
    
    
    %temperature vs entropy
    
    figure(3)
    plot(t,S)
    xlabel('temperature')
    ylabel('entropy')
    title('temperature vs entropy')
    image=getframe(gcf);
    imwrite(image.cdata,'t vs S.png')
    saveas(2,'entropy','jpg')
    
    cd..
    %calculating molecular mass
    
    [M]=molecular_wt(species_name);
    K=sprintf('%s mol_wt=%f',species_name,M);
    disp(K)
        end

    specific heat function code

    Function[C_p]=specific_heat_cal(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,local_low_temp,local_mid_temp,local_high_temp,T,R);
    
    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 code

    Function[H]=enthalpy_cal(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,local_low_temp,local_mid_temp,local_high_temp,T,R);
    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 code

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

     

    Plots:

    Plots we got from element O2

     

     

    Plots we got from element N2

     

     

    plots we got from CO2 Element

     

     

    Molecular weight of O2=31.9980

    Molecular weight of N2=28.0140

    Molecular weight of CO2=44.0090

    Folders:

     

     

    Issues faced during the challenge:

     

    during the challenge i faced issue in understanding in the concept and i had a one on one session with support engineer and i am very clear with the concept

     

     

     

    Leave a comment

    Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.

    Please  login to add a comment

    Other comments...

    No comments yet!
    Be the first to add a comment

    Read more Projects by Asad Ali Baig Mirza (8)

    Radar Mast & Final Assembly of Yacht

    Objective:

       Radar mast: Front view Side view  Top view          Expanded feature tree of Radarmast                                                                                                                                                           …

    calendar

    08 Mar 2023 06:59 PM IST

      Read more

      Week - 4

      Objective:

      Implement control logic of a “washing machine” using Stateflow as per given sequence:  If the power supply is available, the system gets activated  If the Water supply is not available, stop the process & indicate through LED Soaking time should be 200s followed by Washing time of 100s. Then rinsing…

      calendar

      06 Apr 2022 07:06 PM IST

        Read more

        Week -2

        Objective:

        Aim: 1)Make a Simulink model of Doorbell using solenoid block.  2)Use a thermistor to sense the temperature of a heater & turn on or turn off the fan.   Solenoid:   A solenoid  is a type of electromagnet formed by a helical coil of wire whose length…

        calendar

        06 Apr 2022 04:28 PM IST

          Read more

          Project 1 - Parsing NASA thermodynamic data

          Objective:

          Aim: To write a code to parse the thermodynamic data file provided and then calculate the thermodynamic properties of various gas species Objective: 1)Write a function that extracts the 14 co-efficients and calculates the enthalpy, entropy and specific heats for all the species in the data file.   2. Calculate the…

          calendar

          01 Apr 2022 05:25 PM IST

            Read more

            Schedule a counselling session

            Please enter your name
            Please enter a valid email
            Please enter a valid number

            Related Courses

            coursecard

            Design loads considered on bridges

            Recently launched

            10 Hours of Content

            coursecard

            Design of Steel Superstructure in Bridges

            Recently launched

            16 Hours of Content

            coursecard

            Design for Manufacturability (DFM)

            Recently launched

            11 Hours of Content

            coursecard

            CATIA for Medical Product Design

            Recently launched

            5 Hours of Content

            coursecardcoursetype

            Accelerated Career Program in Embedded Systems (On-Campus) Courseware Partner: IT-ITes SSC nasscom

            Recently launched

            0 Hours of Content

            Schedule a counselling session

            Please enter your name
            Please enter a valid email
            Please enter a valid number

            logo

            Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.

            https://d27yxarlh48w6q.cloudfront.net/web/v1/images/facebook.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/insta.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/twitter.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/youtube.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/linkedin.svg

            Our Company

            News & EventsBlogCareersGrievance RedressalSkill-Lync ReviewsTermsPrivacy PolicyBecome an Affiliate
            map
            EpowerX Learning Technologies Pvt Ltd.
            4th Floor, BLOCK-B, Velachery - Tambaram Main Rd, Ram Nagar South, Madipakkam, Chennai, Tamil Nadu 600042.
            mail
            info@skill-lync.com
            mail
            ITgrievance@skill-lync.com

            Top Individual Courses

            Computational Combustion Using Python and CanteraIntroduction to Physical Modeling using SimscapeIntroduction to Structural Analysis using ANSYS WorkbenchIntroduction to Structural Analysis using ANSYS Workbench

            Top PG Programs

            Post Graduate Program in Hybrid Electric Vehicle Design and AnalysisPost Graduate Program in Computational Fluid DynamicsPost Graduate Program in CADPost Graduate Program in Electric Vehicle Design & Development

            Skill-Lync Plus

            Executive Program in Electric Vehicle Embedded SoftwareExecutive Program in Electric Vehicle DesignExecutive Program in Cybersecurity

            Trending Blogs

            Heat Transfer Principles in Energy-Efficient Refrigerators and Air Conditioners Advanced Modeling and Result Visualization in Simscape Exploring Simulink and Library Browser in Simscape Advanced Simulink Tools and Libraries in SimscapeExploring Simulink Basics in Simscape

            © 2025 Skill-Lync Inc. All Rights Reserved.

                        Do You Want To Showcase Your Technical Skills?
                        Sign-Up for our projects.