stlin Claude Sonnet 4.6 commited on
Commit
f11ec42
Β·
1 Parent(s): cf1e6cc

NRTL tab UI refinements

Browse files

- Add subscript ij to all parameter labels (aij, bij, cij, dij, eij, fij,
tauij, alphaij) throughout the form, parameter table, and chart legends
- Show all verification plots stacked vertically (one per temperature)
instead of a single dropdown-selected chart
- CSV always includes all six parameters with default values for unfitted
ones; tau equation row now shows the complete expression
tau_ij(T) = a_ij + b_ij/T + e_ij*ln(T) + f_ij*T

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. frontend/index.html +107 -95
frontend/index.html CHANGED
@@ -676,10 +676,11 @@
676
  <h2>NRTL Parameter Fitting for Aspen Plus</h2>
677
  <p style="font-size:0.85rem;color:#4a5568;margin-bottom:1.25rem;line-height:1.6">
678
  Fits Aspen Plus NRTL binary interaction parameters over a temperature range using
679
- TeNNet-SAC predictions. Parameters <b>a</b> and <b>b</b> are always fitted.
680
- Use the checkboxes below to optionally include <b>c</b>, <b>d</b>, <b>e</b>, <b>f</b>.<br>
681
  <span style="font-family:monospace;font-size:0.82rem">
682
- Ο„(T) = a + b/T [+ eΒ·ln T] [+ fΒ·T] &nbsp;|&nbsp; Ξ±(T) = c + dΒ·(T βˆ’ 273.15 K)
 
683
  </span>
684
  </p>
685
 
@@ -718,11 +719,11 @@
718
  <!-- c and d fixed values -->
719
  <div class="form-row">
720
  <div class="form-group">
721
- <label for="nrtl-c">c β€” non-randomness base (NRTL-3)</label>
722
  <input type="number" id="nrtl-c" value="0.3" min="0.01" max="0.65" step="0.01" />
723
  </div>
724
  <div class="form-group">
725
- <label for="nrtl-d">d β€” T-coefficient of Ξ± (K⁻¹)</label>
726
  <input type="number" id="nrtl-d" value="0" step="0.0001" />
727
  </div>
728
  </div>
@@ -733,23 +734,23 @@
733
  <div class="nrtl-checks">
734
  <label class="check-item">
735
  <input type="checkbox" id="nrtl-fit-c" onchange="nrtlSyncCD()">
736
- <span><b>c</b></span>
737
- <span class="check-hint">optimise Ξ± base value</span>
738
  </label>
739
  <label class="check-item">
740
  <input type="checkbox" id="nrtl-fit-d" onchange="nrtlSyncCD()">
741
- <span><b>d</b></span>
742
- <span class="check-hint">Ξ± temperature-dependent (implies fit c)</span>
743
  </label>
744
  <label class="check-item">
745
  <input type="checkbox" id="nrtl-fit-e">
746
- <span><b>e</b></span>
747
- <span class="check-hint">add eΒ·ln(T) term to Ο„(T)</span>
748
  </label>
749
  <label class="check-item">
750
  <input type="checkbox" id="nrtl-fit-f">
751
- <span><b>f</b></span>
752
- <span class="check-hint">add fΒ·T term to Ο„(T)</span>
753
  </label>
754
  </div>
755
  </div>
@@ -784,18 +785,13 @@
784
  <h3 style="margin-top:1.25rem">Ο„(T) Regression</h3>
785
  <div class="chart-container"><canvas id="nrtl-tau-chart"></canvas></div>
786
 
787
- <!-- Verification chart -->
788
- <h3 style="margin-top:1.25rem">
789
- Verification β€” TeNNet-SAC vs NRTL at&nbsp;
790
- <select id="nrtl-T-sel" onchange="renderNrtlVerif()"
791
- style="font-size:0.95rem;border:1px solid #cbd5e0;border-radius:4px;padding:0.15rem 0.5rem;color:#2d3748"></select>
792
- </h3>
793
- <div class="chart-container"><canvas id="nrtl-verif-chart"></canvas></div>
794
 
