<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fuel Gas Archives - Chemical Engineering Site</title>
	<atom:link href="https://chemicalengineeringsite.in/tag/fuel-gas/feed/" rel="self" type="application/rss+xml" />
	<link>https://chemicalengineeringsite.in/tag/fuel-gas/</link>
	<description>For Chemical Engineers</description>
	<lastBuildDate>Fri, 15 Aug 2025 12:05:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Natural Gas &#8211; Fuel Gas &#8211; HHV LHV Calculator</title>
		<link>https://chemicalengineeringsite.in/natural-gas-lhv-hhv-calculator-excel/</link>
					<comments>https://chemicalengineeringsite.in/natural-gas-lhv-hhv-calculator-excel/#respond</comments>
		
		<dc:creator><![CDATA[chemicalengineeringsite]]></dc:creator>
		<pubDate>Mon, 18 Aug 2025 12:03:00 +0000</pubDate>
				<category><![CDATA[Calculators]]></category>
		<category><![CDATA[Fuel Gas]]></category>
		<category><![CDATA[HHV Calculator]]></category>
		<category><![CDATA[LHV Calculator]]></category>
		<category><![CDATA[MMBTU]]></category>
		<category><![CDATA[Natural Gas]]></category>
		<guid isPermaLink="false">https://chemicalengineeringsite.in/?p=3827</guid>

					<description><![CDATA[<p>Natural Gas &#8211; Fuel Gas LHV / HHV Calculator Enter gas composition (Mole %) — Results update instantly. Standard temperature for volume basis: 0°C (Nm³)15°C (Sm³)20°C (Sm³) Fuel quantity: kgNm³ (0°C)Sm³ (15°C)Sm³ (20°C)m³ (use selected Std T) Normalize to 100% &#x1f4ca; Export Excel S.No Chemical Formula Name Composition (Mole %) Molecular Weight Weight % LHV [&#8230;]</p>
<p>The post <a href="https://chemicalengineeringsite.in/natural-gas-lhv-hhv-calculator-excel/">Natural Gas &#8211; Fuel Gas &#8211; HHV LHV Calculator</a> appeared first on <a href="https://chemicalengineeringsite.in">Chemical Engineering Site</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<!-- Natural Gas - Fuel Gas LHV/HHV Calculator — with MJ, kcal, MMBTU -->
<div id="fgc" class="fgc-card" role="region" aria-label="Fuel Gas LHV/HHV Calculator">
  <div class="fgc-header">
    <h2 class="fgc-title"> Natural Gas &#8211; Fuel Gas LHV / HHV Calculator</h2>
    <p class="fgc-sub">Enter gas composition (Mole %) — Results update instantly.</p>
  </div>

  <!-- Controls -->
  <div class="fgc-controls">
    <div class="fgc-row">
      <label>Standard temperature for volume basis:
        <select id="stdT">
          <option value="0">0°C (Nm³)</option>
          <option value="15" selected>15°C (Sm³)</option>
          <option value="20">20°C (Sm³)</option>
        </select>
      </label>
      <label>Fuel quantity:
        <input id="qty" type="number" min="0" step="any" placeholder="e.g., 100">
        <select id="qtyUnit">
          <option value="kg">kg</option>
          <option value="Nm3">Nm³ (0°C)</option>
          <option value="Sm3_15" selected>Sm³ (15°C)</option>
          <option value="Sm3_20">Sm³ (20°C)</option>
          <option value="m3">m³ (use selected Std T)</option>
        </select>
      </label>
      <button type="button" id="normalize" class="fgc-btn fgc-btn-ghost" title="Scale mole% to sum 100%">Normalize to 100%</button>
      <button type="button" id="export" class="fgc-btn" title="Export Excel with formulas"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4ca.png" alt="📊" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Export Excel</button>
    </div>
  </div>

  <!-- Table -->
  <div class="fgc-table-wrap">
    <table class="fgc-table" id="fgc-table">
      <thead>
        <tr>
          <th>S.No</th>
          <th>Chemical Formula</th>
          <th>Name</th>
          <th>Composition (Mole %)</th>
          <th>Molecular Weight</th>
          <th>Weight %</th>
          <th>LHV (MJ/kg)</th>
          <th>HHV (MJ/kg)</th>
        </tr>
      </thead>
      <tbody id="fgc-body"><!-- rows injected by JS --></tbody>
      <tfoot>
        <tr class="fgc-total">
          <td colspan="3"><strong>Fuel Gas Mixture</strong></td>
          <td id="sumMole">0.00</td>
          <td></td>
          <td id="sumWeight">0.00</td>
          <td id="mixLHVkg">–</td>
          <td id="mixHHVkg">–</td>
        </tr>
      </tfoot>
    </table>
  </div>

  <!-- Results -->
  <div class="fgc-results">
    <div class="fgc-result"><span>Average Molecular Weight (kg/kmol)</span><strong id="avgMW">–</strong></div>

    <div class="fgc-split">
      <div>
        <h4>Per mass</h4>
        <div class="fgc-result"><span>LHV (MJ/kg)</span><strong id="lhv_mj_kg">–</strong></div>
        <div class="fgc-result"><span>HHV (MJ/kg)</span><strong id="hhv_mj_kg">–</strong></div>
        <div class="fgc-result"><span>LHV (kcal/kg)</span><strong id="lhv_kcal_kg">–</strong></div>
        <div class="fgc-result"><span>HHV (kcal/kg)</span><strong id="hhv_kcal_kg">–</strong></div>
        <div class="fgc-result"><span>LHV (MMBTU/kg)</span><strong id="lhv_mmbtu_kg">–</strong></div>
        <div class="fgc-result"><span>HHV (MMBTU/kg)</span><strong id="hhv_mmbtu_kg">–</strong></div>
      </div>
      <div>
        <h4>Per volume at <span id="stdLabel">15°C (Sm³)</span></h4>
        <div class="fgc-result"><span>LHV (MJ/m³)</span><strong id="lhv_mj_m3">–</strong></div>
        <div class="fgc-result"><span>HHV (MJ/m³)</span><strong id="hhv_mj_m3">–</strong></div>
        <div class="fgc-result"><span>LHV (kcal/m³)</span><strong id="lhv_kcal_m3">–</strong></div>
        <div class="fgc-result"><span>HHV (kcal/m³)</span><strong id="hhv_kcal_m3">–</strong></div>
        <div class="fgc-result"><span>LHV (MMBTU/m³)</span><strong id="lhv_mmbtu_m3">–</strong></div>
        <div class="fgc-result"><span>HHV (MMBTU/m³)</span><strong id="hhv_mmbtu_m3">–</strong></div>
      </div>
      <div>
        <h4>Fuel quantity energy</h4>
        <div class="fgc-result"><span>Energy (LHV)</span><strong id="qty_lhv_mj">–</strong><small>MJ</small></div>
        <div class="fgc-result"><span>Energy (HHV)</span><strong id="qty_hhv_mj">–</strong><small>MJ</small></div>
        <div class="fgc-result"><span>Energy (LHV)</span><strong id="qty_lhv_kcal">–</strong><small>kcal</small></div>
        <div class="fgc-result"><span>Energy (HHV)</span><strong id="qty_hhv_kcal">–</strong><small>kcal</small></div>
        <div class="fgc-result"><span>Energy (LHV)</span><strong id="qty_lhv_mmbtu">–</strong><small>MMBTU</small></div>
        <div class="fgc-result"><span>Energy (HHV)</span><strong id="qty_hhv_mmbtu">–</strong><small>MMBTU</small></div>
      </div>
    </div>
  </div>

  <footer class="fgc-footer">
    <small>Defaults are typical values at ~25°C for pure components; edit if your spec differs. Source data may vary by reference. </small>
    <br/>
    <small><a href="https://chemicalengineeringsite.in/" target="_blank" rel="noopener">Source: chemicalengineeringsite.in</a></small>
  </footer>
</div>

<!-- Styles -->
<style>
  .fgc-card{max-width:1100px;margin:1.25rem auto;padding:1rem;border:1px solid #e6eef6;border-radius:16px;background:#fff;box-shadow:0 6px 20px rgba(2,6,23,.06)}
  .fgc-title{margin:.25rem 0;font-size:1.25rem;color:#0f172a}
  .fgc-sub{margin:0 0 .5rem 0;color:#475569}
  .fgc-controls{margin:.5rem 0}
  .fgc-row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
  .fgc-row label{display:flex;gap:8px;align-items:center}
  .fgc-row input,.fgc-row select{padding:.45rem .6rem;border:1px solid #e6eef6;border-radius:10px}
  .fgc-btn{border:1px solid #2563eb;background:#2563eb;color:#fff;border-radius:999px;padding:.5rem .85rem;font-weight:600;cursor:pointer}
  .fgc-btn-ghost{background:#fff;color:#2563eb}
  .fgc-table-wrap{overflow:auto;border:1px solid #e6eef6;border-radius:12px}
  .fgc-table{width:100%;border-collapse:separate;border-spacing:0;min-width:800px}
  .fgc-table th,.fgc-table td{padding:.5rem .6rem;border-bottom:1px solid #eef2f8;text-align:left;font-size:.95rem}
  .fgc-table thead th{position:sticky;top:0;background:#f8fbff;z-index:1}
  .fgc-table tfoot td{background:#f8fbff;font-weight:700}
  .fgc-table input{width:110px;max-width:100%;padding:.35rem .45rem;border:1px solid #e6eef6;border-radius:8px}
  .fgc-table .num{white-space:nowrap}
  .fgc-total td{border-top:2px solid #dbe7f4}
  .fgc-results{margin-top:.75rem;border-top:1px dashed #e6eef6;padding-top:.75rem}
  .fgc-result{display:flex;justify-content:space-between;gap:10px;margin:.3rem 0}
  .fgc-split{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
  @media (max-width:900px){.fgc-split{grid-template-columns:1fr}}
  .fgc-footer{margin-top:.5rem;color:#475569}
  .fgc-muted{color:#64748b}
</style>

<!-- SheetJS for Excel export -->
<script src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"></script>

<script>
(function(){
  // ----- Component data (edit LHV/HHV if your reference differs) -----
  const comp = [
    {n:1,  f:'CH₄',   name:'Methane',           MW:16.043, LHV:50.02, HHV:55.50},
    {n:2,  f:'C₂H₆',  name:'Ethane',            MW:30.07,  LHV:47.47, HHV:51.90},
    {n:3,  f:'C₃H₈',  name:'Propane',           MW:44.097, LHV:46.44, HHV:50.35},
    {n:4,  f:'n-C₄H₁₀', name:'n-Butane',        MW:58.124, LHV:45.73, HHV:49.50},
    {n:5,  f:'i-C₄H₁₀', name:'Isobutane',       MW:58.124, LHV:45.73, HHV:49.50},
    {n:6,  f:'C₂H₄',  name:'Ethylene',          MW:28.054, LHV:47.16, HHV:51.88},
    {n:7,  f:'C₃H₆',  name:'Propylene',         MW:42.081, LHV:45.80, HHV:50.36},
    {n:8,  f:'C₄H₈',  name:'Butylene',          MW:56.106, LHV:45.10, HHV:49.50},
    {n:9,  f:'C₅H₁₂', name:'Pentane',           MW:72.151, LHV:44.50, HHV:49.50},
    {n:10, f:'C₆H₁₄', name:'Hexane',            MW:86.178, LHV:44.00, HHV:48.60},
    {n:11, f:'C₂H₂',  name:'Acetylene',         MW:26.038, LHV:48.20, HHV:51.90},
    {n:12, f:'C₄H₆',  name:'Butadiene',         MW:54.092, LHV:45.00, HHV:48.90},
    {n:13, f:'H₂',    name:'Hydrogen',          MW:2.016,  LHV:120.0, HHV:141.8},
    {n:14, f:'CO',    name:'Carbon Monoxide',   MW:28.01,  LHV:10.11, HHV:10.11},
    {n:15, f:'CO₂',   name:'Carbon Dioxide',    MW:44.01,  LHV:0,     HHV:0},
    {n:16, f:'N₂',    name:'Nitrogen',          MW:28.014, LHV:0,     HHV:0},
    {n:17, f:'O₂',    name:'Oxygen',            MW:31.999, LHV:0,     HHV:0},
    {n:18, f:'Ar',    name:'Argon',             MW:39.948, LHV:0,     HHV:0},
    {n:19, f:'H₂O',   name:'Water',             MW:18.015, LHV:0,     HHV:0},
    {n:20, f:'H₂S',   name:'Hydrogen Sulfide',  MW:34.076, LHV:16.0,  HHV:17.6},
    {n:21, f:'He',    name:'Helium',            MW:4.003,  LHV:0,     HHV:0},
    {n:22, f:'COS',   name:'Carbonyl Sulfide',  MW:60.075, LHV:10.6,  HHV:11.3},
    {n:23, f:'CS₂',   name:'Carbon Disulfide',  MW:76.141, LHV:14.7,  HHV:15.3},
    {n:24, f:'Hg',    name:'Mercury',           MW:200.59, LHV:0,     HHV:0},
    {n:25, f:'NH₃',   name:'Ammonia',           MW:17.031, LHV:18.6,  HHV:22.5},
    {n:26, f:'NOₓ',   name:'Nitrogen Oxides',   MW:46.0,   LHV:0,     HHV:0}, // placeholder ~NO2
    {n:27, f:'SO₂',   name:'Sulfur Dioxide',    MW:64.066, LHV:0,     HHV:0},
    {n:28, f:'H₂CO',  name:'Formaldehyde',      MW:30.026, LHV:16.0,  HHV:18.0},
    {n:29, f:'C₂H₅OH',name:'Ethanol',           MW:46.069, LHV:26.8,  HHV:29.7},
  ];

  // ----- DOM & constants -----
  const body = document.getElementById('fgc-body');
  const KCAL_PER_MJ = 239.005736;
  const MJ_PER_MMBTU = 1055.05585; // 1 MMBTU = 1055.05585 MJ
  const R_kPa_m3_per_kmolK = 8.314462618;
  const P_kPa = 101.325;

  // Build rows
  comp.forEach((c)=>{
    const tr = document.createElement('tr');
    tr.innerHTML = `
      <td>${c.n}</td>
      <td>${c.f}</td>
      <td>${c.name}</td>
      <td><input type="number" class="mole" min="0" step="any" value=""></td>
      <td class="num">${c.MW.toFixed(3)}</td>
      <td class="num wt">0.00</td>
      <td><input type="number" class="lhv" min="0" step="any" value="${c.LHV ?? ''}"></td>
      <td><input type="number" class="hhv" min="0" step="any" value="${c.HHV ?? ''}"></td>
    `;
    body.appendChild(tr);
  });

  // Helpers
  const $ = (sel)=>document.querySelector(sel);
  function rows(){
    return Array.from(body.querySelectorAll('tr')).map(tr=>{
      const tds = tr.querySelectorAll('td');
      return {
        mole: parseFloat(tr.querySelector('.mole').value)||0,
        MW: parseFloat(tds[4].textContent)||0,
        lhv: parseFloat(tr.querySelector('.lhv').value)||0,
        hhv: parseFloat(tr.querySelector('.hhv').value)||0,
        wtCell: tr.querySelector('.wt'),
      };
    });
  }

  function update(){
    const r = rows();
    const sumMole = r.reduce((a,x)=>a+x.mole,0);
    const sumMass = r.reduce((a,x)=>a+x.mole*x.MW,0);

    // Weight %
    r.forEach(x=>{
      const w = sumMass>0 ? (x.mole*x.MW)/sumMass*100 : 0;
      x.wtCell.textContent = w ? w.toFixed(2) : '0.00';
    });

    // Average MW
    const avgMW = sumMole>0 ? (r.reduce((a,x)=>a + x.mole*x.MW,0)/sumMole) : 0;

    // Mixture per-kg (mass weighted)
    const mixLHVkg = sumMass>0 ? r.reduce((a,x)=>a + ((x.mole*x.MW)/sumMass)*x.lhv,0) : 0;
    const mixHHVkg = sumMass>0 ? r.reduce((a,x)=>a + ((x.mole*x.MW)/sumMass)*x.hhv,0) : 0;

    // Per kmol (mole weighted using per-kg*MW)
    const mixLHV_kmol = sumMole>0 ? r.reduce((a,x)=>a + (x.mole/sumMole)*(x.lhv*x.MW),0) : 0;
    const mixHHV_kmol = sumMole>0 ? r.reduce((a,x)=>a + (x.mole/sumMole)*(x.hhv*x.MW),0) : 0;

    // Standard temperature
    const Tstd = parseFloat($('#stdT').value)||15;
    $('#stdLabel').textContent = (Tstd===0?'0°C (Nm³)':(Tstd===15?'15°C (Sm³)':'20°C (Sm³)'));

    // Molar volume at selected T
    const Vm = R_kPa_m3_per_kmolK*(273.15+Tstd)/P_kPa; // m3/kmol

    // Per m3
    const lhv_mj_m3 = Vm>0 ? mixLHV_kmol / Vm : 0;
    const hhv_mj_m3 = Vm>0 ? mixHHV_kmol / Vm : 0;

    // Per kg (kcal & MMBTU)
    const lhv_kcal_kg = mixLHVkg*KCAL_PER_MJ;
    const hhv_kcal_kg = mixHHVkg*KCAL_PER_MJ;
    const lhv_mmbtu_kg = mixLHVkg / MJ_PER_MMBTU;
    const hhv_mmbtu_kg = mixHHVkg / MJ_PER_MMBTU;

    // Per m3 (kcal & MMBTU)
    const lhv_kcal_m3 = lhv_mj_m3*KCAL_PER_MJ;
    const hhv_kcal_m3 = hhv_mj_m3*KCAL_PER_MJ;
    const lhv_mmbtu_m3 = lhv_mj_m3 / MJ_PER_MMBTU;
    const hhv_mmbtu_m3 = hhv_mj_m3 / MJ_PER_MMBTU;

    // Quantity energy (respecting unit)
    const qty = parseFloat($('#qty').value)||0;
    const qtyUnit = $('#qtyUnit').value;
    // pick standard for volume quantity
    let stdForQty = 15;
    if(qtyUnit==='Nm3') stdForQty = 0;
    if(qtyUnit==='Sm3_20') stdForQty = 20;
    if(qtyUnit==='m3') stdForQty = Tstd;
    const Vm_qty = R_kPa_m3_per_kmolK*(273.15+stdForQty)/P_kPa;
    const lhv_mj_m3_qtyStd = Vm_qty>0 ? mixLHV_kmol/Vm_qty : 0;
    const hhv_mj_m3_qtyStd = Vm_qty>0 ? mixHHV_kmol/Vm_qty : 0;

    let qtyLHV_MJ = 0, qtyHHV_MJ = 0;
    if(qtyUnit==='kg'){
      qtyLHV_MJ = qty*mixLHVkg; qtyHHV_MJ = qty*mixHHVkg;
    } else {
      qtyLHV_MJ = qty*lhv_mj_m3_qtyStd;
      qtyHHV_MJ = qty*hhv_mj_m3_qtyStd;
    }
    const qtyLHV_kcal = qtyLHV_MJ*KCAL_PER_MJ;
    const qtyHHV_kcal = qtyHHV_MJ*KCAL_PER_MJ;
    const qtyLHV_mmbtu = qtyLHV_MJ / MJ_PER_MMBTU;
    const qtyHHV_mmbtu = qtyHHV_MJ / MJ_PER_MMBTU;

    // Update UI
    $('#sumMole').textContent = sumMole.toFixed(2);
    $('#sumWeight').textContent = (sumMass>0?100:0).toFixed(2);
    $('#avgMW').textContent = avgMW ? avgMW.toFixed(3) : '–';

    $('#mixLHVkg').textContent = mixLHVkg ? mixLHVkg.toFixed(3) : '–';
    $('#mixHHVkg').textContent = mixHHVkg ? mixHHVkg.toFixed(3) : '–';

    $('#lhv_mj_kg').textContent = mixLHVkg ? mixLHVkg.toFixed(3) : '–';
    $('#hhv_mj_kg').textContent = mixHHVkg ? mixHHVkg.toFixed(3) : '–';
    $('#lhv_kcal_kg').textContent = mixLHVkg ? lhv_kcal_kg.toFixed(1) : '–';
    $('#hhv_kcal_kg').textContent = mixHHVkg ? hhv_kcal_kg.toFixed(1) : '–';
    $('#lhv_mmbtu_kg').textContent = mixLHVkg ? lhv_mmbtu_kg.toFixed(6) : '–';
    $('#hhv_mmbtu_kg').textContent = mixHHVkg ? hhv_mmbtu_kg.toFixed(6) : '–';

    $('#lhv_mj_m3').textContent = lhv_mj_m3 ? lhv_mj_m3.toFixed(3) : '–';
    $('#hhv_mj_m3').textContent = hhv_mj_m3 ? hhv_mj_m3.toFixed(3) : '–';
    $('#lhv_kcal_m3').textContent = lhv_mj_m3 ? lhv_kcal_m3.toFixed(1) : '–';
    $('#hhv_kcal_m3').textContent = hhv_mj_m3 ? hhv_kcal_m3.toFixed(1) : '–';
    $('#lhv_mmbtu_m3').textContent = lhv_mj_m3 ? lhv_mmbtu_m3.toFixed(6) : '–';
    $('#hhv_mmbtu_m3').textContent = hhv_mj_m3 ? hhv_mmbtu_m3.toFixed(6) : '–';

    $('#qty_lhv_mj').textContent = qtyLHV_MJ ? qtyLHV_MJ.toFixed(2) : '–';
    $('#qty_hhv_mj').textContent = qtyHHV_MJ ? qtyHHV_MJ.toFixed(2) : '–';
    $('#qty_lhv_kcal').textContent = qtyLHV_MJ ? qtyLHV_kcal.toFixed(0) : '–';
    $('#qty_hhv_kcal').textContent = qtyHHV_MJ ? qtyHHV_kcal.toFixed(0) : '–';
    $('#qty_lhv_mmbtu').textContent = qtyLHV_MJ ? qtyLHV_mmbtu.toFixed(6) : '–';
    $('#qty_hhv_mmbtu').textContent = qtyHHV_MJ ? qtyHHV_mmbtu.toFixed(6) : '–';

    // store for Excel export
    window.__fgc_state = {sumMole, avgMW, mixLHVkg, mixHHVkg, mixLHV_kmol, mixHHV_kmol, Tstd};
  }

  // Events
  body.addEventListener('input', e=>{ if(e.target.matches('.mole,.lhv,.hhv')) update(); });
  document.getElementById('stdT').addEventListener('change', update);
  document.getElementById('qty').addEventListener('input', update);
  document.getElementById('qtyUnit').addEventListener('change', update);

  // Normalize button
  document.getElementById('normalize').addEventListener('click', ()=>{
    const moles = Array.from(body.querySelectorAll('.mole'));
    const sum = moles.reduce((a,el)=>a+(parseFloat(el.value)||0),0);
    if(sum>0){
      moles.forEach(el=>{
        const v = parseFloat(el.value)||0;
        el.value = (v*100/sum).toFixed(6);
      });
      update();
    }
  });

  // ----- Excel Export with MJ, kcal, MMBTU (live formulas) -----
  function exportExcel(){
    const rowsDom = Array.from(body.querySelectorAll('tr'));
    const startRow = 3; // first data row in Excel
    const data = [];

    // Header (row 1) + spacer (row 2)
    data.push(['S.No','Chemical Formula','Name','Composition (Mole %)','Molecular Weight','Weight %','LHV (MJ/kg)','HHV (MJ/kg)']);
    data.push(['','','','','','','','']);

    // Data rows
    rowsDom.forEach((tr)=>{
      const tds = tr.querySelectorAll('td');
      const n = tds[0].textContent.trim();
      const f = tds[1].textContent.trim();
      const name = tds[2].textContent.trim();
      const mole = tr.querySelector('.mole').value||'';
      const MW = tds[4].textContent.trim();
      const lhv = tr.querySelector('.lhv').value||'';
      const hhv = tr.querySelector('.hhv').value||'';
      data.push([n,f,name, Number(mole), Number(MW), null, Number(lhv), Number(hhv)]);
    });

    const compCount = rowsDom.length;
    const endRow = startRow + compCount - 1;
    const sumMoleRange = `D${startRow}:D${endRow}`;
    const sumMassExpr = `SUMPRODUCT(D${startRow}:D${endRow},E${startRow}:E${endRow})`;

    // Totals row
    const totalsRowIdx = startRow + compCount;
    data.push([
      'Fuel Gas Mixture','', '',
      {t:'n', f:`SUM(${sumMoleRange})`},
      '',
      {t:'n', f:'100'},
      {t:'n', f:`IF(${sumMassExpr}=0,"",SUMPRODUCT(F${startRow}:F${endRow},G${startRow}:G${endRow})/100)`},
      {t:'n', f:`IF(${sumMassExpr}=0,"",SUMPRODUCT(F${startRow}:F${endRow},H${startRow}:H${endRow})/100)`}
    ]);

    // Spacer
    data.push(['','','','','','','','']);

    // Outputs section anchor
    const outputsStart = totalsRowIdx + 2;

    // Average MW
    data.push(['Output','Average Molecular Weight', {t:'n', f:`IF(SUM(${sumMoleRange})=0,"",SUMPRODUCT(D${startRow}:D${endRow},E${startRow}:E${endRow})/SUM(${sumMoleRange}))`},'','','','','']);

    // Fuel Quantity input row (user edits B & C)
    const qtyRow = outputsStart + 1;
    data.push(['Fuel Quantity','', 'Unit (kg, Nm3, Sm3, m3)', 'Kg (or) Sm3 (or) m3 (or) Nm3','','','','']);

    // Unit hint
    data.push(['LHV and HHV','', 'MJ/Sm3 (or) kcal/Sm3 (or) MJ/kg (or) kcal/kg','','','','','']);

    // Std Temperature & molar volumes
    const stdTRow = outputsStart + 3;
    data.push(['Std Temperature (°C)', window.__fgc_state?.Tstd ?? 15,'','','','','','']);
    const molVolStdRow = stdTRow + 1;
    data.push(['Molar Volume @StdT (m³/kmol)', {t:'n', f:`8.314462618*(273.15+B${stdTRow})/101.325`},'','','','','','']);
    const molVol0Row = molVolStdRow + 1;
    data.push(['Molar Volume @0°C (m³/kmol)', {t:'n', f:`8.314462618*(273.15+0)/101.325`},'','','','','','']);

    // Mixture MJ/kg
    const lhvKgRow = molVol0Row + 1;
    const hhvKgRow = lhvKgRow + 1;
    data.push(['Mixture LHV (MJ/kg)', {t:'n', f:`IF(${sumMassExpr}=0,"",SUMPRODUCT(F${startRow}:F${endRow},G${startRow}:G${endRow})/100)`},'','','','','','']);
    data.push(['Mixture HHV (MJ/kg)', {t:'n', f:`IF(${sumMassExpr}=0,"",SUMPRODUCT(F${startRow}:F${endRow},H${startRow}:H${endRow})/100)`},'','','','','','']);

    // Mixture MJ/m3 @ StdT and @0C
    const lhvM3StdRow = hhvKgRow + 1;
    const hhvM3StdRow = lhvM3StdRow + 1;
    data.push(['Mixture LHV (MJ/m³ @StdT)', {t:'n', f:`IF(AND(SUM(${sumMoleRange})>0,B${molVolStdRow}>0),(SUMPRODUCT(D${startRow}:D${endRow},G${startRow}:G${endRow},E${startRow}:E${endRow})/SUM(${sumMoleRange}))/B${molVolStdRow},"")`},'','','','','','']);
    data.push(['Mixture HHV (MJ/m³ @StdT)', {t:'n', f:`IF(AND(SUM(${sumMoleRange})>0,B${molVolStdRow}>0),(SUMPRODUCT(D${startRow}:D${endRow},H${startRow}:H${endRow},E${startRow}:E${endRow})/SUM(${sumMoleRange}))/B${molVolStdRow},"")`},'','','','','','']);

    const lhvM3NRow = hhvM3StdRow + 1;
    const hhvM3NRow = lhvM3NRow + 1;
    data.push(['Mixture LHV (MJ/m³ @0°C)', {t:'n', f:`IF(AND(SUM(${sumMoleRange})>0,B${molVol0Row}>0),(SUMPRODUCT(D${startRow}:D${endRow},G${startRow}:G${endRow},E${startRow}:E${endRow})/SUM(${sumMoleRange}))/B${molVol0Row},"")`},'','','','','','']);
    data.push(['Mixture HHV (MJ/m³ @0°C)', {t:'n', f:`IF(AND(SUM(${sumMoleRange})>0,B${molVol0Row}>0),(SUMPRODUCT(D${startRow}:D${endRow},H${startRow}:H${endRow},E${startRow}:E${endRow})/SUM(${sumMoleRange}))/B${molVol0Row},"")`},'','','','','','']);

    // kcal conversions
    const lhvKcalKgRow = hhvM3NRow + 1;
    const hhvKcalKgRow = lhvKcalKgRow + 1;
    const lhvKcalM3StdRow = hhvKcalKgRow + 1;
    const hhvKcalM3StdRow = lhvKcalM3StdRow + 1;
    data.push(['Mixture LHV (kcal/kg)', {t:'n', f:`B${lhvKgRow}*239.005736`},'','','','','','']);
    data.push(['Mixture HHV (kcal/kg)', {t:'n', f:`B${hhvKgRow}*239.005736`},'','','','','','']);
    data.push(['Mixture LHV (kcal/m³ @StdT)', {t:'n', f:`B${lhvM3StdRow}*239.005736`},'','','','','','']);
    data.push(['Mixture HHV (kcal/m³ @StdT)', {t:'n', f:`B${hhvM3StdRow}*239.005736`},'','','','','','']);

    // MMBTU conversions
    const lhvMMBTUKgRow = hhvKcalM3StdRow + 1;
    const hhvMMBTUKgRow = lhvMMBTUKgRow + 1;
    const lhvMMBTUM3StdRow = hhvMMBTUKgRow + 1;
    const hhvMMBTUM3StdRow = lhvMMBTUM3StdRow + 1;
    data.push(['Mixture LHV (MMBTU/kg)', {t:'n', f:`B${lhvKgRow}/1055.05585`},'','','','','','']);
    data.push(['Mixture HHV (MMBTU/kg)', {t:'n', f:`B${hhvKgRow}/1055.05585`},'','','','','','']);
    data.push(['Mixture LHV (MMBTU/m³ @StdT)', {t:'n', f:`B${lhvM3StdRow}/1055.05585`},'','','','','','']);
    data.push(['Mixture HHV (MMBTU/m³ @StdT)', {t:'n', f:`B${hhvM3StdRow}/1055.05585`},'','','','','','']);

    // Quantity energy (MJ, kcal, MMBTU) based on unit in C{qtyRow}
    const qtyLHV_MJ_Row  = hhvMMBTUM3StdRow + 1;
    const qtyHHV_MJ_Row  = qtyLHV_MJ_Row + 1;
    const qtyLHV_kcal_Row = qtyHHV_MJ_Row + 1;
    const qtyHHV_kcal_Row = qtyLHV_kcal_Row + 1;
    const qtyLHV_mmbtu_Row = qtyHHV_kcal_Row + 1;
    const qtyHHV_mmbtu_Row = qtyLHV_mmbtu_Row + 1;

    data.push(['Quantity Energy LHV (MJ)', {t:'n', f:`IF(C${qtyRow}="kg",B${qtyRow}*B${lhvKgRow}, IF(C${qtyRow}="Nm3", B${qtyRow}*B${lhvM3NRow}, B${qtyRow}*B${lhvM3StdRow}))`},'','','','','','']);
    data.push(['Quantity Energy HHV (MJ)', {t:'n', f:`IF(C${qtyRow}="kg",B${qtyRow}*B${hhvKgRow}, IF(C${qtyRow}="Nm3", B${qtyRow}*B${hhvM3NRow}, B${qtyRow}*B${hhvM3StdRow}))`},'','','','','','']);
    data.push(['Quantity Energy LHV (kcal)', {t:'n', f:`B${qtyLHV_MJ_Row}*239.005736`},'','','','','','']);
    data.push(['Quantity Energy HHV (kcal)', {t:'n', f:`B${qtyHHV_MJ_Row}*239.005736`},'','','','','','']);
    data.push(['Quantity Energy LHV (MMBTU)', {t:'n', f:`B${qtyLHV_MJ_Row}/1055.05585`},'','','','','','']);
    data.push(['Quantity Energy HHV (MMBTU)', {t:'n', f:`B${qtyHHV_MJ_Row}/1055.05585`},'','','','','','']);

    // Footer & source link
    data.push(['Source: chemicalengineeringsite.in','','','','','','','']);

    // Create sheet
    const ws = XLSX.utils.aoa_to_sheet(data);
    ws['!cols'] = [{wch:30},{wch:20},{wch:18},{wch:28},{wch:10},{wch:10},{wch:12},{wch:12}];

    // Weight% formulas for each component row
    for(let i=0;i<comp.length;i++){
      const row = startRow + i;
      ws[`F${row}`] = {t:'n', f:`IF(${sumMassExpr}=0,"",(D${row}*E${row})/${sumMassExpr}*100)`};
    }

    // Link last cell
    const lastRow = data.length + 2; // header spacer offset
    ws[`A${lastRow}`] = { t:'s', v:'Source: chemicalengineeringsite.in', l:{ Target:'https://chemicalengineeringsite.in/' } };

    // Freeze header
    ws['!freeze'] = { xSplit: 0, ySplit: 2 };

    // Workbook
    const wb = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(wb, ws, 'Fuel Gas LHV-HHV');

    const ts = new Date().toISOString().slice(0,19).replace(/[:T]/g,'-');
    XLSX.writeFile(wb, `fuel_gas_lhv_hhv_${ts}.xlsx`);
  }

  document.getElementById('export').addEventListener('click', exportExcel);

  // Initial compute
  update();
})();
</script>
<!-- /Fuel Gas LHV/HHV Calculator -->

<p>The post <a href="https://chemicalengineeringsite.in/natural-gas-lhv-hhv-calculator-excel/">Natural Gas &#8211; Fuel Gas &#8211; HHV LHV Calculator</a> appeared first on <a href="https://chemicalengineeringsite.in">Chemical Engineering Site</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://chemicalengineeringsite.in/natural-gas-lhv-hhv-calculator-excel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
