<?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>variable speed pump Archives - Chemical Engineering Site</title>
	<atom:link href="https://chemicalengineeringsite.in/tag/variable-speed-pump/feed/" rel="self" type="application/rss+xml" />
	<link>https://chemicalengineeringsite.in/tag/variable-speed-pump/</link>
	<description>For Chemical Engineers</description>
	<lastBuildDate>Tue, 16 Sep 2025 14:19:26 +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>Centrifugal Pump Affinity Law Calculator</title>
		<link>https://chemicalengineeringsite.in/centrifugal-pump-affinity-law-calculator/</link>
		
		<dc:creator><![CDATA[chemicalengineeringsite]]></dc:creator>
		<pubDate>Tue, 16 Sep 2025 14:08:55 +0000</pubDate>
				<category><![CDATA[Calculators]]></category>
		<category><![CDATA[Centrifugal pump]]></category>
		<category><![CDATA[centrifugal pump calculator]]></category>
		<category><![CDATA[chemical engineering calculator]]></category>
		<category><![CDATA[flow calculation]]></category>
		<category><![CDATA[head calculation]]></category>
		<category><![CDATA[impeller diameter]]></category>
		<category><![CDATA[Pump]]></category>
		<category><![CDATA[pump affinity laws]]></category>
		<category><![CDATA[pump curve]]></category>
		<category><![CDATA[pump engineering tools]]></category>
		<category><![CDATA[pump optimization]]></category>
		<category><![CDATA[pump performance]]></category>
		<category><![CDATA[pump power]]></category>
		<category><![CDATA[pump speed]]></category>
		<category><![CDATA[variable speed pump]]></category>
		<guid isPermaLink="false">https://chemicalengineeringsite.in/?p=4065</guid>

					<description><![CDATA[<p>Pump Affinity Law Calculator — chemicalengineeringsite.in Pump Affinity Law Calculator Select Input Mode (Speed or Diameter change). Enter baseline point. Calculates new Q₂, H₂, P₂. Export to Excel with live formulas. Input Mode Speed Change Diameter Change Baseline Speed n₁ rpm Baseline Impeller Dia D₁ mmcmminch Baseline Flow Q₁ m³/sm³/hL/sgpm Baseline Head H₁ mft Baseline [&#8230;]</p>
<p>The post <a href="https://chemicalengineeringsite.in/centrifugal-pump-affinity-law-calculator/">Centrifugal Pump Affinity Law Calculator</a> appeared first on <a href="https://chemicalengineeringsite.in">Chemical Engineering Site</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Pump Affinity Law Calculator — chemicalengineeringsite.in</title>
<meta name="description" content="Compute new Flow (Q2), Head (H2), and Power (P2) for Speed or Diameter change using pump affinity laws. Export to Excel with live formulas." />
<style>
  /* === Mirror of Pump Specific Speed theme tokens & styles (psc-*) === */
  .psc-card{--b:#e6eef6;--t:#0f172a;--muted:#475569;--a:#2563eb;--bg:#ffffff;max-width:860px;margin:1.25rem auto;padding:1.25rem;border:1px solid var(--b);border-radius:16px;background:var(--bg);box-shadow:0 6px 20px rgba(2,6,23,.06)}
  .psc-title{margin:.25rem 0;font-size:1.25rem;color:var(--t)}
  .psc-sub{margin:0;color:var(--muted)}
  .psc-form{margin-top:.75rem}
  .psc-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
  @media (max-width:860px){.psc-grid{grid-template-columns:1fr}}
  .psc-field{display:flex;flex-direction:column;gap:6px}
  .psc-field span{font-weight:600;color:var(--t)}
  .psc-inline{display:flex;gap:8px;align-items:center}
  .psc-field input,.psc-field select{width:100%;padding:.6rem .7rem;border:1px solid var(--b);border-radius:10px;background:#fff;color:var(--t)}
  .psc-unit{color:var(--muted)}
  .psc-actions{display:flex;gap:10px;margin-top:.75rem;flex-wrap:wrap}
  .psc-btn{border:1px solid var(--a);background:var(--a);color:#fff;border-radius:999px;padding:.55rem .9rem;font-weight:600;cursor:pointer}
  .psc-btn-ghost{background:#fff;color:var(--a)}
  .psc-results{margin-top:1rem;border-top:1px dashed var(--b);padding-top:.9rem}
  .psc-result{display:flex;justify-content:space-between;align-items:center;margin:.35rem 0}
  .psc-result-label{color:var(--muted)}
  .psc-result-value{font-size:1.1rem;font-weight:700;color:var(--t)}
  .psc-note{margin-top:.4rem;color:#b45309}
  .psc-details{margin-top:.6rem}
  .psc-footer{margin-top:.6rem;color:var(--muted)}

  /* Radio fieldset (mirrors SSC structure) */
  .psc-fieldset{border:1px dashed var(--b);border-radius:12px;padding:.6rem .7rem;margin-bottom:.6rem}
  .psc-fieldset legend{color:var(--muted)}
  .psc-radio{display:flex;align-items:center;gap:.45rem;margin-right:1rem;color:var(--t)}
</style>
</head>
<body>

<!-- Pump Affinity Law Calculator (Radio Input Mode) + Excel Export -->
<div id="pal" class="psc-card" role="region" aria-label="Pump Affinity Law Calculator">
  <div class="psc-header">
    <h3 class="psc-title">Pump Affinity Law Calculator</h3>
    <p class="psc-sub"> Select <strong>Input Mode</strong> (Speed or Diameter change). Enter baseline point. Calculates new Q₂, H₂, P₂. Export to Excel with live formulas.</p>
  </div>

  <form class="psc-form" onsubmit="return false;">
    <!-- Input Mode Radios -->
    <fieldset class="psc-fieldset">
      <legend>Input Mode</legend>
      <div class="psc-inline" role="radiogroup" aria-label="Input mode">
        <label class="psc-radio"><input type="radio" name="pal-mode" value="speed" checked /> <span>Speed Change</span></label>
        <label class="psc-radio"><input type="radio" name="pal-mode" value="diam" /> <span>Diameter Change</span></label>
      </div>
    </fieldset>

    <!-- Baseline (Point 1) -->
    <div class="psc-grid">
      <label class="psc-field">
        <span>Baseline Speed n₁</span>
        <div class="psc-inline">
          <input id="pal-n1" type="number" step="any" min="0" placeholder="e.g., 2900" required />
          <span class="psc-unit">rpm</span>
        </div>
      </label>

      <label class="psc-field">
        <span>Baseline Impeller Dia D₁</span>
        <div class="psc-inline">
          <input id="pal-d1" type="number" step="any" min="0" placeholder="e.g., 200" required />
          <select id="pal-d1-unit" aria-label="Diameter unit">
            <option value="mm" selected>mm</option>
            <option value="cm">cm</option>
            <option value="m">m</option>
            <option value="inch">inch</option>
          </select>
        </div>
      </label>

      <label class="psc-field">
        <span>Baseline Flow Q₁</span>
        <div class="psc-inline">
          <input id="pal-q1" type="number" step="any" min="0" placeholder="e.g., 120" required />
          <select id="pal-q1-unit" aria-label="Flow unit">
            <option value="m3s">m³/s</option>
            <option value="m3h" selected>m³/h</option>
            <option value="Ls">L/s</option>
            <option value="gpm">gpm</option>
          </select>
        </div>
      </label>

      <label class="psc-field">
        <span>Baseline Head H₁</span>
        <div class="psc-inline">
          <input id="pal-h1" type="number" step="any" min="0" placeholder="e.g., 40" required />
          <select id="pal-h1-unit" aria-label="Head unit">
            <option value="m" selected>m</option>
            <option value="ft">ft</option>
          </select>
        </div>
      </label>

      <label class="psc-field">
        <span>Baseline Power P₁</span>
        <div class="psc-inline">
          <input id="pal-p1" type="number" step="any" min="0" placeholder="e.g., 22" required />
          <select id="pal-p1-unit" aria-label="Power unit">
            <option value="kW" selected>kW</option>
            <option value="HP">HP</option>
          </select>
        </div>
      </label>

      <!-- Target (Point 2) for Speed Mode -->
      <label class="psc-field" id="pal-speed-box">
        <span>New Speed n₂ (Speed Change)</span>
        <div class="psc-inline">
          <input id="pal-n2" type="number" step="any" min="0" placeholder="e.g., 1450" />
          <span class="psc-unit">rpm</span>
        </div>
      </label>

      <!-- Target (Point 2) for Diameter Mode -->
      <label class="psc-field" id="pal-diam-box" style="display:none">
        <span>New Diameter D₂ (Diameter Change)</span>
        <div class="psc-inline">
          <input id="pal-d2" type="number" step="any" min="0" placeholder="e.g., 180" />
          <select id="pal-d2-unit" aria-label="Diameter unit">
            <option value="mm" selected>mm</option>
            <option value="cm">cm</option>
            <option value="m">m</option>
            <option value="inch">inch</option>
          </select>
        </div>
      </label>
    </div>

    <div class="psc-actions">
      <button type="button" id="pal-calc" class="psc-btn">Calculate</button>
      <button type="button" id="pal-export" class="psc-btn psc-btn-ghost" 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>
      <button type="button" id="pal-reset" class="psc-btn psc-btn-ghost">Reset</button>
      <button type="button" id="pal-copy" class="psc-btn psc-btn-ghost" title="Copy results">Copy</button>
    </div>
  </form>

  <div class="psc-results" aria-live="polite">
    <div class="psc-result"><div class="psc-result-label">Mode</div><div class="psc-result-value"><span id="pal-mode-label">Speed Change</span></div></div>
    <div class="psc-result"><div class="psc-result-label">Ratio used (r)</div><div class="psc-result-value"><span id="pal-ratio">–</span></div></div>
    <div class="psc-result"><div class="psc-result-label">New Flow Q₂</div><div class="psc-result-value"><span id="pal-q2">–</span> <span id="pal-q2-unit">m³/h</span></div></div>
    <div class="psc-result"><div class="psc-result-label">New Head H₂</div><div class="psc-result-value"><span id="pal-h2">–</span> <span id="pal-h2-unit">m</span></div></div>
    <div class="psc-result"><div class="psc-result-label">New Power P₂</div><div class="psc-result-value"><span id="pal-p2">–</span> <span id="pal-p2-unit">kW</span></div></div>
    <div id="pal-note" class="psc-note"></div>
  </div>

  <details class="psc-details">
    <summary>Formulas, units &#038; assumptions</summary>
    <ul>
      <li><b>Speed Change (D constant):</b> Q₂ = Q₁·(n₂/n₁), H₂ = H₁·(n₂/n₁)², P₂ = P₁·(n₂/n₁)³</li>
      <li><b>Diameter Change (n constant):</b> Q₂ = Q₁·(D₂/D₁), H₂ = H₁·(D₂/D₁)², P₂ = P₁·(D₂/D₁)³</li>
      <li>Results shown in the <em>same units</em> as inputs (Flow: m³/s, m³/h, L/s, gpm; Head: m, ft; Power: kW, HP; Diameter: mm, cm, m, inch).</li>
      <li>Assumes constant efficiency. For large changes, verify with pump curves.</li>
    </ul>
  </details>

  <footer class="psc-footer">
    <small>Credit: <a href="https://chemicalengineeringsite.in/" target="_blank" rel="noopener">chemicalengineeringsite.in</a></small>
  </footer>
</div>

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

<script>
(function(){
  const $ = id => document.getElementById(id);
  const byName = n => Array.from(document.getElementsByName(n));

  const EL = {
    // mode
    modeVal: () => (document.querySelector('input[name="pal-mode"]:checked')?.value || 'speed'),
    speedBox: $('pal-speed-box'),
    diamBox:  $('pal-diam-box'),
    modeLabel: $('pal-mode-label'),

    // baseline
    n1: $('pal-n1'),
    d1: $('pal-d1'), d1u: $('pal-d1-unit'),
    q1: $('pal-q1'), q1u: $('pal-q1-unit'),
    h1: $('pal-h1'), h1u: $('pal-h1-unit'),
    p1: $('pal-p1'), p1u: $('pal-p1-unit'),

    // targets
    n2: $('pal-n2'),
    d2: $('pal-d2'), d2u: $('pal-d2-unit'),

    // actions
    calc: $('pal-calc'),
    reset: $('pal-reset'),
    copy: $('pal-copy'),
    export: $('pal-export'),

    // outputs
    ratio: $('pal-ratio'),
    q2: $('pal-q2'), q2u: $('pal-q2-unit'),
    h2: $('pal-h2'), h2u: $('pal-h2-unit'),
    p2: $('pal-p2'), p2u: $('pal-p2-unit'),

    note: $('pal-note')
  };

  // === Unit helpers ===
  function D_to_m(v,u){ if(!isFinite(v))return NaN; if(u==='mm')return v/1000; if(u==='cm')return v/100; if(u==='m')return v; if(u==='inch')return v*0.0254; return NaN; }
  // Use m3/h as internal base
  function Q_to_m3h(v,u){ if(!isFinite(v))return NaN; if(u==='m3h')return v; if(u==='m3s')return v*3600; if(u==='Ls')return v*3.6; if(u==='gpm')return v*0.227124707; return NaN; }
  function Q_from_m3h(v,u){ if(u==='m3h')return v; if(u==='m3s')return v/3600; if(u==='Ls')return v/3.6; if(u==='gpm')return v/0.227124707; return NaN; }
  function H_to_m(v,u){ return u==='ft' ? v*0.3048 : v; }
  function H_from_m(v,u){ return u==='ft' ? v/0.3048 : v; }
  function P_to_kW(v,u){ return u==='HP' ? v*0.745699872 : v; }
  function P_from_kW(v,u){ return u==='HP' ? v/0.745699872 : v; }
  function flowLabel(u){ return u==='m3s'?'m³/s':(u==='m3h'?'m³/h':(u==='Ls'?'L/s':(u==='gpm'?'gpm':u))); }
  function round(v,dp){ if(!isFinite(v)) return '–'; const f=Math.pow(10,dp); return (Math.round(v*f)/f).toFixed(dp); }

  // === Mode UI toggle ===
  function updateModeUI(){
    const mode = EL.modeVal();
    const isSpeed = mode === 'speed';
    EL.speedBox.style.display = isSpeed ? '' : 'none';
    EL.diamBox.style.display  = isSpeed ? 'none' : '';
    EL.modeLabel.textContent  = isSpeed ? 'Speed Change' : 'Diameter Change';
    clearOutputs();
    EL.note.textContent = '';
  }
  byName('pal-mode').forEach(r => r.addEventListener('change', updateModeUI));

  // === Calculate ===
  let last = null; // for export/copy
  function calculate(){
    // baseline
    const n1 = Number(EL.n1.value);
    const d1v= Number(EL.d1.value);
    const q1v= Number(EL.q1.value);
    const h1v= Number(EL.h1.value);
    const p1v= Number(EL.p1.value);

    if (![n1,d1v,q1v,h1v,p1v].every(x => isFinite(x) && x>0)){
      clearOutputs();
      EL.note.textContent = 'Enter positive values for all baseline inputs.';
      return;
    }

    const d1_m   = D_to_m(d1v, EL.d1u.value);
    const q1_m3h = Q_to_m3h(q1v, EL.q1u.value);
    const h1_m   = H_to_m(h1v, EL.h1u.value);
    const p1_kW  = P_to_kW(p1v, EL.p1u.value);
    if (![d1_m,q1_m3h,h1_m,p1_kW].every(isFinite)){
      clearOutputs();
      EL.note.textContent = 'Check unit selections.';
      return;
    }

    // ratio r
    let r;
    if (EL.modeVal()==='speed'){
      const n2 = Number(EL.n2.value);
      if (!isFinite(n2) || n2<=0){ clearOutputs(); EL.note.textContent='Enter positive value for new speed n₂.'; return; }
      r = n2/n1;
    } else {
      const d2v = Number(EL.d2.value);
      if (!isFinite(d2v) || d2v<=0){ clearOutputs(); EL.note.textContent='Enter positive value for new diameter D₂.'; return; }
      const d2_m = D_to_m(d2v, EL.d2u.value);
      if (!isFinite(d2_m) || d2_m<=0){ clearOutputs(); EL.note.textContent='Check D₂ unit.'; return; }
      r = d2_m/d1_m;
    }

    // affinity laws
    const q2_m3h = q1_m3h * r;
    const h2_m   = h1_m   * (r*r);
    const p2_kW  = p1_kW  * (r*r*r);

    // display in input units
    const q2_disp = Q_from_m3h(q2_m3h, EL.q1u.value);
    const h2_disp = H_from_m(h2_m, EL.h1u.value);
    const p2_disp = P_from_kW(p2_kW, EL.p1u.value);

    EL.ratio.textContent = round(r,4);
    EL.q2.textContent    = round(q2_disp,3);
    EL.q2u.textContent   = flowLabel(EL.q1u.value);
    EL.h2.textContent    = round(h2_disp,3);
    EL.h2u.textContent   = EL.h1u.value;
    EL.p2.textContent    = round(p2_disp,3);
    EL.p2u.textContent   = EL.p1u.value;
    EL.note.textContent  = '';

    last = {
      mode: EL.modeVal(),
      n1, d1:d1v, d1u:EL.d1u.value, q1:q1v, q1u:EL.q1u.value, h1:h1v, h1u:EL.h1u.value, p1:p1v, p1u:EL.p1u.value,
      n2: EL.modeVal()==='speed' ? Number(EL.n2.value) : '',
      d2: EL.modeVal()==='diam'  ? Number(EL.d2.value) : '',
      d2u:EL.modeVal()==='diam'  ? EL.d2u.value : '',
      r, q2:q2_disp, h2:h2_disp, p2:p2_disp
    };
  }

  // === Misc helpers ===
  function clearOutputs(){
    EL.ratio.textContent='–'; EL.q2.textContent='–'; EL.h2.textContent='–'; EL.p2.textContent='–';
    EL.q2u.textContent=flowLabel(EL.q1u.value); EL.h2u.textContent=EL.h1u.value; EL.p2u.textContent=EL.p1u.value;
  }
  function resetAll(){
    EL.n1.value=''; EL.d1.value=''; EL.q1.value=''; EL.h1.value=''; EL.p1.value='';
    EL.n2.value=''; EL.d2.value='';
    EL.d1u.value='mm'; if(EL.d2u) EL.d2u.value='mm';
    EL.q1u.value='m3h'; EL.h1u.value='m'; EL.p1u.value='kW';
    clearOutputs(); EL.note.textContent=''; last=null;
    updateModeUI();
  }
  function copyResults(){
    const txt = `Pump Affinity Law Results
Mode: ${EL.modeVal()==='speed'?'Speed Change':'Diameter Change'}
r: ${EL.ratio.textContent}
Q2: ${EL.q2.textContent} ${EL.q2u.textContent}
H2: ${EL.h2.textContent} ${EL.h2u.textContent}
P2: ${EL.p2.textContent} ${EL.p2u.textContent}`;
    navigator.clipboard?.writeText(txt).then(()=>{
      EL.note.style.color='#16a34a'; EL.note.textContent='Results copied.'; setTimeout(()=>{EL.note.textContent=''; EL.note.style.color='';},1400);
    }).catch(()=>{ EL.note.style.color='#b45309'; EL.note.textContent='Copy failed. Select and copy manually.'; });
  }

  // === Excel export (live formulas; unit strings aligned: m3h/m3s/Ls/gpm) ===
  function exportExcel(){
    const s = last || {};
    const modeStr = s.mode==='diam' ? 'Diameter Change' : 'Speed Change';

    const A = [
      ['Pump Affinity Law Calculator','','','',''],
      ['','','','',''],
      ['Mode', modeStr,'','',''],

      ['n1 (rpm)', s.n1||'','','',''],
      ['D1 (value)', s.d1||'','Unit', s.d1u||'mm',''],
      ['Q1 (value)', s.q1||'','Unit', s.q1u||'m3h',''],
      ['H1 (value)', s.h1||'','Unit', s.h1u||'m',''],
      ['P1 (value)', s.p1||'','Unit', s.p1u||'kW',''],

      ['','','','',''],
      ['Target (Change to)','','','',''],
      ['n2 (rpm; Speed Change)', s.mode==='speed'?(s.n2||''):'','','',''],
      ['D2 (value; Diameter Change)', s.mode==='diam'?(s.d2||''):'','Unit', s.mode==='diam'?(s.d2u||'mm'):'',''],

      ['','','','',''],
      ['Conversions (auto)','','','',''],
      ['D1_m','','','',''],
      ['D2_m','','','',''],
      ['Q1_m3h','','','',''],
      ['H1_m','','','',''],
      ['P1_kW','','','',''],

      ['','','','',''],
      ['Ratio r','','','',''],
      ['r (by mode)','','','',''],

      ['','','','',''],
      ['Outputs (base units)','','','',''],
      ['Q2 (m3/h)','','','',''],
      ['H2 (m)','','','',''],
      ['P2 (kW)','','','',''],

      ['','','','',''],
      ['Reported in same units as inputs','','','',''],
      ['Q2 (same unit as Q1)','','','Unit',''],
      ['H2 (same unit as H1)','','','Unit',''],
      ['P2 (same unit as P1)','','','Unit',''],

      ['','','','',''],
      ['Source: chemicalengineeringsite.in','','','','']
    ];

    const ws = XLSX.utils.aoa_to_sheet(A);
    ws['!cols'] = [{wch:34},{wch:18},{wch:10},{wch:12},{wch:14}];
    ws['!freeze'] = { xSplit:1, ySplit:9 };

    // Helper: find row index by matching the label in column A
    function rowOf(label){
      for (const addr in ws){
        if (!/^[A-Z]+[0-9]+$/.test(addr)) continue;
        const c = ws[addr];
        if (addr.startsWith('A') && c && c.v === label) {
          return parseInt(addr.replace(/^[A-Z]+/,''),10);
        }
      }
      return null;
    }
    const setB = (r, f) => ws['B'+r] = {t:'n', f};

    // Find rows
    const rMode = rowOf('Mode');

    const rN1  = rowOf('n1 (rpm)');
    const rD1  = rowOf('D1 (value)');
    const rQ1  = rowOf('Q1 (value)');
    const rH1  = rowOf('H1 (value)');
    const rP1  = rowOf('P1 (value)');

    const rN2  = rowOf('n2 (rpm; Speed Change)');
    const rD2  = rowOf('D2 (value; Diameter Change)');

    const rD1m = rowOf('D1_m');
    const rD2m = rowOf('D2_m');
    const rQ1h = rowOf('Q1_m3h');
    const rH1m = rowOf('H1_m');
    const rP1k = rowOf('P1_kW');

    const rR   = rowOf('r (by mode)');

    const rQ2b = rowOf('Q2 (m3/h)');
    const rH2b = rowOf('H2 (m)');
    const rP2b = rowOf('P2 (kW)');

    const rQ2u = rowOf('Q2 (same unit as Q1)');
    const rH2u = rowOf('H2 (same unit as H1)');
    const rP2u = rowOf('P2 (same unit as P1)');

    // --- Conversions (B-column formulas) ---
    setB(rD1m, `B${rD1}*IF(D${rD1}="mm",1/1000,IF(D${rD1}="cm",1/100,IF(D${rD1}="m",1,IF(D${rD1}="inch",0.0254,""))))`);
    setB(rD2m, `IF(B${rD2}="", "", B${rD2}*IF(D${rD2}="mm",1/1000,IF(D${rD2}="cm",1/100,IF(D${rD2}="m",1,IF(D${rD2}="inch",0.0254,"")))))`);

    /* FIXED: compare with m3h/m3s (no slash) */
    setB(rQ1h, `B${rQ1}*IF(D${rQ1}="m3h",1,IF(D${rQ1}="m3s",3600,IF(D${rQ1}="Ls",3.6,IF(D${rQ1}="gpm",0.227124707,""))))`);
    setB(rH1m, `B${rH1}*IF(D${rH1}="m",1,IF(D${rH1}="ft",0.3048,""))`);
    setB(rP1k, `B${rP1}*IF(D${rP1}="kW",1,IF(D${rP1}="HP",0.745699872,""))`);

    // --- Ratio r ---
    setB(rR, `IF(B${rMode}="Diameter Change", IF(B${rD2m}<=0,"", IF(B${rD1m}<=0,"", B${rD2m}/B${rD1m})), IF(B${rN1}<=0,"", IF(B${rN2}<=0,"", B${rN2}/B${rN1})))`);

    // --- Outputs (base units) ---
    setB(rQ2b, `IF(B${rR}="","", B${rQ1h}*B${rR})`);
    setB(rH2b, `IF(B${rR}="","", B${rH1m}*POWER(B${rR},2))`);
    setB(rP2b, `IF(B${rR}="","", B${rP1k}*POWER(B${rR},3))`);

    // --- Reported in same units as inputs ---
    /* FIXED to use m3h/m3s */
    setB(rQ2u, `IF(B${rQ2b}="","", B${rQ2b}*IF(D${rQ1}="m3h",1,IF(D${rQ1}="m3s",1/3600,IF(D${rQ1}="Ls",1/3.6,IF(D${rQ1}="gpm",1/0.227124707,"")))))`);
    ws['E'+rQ2u] = { t:'s', f:`IF(D${rQ1}="","",D${rQ1})` };

    setB(rH2u, `IF(B${rH2b}="","", B${rH2b}*IF(D${rH1}="m",1,IF(D${rH1}="ft",1/0.3048,"")))`);
    ws['E'+rH2u] = { t:'s', f:`IF(D${rH1}="","",D${rH1})` };

    setB(rP2u, `IF(B${rP2b}="","", B${rP2b}*IF(D${rP1}="kW",1,IF(D${rP1}="HP",1/0.745699872,"")))`);
    ws['E'+rP2u] = { t:'s', f:`IF(D${rP1}="","",D${rP1})` };

    // Make the source clickable
    const lastRow = Math.max(...Object.keys(ws).filter(k=>/^[A-Z]+\d+$/.test(k)).map(k=>+k.replace(/^[A-Z]+/,'')));
    ws['A'+lastRow] = { t:'s', v:'Source: chemicalengineeringsite.in', l:{ Target:'https://chemicalengineeringsite.in/' } };

    const wb = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(wb, ws, 'Affinity Laws');

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

  // === Wire-up ===
  EL.calc.addEventListener('click', calculate);
  EL.reset.addEventListener('click', resetAll);
  EL.copy.addEventListener('click', copyResults);
  EL.export.addEventListener('click', exportExcel);
  ['pal-n1','pal-d1','pal-q1','pal-h1','pal-p1','pal-n2','pal-d2'].forEach(id=>{
    const node=$(id); if(!node) return;
    node.addEventListener('keydown', e=>{ if(e.key==='Enter'){ e.preventDefault(); calculate(); } });
  });

  // Init
  updateModeUI();
  clearOutputs();
})();
</script>
</body>
</html>




<p></p>
<p>The post <a href="https://chemicalengineeringsite.in/centrifugal-pump-affinity-law-calculator/">Centrifugal Pump Affinity Law Calculator</a> appeared first on <a href="https://chemicalengineeringsite.in">Chemical Engineering Site</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