795
  <div class="export-row">
796
  <button class="btn-export" onclick="downloadNrtlCSV()">&#8595; Parameters CSV</button>
797
  <button class="btn-export" onclick="downloadNrtlTauPNG()">&#8595; Ο„(T) PNG</button>
798
- <button class="btn-export" onclick="downloadNrtlVerifPNG()">&#8595; Verification PNG</button>
799
  </div>
800
  </div>
801
 
@@ -866,7 +862,7 @@
866
  let multiProfileChartInst = null;
867
  let multiSegacChartInst = null;
868
  let nrtlTauChartInst = null;
869
- let nrtlVerifChartInst = null;
870
 
871
  // ── Cached data for export ────────────────────────────────────────────────
872
  let lastProfileData = null; // { smiles, sigma, p_sigma, area, volume }
@@ -1801,25 +1797,25 @@
1801
  // Parameter table
1802
  const { fit12, fit21, c, d, fit_e, fit_f, fit_d } = data;
1803
  const f = (v, n=6) => v.toFixed(n);
1804
- let tauForm = "a + b/T" + (fit_e ? " + eΒ·ln(T)" : "") + (fit_f ? " + fΒ·T" : "");
 
 
1805
  let alphaForm = (d !== 0 || fit_d)
1806
- ? `Ξ±(T) = ${c.toFixed(4)} + ${d.toFixed(6)}Β·(Tβˆ’273.15)`
1807
- : `Ξ± = ${c.toFixed(4)}`;
1808
-
1809
- let prows = `
1810
- <tr><td>a &nbsp;<small>(NRTL-1)</small></td><td>${f(fit12.a)}</td><td>${f(fit21.a)}</td></tr>
1811
- <tr><td>b &nbsp;<small>(NRTL-2, K)</small></td><td>${f(fit12.b,4)}</td><td>${f(fit21.b,4)}</td></tr>`;
1812
- if (fit_e)
1813
- prows += `<tr><td>e &nbsp;<small>(NRTL-4)</small></td><td>${f(fit12.e)}</td><td>${f(fit21.e)}</td></tr>`;
1814
- if (fit_f)
1815
- prows += `<tr><td>f &nbsp;<small>(NRTL-5, K⁻¹)</small></td><td>${f(fit12.f,8)}</td><td>${f(fit21.f,8)}</td></tr>`;
1816
- prows += `<tr><td>c &nbsp;<small>(NRTL-3, Ξ± base)</small></td><td colspan="2" style="text-align:center">${f(c)}</td></tr>`;
1817
- if (d !== 0 || fit_d)
1818
- prows += `<tr><td>d &nbsp;<small>(T-coeff of α, K⁻¹)</small></td><td colspan="2" style="text-align:center">${f(d,8)}</td></tr>`;
1819
 
1820
  document.getElementById("nrtl-param-wrap").innerHTML = `
1821
  <p style="font-size:0.82rem;color:#4a5568;margin-bottom:0.5rem">
1822
- <b>Ο„(T)</b> = ${tauForm} &nbsp;|&nbsp; <b>${alphaForm}</b>
1823
  </p>
1824
  <table class="nrtl-param-table">
1825
  <thead><tr>
@@ -1844,10 +1840,7 @@
1844
  // Ο„(T) chart
1845
  renderNrtlTauChart(data, s1, s2);
1846
 
1847
- // Verification selector + chart
1848
- const sel = document.getElementById("nrtl-T-sel");
1849
- sel.innerHTML = data.verification.map((v,i) =>
1850
- `<option value="${i}">${v.T.toFixed(1)} K</option>`).join("");
1851
  renderNrtlVerif();
1852
  }
1853
 
@@ -1920,66 +1913,91 @@
1920
 
1921
  function renderNrtlVerif() {
1922
  if (!lastNrtlData) return;
1923
- const idx = parseInt(document.getElementById("nrtl-T-sel").value);
1924
- const v = lastNrtlData.verification[idx];
1925
- const c1 = "steelblue", c2 = "tomato";
1926
- const hasStd = v.lng1_std.some(s=>s>0) || v.lng2_std.some(s=>s>0);
1927
-
1928
- const datasets = [
1929
- { label:"ln(γ₁) TeNNet-SAC", type:"scatter",
1930
- data: v.x1.map((x,i)=>({x,y:v.lng1_ts[i]})),
1931
- backgroundColor:c1, pointRadius:5, order:2,
1932
- errorBars: hasStd ? v.lng1_std : null },
1933
- { label:"ln(Ξ³β‚‚) TeNNet-SAC", type:"scatter",
1934
- data: v.x1.map((x,i)=>({x,y:v.lng2_ts[i]})),
1935
- backgroundColor:c2, pointRadius:5, order:2,
1936
- errorBars: hasStd ? v.lng2_std : null },
1937
- { label:`ln(γ₁) NRTL (τ₁₂=${v.tau12.toFixed(3)})`, type:"line",
1938
- data: v.x1_nrtl.map((x,i)=>({x,y:v.lng1_nrtl[i]})),
1939
- borderColor:c1, borderWidth:2, pointRadius:0, fill:false, order:1 },
1940
- { label:`ln(Ξ³β‚‚) NRTL (τ₂₁=${v.tau21.toFixed(3)})`, type:"line",
1941
- data: v.x1_nrtl.map((x,i)=>({x,y:v.lng2_nrtl[i]})),
1942
- borderColor:c2, borderWidth:2, pointRadius:0, fill:false, order:1 },
1943
- ];
1944
-
1945
- if (nrtlVerifChartInst) nrtlVerifChartInst.destroy();
1946
- nrtlVerifChartInst = new Chart(
1947
- document.getElementById("nrtl-verif-chart").getContext("2d"),
1948
- { type:"scatter", data:{datasets}, plugins:[nrtlErrBarPlugin],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1949
  options:{ responsive:true, maintainAspectRatio:false,
1950
- plugins:{
1951
- legend:{position:"top"},
1952
- title:{display:true, text:`T = ${v.T.toFixed(1)} K Ξ± = ${v.alpha.toFixed(4)}`}
1953
- },
1954
  scales:{
1955
- x:{ type:"linear", min:0, max:1, title:{display:true,text:"x₁"} },
1956
- y:{ title:{display:true,text:"ln Ξ³"} }
 
1957
  }
1958
  }
1959
- }
1960
- );
 
1961
  }
1962
 
1963
  function downloadNrtlCSV() {
1964
  if (!lastNrtlData) return;
1965
  const d = lastNrtlData;
1966
  const s1 = d._smiles1 || "comp1", s2 = d._smiles2 || "comp2";
1967
- const fe = d.fit_e, ff = d.fit_f, fd = d.fit_d;
1968
- const tauForm = "a + b/T" + (fe?" + eΒ·ln(T)":"") + (ff?" + fΒ·T":"");
1969
- const alphaForm = (fd||d.d!==0) ? `c + d*(T-273.15)` : `c (constant)`;
1970
  let csv = "# NRTL Parameters for Aspen Plus\n";
1971
- csv += `# Component i,${s1}\n# Component j,${s2}\n`;
 
1972
  csv += `# T range,${d.temperatures[0].toFixed(1)} - ${d.temperatures[d.temperatures.length-1].toFixed(1)} K\n`;
1973
- csv += `# tau(T) form,${tauForm}\n# alpha(T) form,${alphaForm}\n`;
1974
- csv += `# Fit mode,${d.mode}\n# RMSE ln(gamma),${d.rmse_lng.toFixed(6)}\n\n`;
1975
- csv += "Parameter,i->j,j->i\n";
1976
- csv += `a (NRTL-1),${d.fit12.a.toFixed(8)},${d.fit21.a.toFixed(8)}\n`;
1977
- csv += `b (NRTL-2) [K],${d.fit12.b.toFixed(6)},${d.fit21.b.toFixed(6)}\n`;
1978
- if (fe) csv += `e (NRTL-4),${d.fit12.e.toFixed(8)},${d.fit21.e.toFixed(8)}\n`;
1979
- if (ff) csv += `f (NRTL-5) [1/K],${d.fit12.f.toFixed(10)},${d.fit21.f.toFixed(10)}\n`;
1980
- csv += `c (NRTL-3),${d.c.toFixed(8)},${d.c.toFixed(8)}\n`;
1981
- if (fd||d.d!==0) csv += `d (T-coeff alpha) [1/K],${d.d.toFixed(10)},${d.d.toFixed(10)}\n`;
1982
- csv += `\n# Stage 1 - tau values at each temperature\nT (K),tau12,tau21,RMSE_lng\n`;
 
 
1983
  d.temperatures.forEach((T,i) => {
1984
  csv += `${T.toFixed(2)},${d.tau12_pts[i].toFixed(6)},${d.tau21_pts[i].toFixed(6)},${d.rmse_pts[i].toFixed(6)}\n`;
1985
  });
@@ -1996,12 +2014,6 @@
1996
  a.href = nrtlTauChartInst.toBase64Image();
1997
  a.download = "nrtl_tau_regression.png"; a.click();
1998
  }
1999
- function downloadNrtlVerifPNG() {
2000
- if (!nrtlVerifChartInst) return;
2001
- const a = document.createElement("a");
2002
- a.href = nrtlVerifChartInst.toBase64Image();
2003
- a.download = "nrtl_verification.png"; a.click();
2004
- }
2005
 
2006
  </script>
2007
  </body>
 
676
  <h2>NRTL Parameter Fitting for Aspen Plus</h2>
677
  <p style="font-size:0.85rem;color:#4a5568;margin-bottom:1.25rem;line-height:1.6">
678
  Fits Aspen Plus NRTL binary interaction parameters over a temperature range using
679
+ TeNNet-SAC predictions. Parameters <b>a<sub>ij</sub></b> and <b>b<sub>ij</sub></b> are always fitted.
680
+ Use the checkboxes below to optionally include <b>c<sub>ij</sub></b>, <b>d<sub>ij</sub></b>, <b>e<sub>ij</sub></b>, <b>f<sub>ij</sub></b>.<br>
681
  <span style="font-family:monospace;font-size:0.82rem">
682
+ Ο„<sub>ij</sub>(T) = a<sub>ij</sub> + b<sub>ij</sub>/T [+ e<sub>ij</sub>Β·ln T] [+ f<sub>ij</sub>Β·T]
683
+ &nbsp;|&nbsp; Ξ±<sub>ij</sub>(T) = c<sub>ij</sub> + d<sub>ij</sub>Β·(T βˆ’ 273.15 K)
684
  </span>
685
  </p>
686
 
 
719
  <!-- c and d fixed values -->
720
  <div class="form-row">
721
  <div class="form-group">
722
+ <label for="nrtl-c">c<sub>ij</sub> β€” non-randomness base (NRTL-3)</label>
723
  <input type="number" id="nrtl-c" value="0.3" min="0.01" max="0.65" step="0.01" />
724
  </div>
725
  <div class="form-group">
726
+ <label for="nrtl-d">d<sub>ij</sub> β€” T-coefficient of Ξ±<sub>ij</sub> (K⁻¹)</label>
727
  <input type="number" id="nrtl-d" value="0" step="0.0001" />
728
  </div>
729
  </div>
 
734
  <div class="nrtl-checks">
735
  <label class="check-item">
736
  <input type="checkbox" id="nrtl-fit-c" onchange="nrtlSyncCD()">
737
+ <span><b>c<sub>ij</sub></b></span>
738
+ <span class="check-hint">optimise Ξ±<sub>ij</sub> base value</span>
739
  </label>
740
  <label class="check-item">
741
  <input type="checkbox" id="nrtl-fit-d" onchange="nrtlSyncCD()">
742
+ <span><b>d<sub>ij</sub></b></span>
743
+ <span class="check-hint">Ξ±<sub>ij</sub> temperature-dependent (implies fit c<sub>ij</sub>)</span>
744
  </label>
745
  <label class="check-item">
746
  <input type="checkbox" id="nrtl-fit-e">
747
+ <span><b>e<sub>ij</sub></b></span>
748
+ <span class="check-hint">add e<sub>ij</sub>Β·ln(T) term to Ο„<sub>ij</sub>(T)</span>
749
  </label>
750
  <label class="check-item">
751
  <input type="checkbox" id="nrtl-fit-f">
752
+ <span><b>f<sub>ij</sub></b></span>
753
+ <span class="check-hint">add f<sub>ij</sub>Β·T term to Ο„<sub>ij</sub>(T)</span>
754
  </label>
755
  </div>
756
  </div>
 
785
  <h3 style="margin-top:1.25rem">Ο„(T) Regression</h3>
786
  <div class="chart-container"><canvas id="nrtl-tau-chart"></canvas></div>
787
 
788
+ <!-- Verification charts β€” all temperatures -->
789
+ <h3 style="margin-top:1.25rem">Verification β€” TeNNet-SAC vs NRTL (all temperatures)</h3>
790
+ <div id="nrtl-verif-wrap"></div>
 
 
 
 
791
 
792
  <div class="export-row">
793
  <button class="btn-export" onclick="downloadNrtlCSV()">&#8595; Parameters CSV</button>
794
  <button class="btn-export" onclick="downloadNrtlTauPNG()">&#8595; Ο„(T) PNG</button>
 
795
  </div>
796
  </div>
797
 
 
862
  let multiProfileChartInst = null;
863
  let multiSegacChartInst = null;
864
  let nrtlTauChartInst = null;
865
+ let nrtlVerifChartInsts = [];
866
 
867
  // ── Cached data for export ────────────────────────────────────────────────
868
  let lastProfileData = null; // { smiles, sigma, p_sigma, area, volume }
 
1797
  // Parameter table
1798
  const { fit12, fit21, c, d, fit_e, fit_f, fit_d } = data;
1799
  const f = (v, n=6) => v.toFixed(n);
1800
+ let tauForm = "a<sub>ij</sub> + b<sub>ij</sub>/T" +
1801
+ (fit_e ? " + e<sub>ij</sub>Β·ln(T)" : "") +
1802
+ (fit_f ? " + f<sub>ij</sub>Β·T" : "");
1803
  let alphaForm = (d !== 0 || fit_d)
1804
+ ? `Ξ±<sub>ij</sub>(T) = ${c.toFixed(4)} + ${d.toFixed(6)}Β·(Tβˆ’273.15)`
1805
+ : `Ξ±<sub>ij</sub> = ${c.toFixed(4)}`;
1806
+
1807
+ // Always show all six parameters; unfitted ones show default value
1808
+ const prows = `
1809
+ <tr><td>a<sub>ij</sub> &nbsp;<small>(NRTL-1)</small></td><td>${f(fit12.a)}</td><td>${f(fit21.a)}</td></tr>
1810
+ <tr><td>b<sub>ij</sub> &nbsp;<small>(NRTL-2, K)</small></td><td>${f(fit12.b,4)}</td><td>${f(fit21.b,4)}</td></tr>
1811
+ <tr><td>c<sub>ij</sub> &nbsp;<small>(NRTL-3, Ξ±<sub>ij</sub> base)</small></td><td colspan="2" style="text-align:center">${f(c)}</td></tr>
1812
+ <tr><td>d<sub>ij</sub> &nbsp;<small>(T-coeff of α<sub>ij</sub>, K⁻¹)</small></td><td colspan="2" style="text-align:center">${f(d,8)}</td></tr>
1813
+ <tr><td>e<sub>ij</sub> &nbsp;<small>(NRTL-4)</small></td><td>${f(fit12.e)}</td><td>${f(fit21.e)}</td></tr>
1814
+ <tr><td>f<sub>ij</sub> &nbsp;<small>(NRTL-5, K⁻¹)</small></td><td>${f(fit12.f,8)}</td><td>${f(fit21.f,8)}</td></tr>`;
 
 
1815
 
1816
  document.getElementById("nrtl-param-wrap").innerHTML = `
1817
  <p style="font-size:0.82rem;color:#4a5568;margin-bottom:0.5rem">
1818
+ <b>Ο„<sub>ij</sub>(T)</b> = ${tauForm} &nbsp;|&nbsp; <b>${alphaForm}</b>
1819
  </p>
1820
  <table class="nrtl-param-table">
1821
  <thead><tr>
 
1840
  // Ο„(T) chart
1841
  renderNrtlTauChart(data, s1, s2);
1842
 
1843
+ // Verification charts β€” all temperatures at once
 
 
 
1844
  renderNrtlVerif();
1845
  }
1846
 
 
1913
 
1914
  function renderNrtlVerif() {
1915
  if (!lastNrtlData) return;
1916
+ const wrap = document.getElementById("nrtl-verif-wrap");
1917
+
1918
+ // Destroy existing charts and clear container
1919
+ nrtlVerifChartInsts.forEach(ch => ch.destroy());
1920
+ nrtlVerifChartInsts = [];
1921
+ wrap.innerHTML = "";
1922
+
1923
+ const c1 = "steelblue", c2 = "tomato";
1924
+
1925
+ lastNrtlData.verification.forEach((v, idx) => {
1926
+ // Outer div
1927
+ const outer = document.createElement("div");
1928
+ outer.style.cssText = "margin-bottom:1.5rem";
1929
+
1930
+ // Title
1931
+ const title = document.createElement("p");
1932
+ title.style.cssText = "font-size:0.88rem;font-weight:600;color:#4a5568;margin-bottom:0.4rem;text-align:center";
1933
+ title.textContent = `T = ${v.T.toFixed(1)} K Ξ±α΅’β±Ό = ${v.alpha.toFixed(4)}`;
1934
+ outer.appendChild(title);
1935
+
1936
+ // Chart wrapper
1937
+ const chartDiv = document.createElement("div");
1938
+ chartDiv.style.cssText = "position:relative;height:300px";
1939
+ const canvas = document.createElement("canvas");
1940
+ canvas.id = `nrtl-verif-${idx}`;
1941
+ chartDiv.appendChild(canvas);
1942
+ outer.appendChild(chartDiv);
1943
+ wrap.appendChild(outer);
1944
+
1945
+ const hasStd = v.lng1_std.some(s=>s>0) || v.lng2_std.some(s=>s>0);
1946
+ const datasets = [
1947
+ { label:"ln(γ₁) TeNNet-SAC", type:"scatter",
1948
+ data: v.x1.map((x,i)=>({x,y:v.lng1_ts[i]})),
1949
+ backgroundColor:c1, pointRadius:5, order:2,
1950
+ errorBars: hasStd ? v.lng1_std : null },
1951
+ { label:"ln(Ξ³β‚‚) TeNNet-SAC", type:"scatter",
1952
+ data: v.x1.map((x,i)=>({x,y:v.lng2_ts[i]})),
1953
+ backgroundColor:c2, pointRadius:5, order:2,
1954
+ errorBars: hasStd ? v.lng2_std : null },
1955
+ { label:`ln(γ₁) NRTL Ο„α΅’β±Ό=${v.tau12.toFixed(3)}`, type:"line",
1956
+ data: v.x1_nrtl.map((x,i)=>({x,y:v.lng1_nrtl[i]})),
1957
+ borderColor:c1, borderWidth:2, pointRadius:0, fill:false, order:1 },
1958
+ { label:`ln(Ξ³β‚‚) NRTL Ο„β±Όα΅’=${v.tau21.toFixed(3)}`, type:"line",
1959
+ data: v.x1_nrtl.map((x,i)=>({x,y:v.lng2_nrtl[i]})),
1960
+ borderColor:c2, borderWidth:2, pointRadius:0, fill:false, order:1 },
1961
+ ];
1962
+
1963
+ const ch = new Chart(canvas.getContext("2d"), {
1964
+ type:"scatter", data:{datasets}, plugins:[nrtlErrBarPlugin],
1965
  options:{ responsive:true, maintainAspectRatio:false,
1966
+ plugins:{ legend:{position:"top"} },
 
 
 
1967
  scales:{
1968
+ x:{ type:"linear", min:0, max:1,
1969
+ title:{display:true, text:"xα΅’ (mole fraction of component i)"} },
1970
+ y:{ title:{display:true, text:"ln Ξ³"} }
1971
  }
1972
  }
1973
+ });
1974
+ nrtlVerifChartInsts.push(ch);
1975
+ });
1976
  }
1977
 
1978
  function downloadNrtlCSV() {
1979
  if (!lastNrtlData) return;
1980
  const d = lastNrtlData;
1981
  const s1 = d._smiles1 || "comp1", s2 = d._smiles2 || "comp2";
1982
+ // Complete equations always written out regardless of which params were fitted
1983
+ const tauEq = "tau_ij(T) = a_ij + b_ij/T + e_ij*ln(T) + f_ij*T";
1984
+ const alphaEq = "alpha_ij(T) = c_ij + d_ij*(T - 273.15)";
1985
  let csv = "# NRTL Parameters for Aspen Plus\n";
1986
+ csv += `# Component i,${s1}\n`;
1987
+ csv += `# Component j,${s2}\n`;
1988
  csv += `# T range,${d.temperatures[0].toFixed(1)} - ${d.temperatures[d.temperatures.length-1].toFixed(1)} K\n`;
1989
+ csv += `# tau_ij(T) = a_ij + b_ij/T + e_ij*ln(T) + f_ij*T\n`;
1990
+ csv += `# alpha_ij(T) = c_ij + d_ij*(T - 273.15)\n`;
1991
+ csv += `# Fit mode,${d.mode}\n`;
1992
+ csv += `# RMSE ln(gamma),${d.rmse_lng.toFixed(6)}\n\n`;
1993
+ csv += "Parameter,i->j,j->i,Note\n";
1994
+ csv += `aij (NRTL-1),${d.fit12.a.toFixed(8)},${d.fit21.a.toFixed(8)},always fitted\n`;
1995
+ csv += `bij (NRTL-2) [K],${d.fit12.b.toFixed(6)},${d.fit21.b.toFixed(6)},always fitted\n`;
1996
+ csv += `cij (NRTL-3),${d.c.toFixed(8)},${d.c.toFixed(8)},${d.fit_c?"fitted":"fixed (default 0.3)"}\n`;
1997
+ csv += `dij [1/K],${d.d.toFixed(10)},${d.d.toFixed(10)},${d.fit_d?"fitted":"fixed (default 0)"}\n`;
1998
+ csv += `eij (NRTL-4),${d.fit12.e.toFixed(8)},${d.fit21.e.toFixed(8)},${d.fit_e?"fitted":"fixed (default 0)"}\n`;
1999
+ csv += `fij (NRTL-5) [1/K],${d.fit12.f.toFixed(10)},${d.fit21.f.toFixed(10)},${d.fit_f?"fitted":"fixed (default 0)"}\n`;
2000
+ csv += `\n# Stage 1 - tau_ij values at each temperature\nT (K),tau_ij,tau_ji,RMSE_lng\n`;
2001
  d.temperatures.forEach((T,i) => {
2002
  csv += `${T.toFixed(2)},${d.tau12_pts[i].toFixed(6)},${d.tau21_pts[i].toFixed(6)},${d.rmse_pts[i].toFixed(6)}\n`;
2003
  });
 
2014
  a.href = nrtlTauChartInst.toBase64Image();
2015
  a.download = "nrtl_tau_regression.png"; a.click();
2016
  }
 
 
 
 
 
 
2017
 
2018
  </script>
2019
  </body>