@@ -1181,7 +1181,7 @@ function aggregateSignal(data){
1181
1181
signal += y_targ ;
1182
1182
}
1183
1183
1184
- var noiseValue = Math . random ( ) * noise ;
1184
+ var noiseValue = ( Math . random ( ) * noise ) - ( noise / 2 ) ;
1185
1185
1186
1186
aggregate_signal [ index ] = {
1187
1187
"t" : j ,
@@ -1735,142 +1735,220 @@ function gradientElutionMode(solvent, T, phi_i, phi_f, tD, F, d, L, Et, tG, t0,
1735
1735
var table = [ ] ;
1736
1736
1737
1737
//var step = .01;
1738
- var step = parseFloat ( ( ( 60 ) / parseFloat ( document . getElementById ( "plot_points_general" ) . value ) ) . toFixed ( 3 ) ) ;
1738
+ // var step = parseFloat(((60)/parseFloat(document.getElementById("plot_points_general").value)).toFixed(3));
1739
1739
1740
1740
var tF_max = 0 ;
1741
1741
1742
- for ( i = 0 ; i < compoundList . length ; i ++ ) {
1743
- var cmpdData = [ ] ;
1744
- var UsT = 0 ;
1745
- var W = parseFloat ( ( ( Vinj / 1000000 ) * ( M [ i ] ) ) . toFixed ( 15 ) ) ;
1746
- var cache = "" ;
1747
- var compoundName = compoundList [ i ] ;
1742
+ var tF = 0.0 ;
1743
+ if ( ! document . getElementById ( "auto_time_check" ) . checked ) { tF = ( parseFloat ( document . getElementById ( "final_time_general" ) . value ) ) / 60 ; }
1744
+
1745
+ if ( tF <= 0.0 ) {
1746
+ //time is determined automatically
1748
1747
1749
- var compound = compoundList [ i ] ;
1748
+ var step = parseFloat ( ( ( 60 ) / parseFloat ( document . getElementById ( "plot_points_general" ) . value ) ) . toFixed ( 3 ) ) ;
1750
1749
1751
- cache += "compound = " + compound + "\n" ;
1750
+ for ( i = 0 ; i < compoundList . length ; i ++ ) {
1751
+ var cmpdData = [ ] ;
1752
+ var UsT = 0 ;
1753
+ var W = parseFloat ( ( ( Vinj / 1000000 ) * ( M [ i ] ) ) . toFixed ( 15 ) ) ;
1754
+ var cache = "" ;
1755
+ var compoundName = compoundList [ i ] ;
1752
1756
1753
- if ( solvent == "Methanol" ) {
1754
- var lnkw = ( calcGradientMeOH [ compound ] [ 1 ] * tKelvin ) + calcGradientMeOH [ compound ] [ 0 ] ;
1755
- var S = ( calcGradientMeOH [ compound ] [ 3 ] * tKelvin ) + calcGradientMeOH [ compound ] [ 2 ] ;
1756
- cache += "lnkw = (" + calcGradientMeOH [ compound ] [ 1 ] + "*" + tKelvin + ")+" + calcGradientMeOH [ compound ] [ 0 ] + " = " + lnkw + "\n" ;
1757
- cache += "S = (" + calcGradientMeOH [ compound ] [ 3 ] + "*" + tKelvin + ")+" + calcGradientMeOH [ compound ] [ 2 ] + " = " + S + "\n" ;
1758
- } else {
1759
- var lnkw = ( calcGradientACN [ compound ] [ 1 ] * tKelvin ) + calcGradientACN [ compound ] [ 0 ] ;
1760
- var S = ( calcGradientACN [ compound ] [ 3 ] * tKelvin ) + calcGradientACN [ compound ] [ 2 ] ;
1761
- cache += "lnkw = (" + calcGradientACN [ compound ] [ 1 ] + "*" + tKelvin + ")+" + calcGradientACN [ compound ] [ 0 ] + " = " + lnkw + "\n" ;
1762
- cache += "S = (" + calcGradientACN [ compound ] [ 3 ] + "*" + tKelvin + ")+" + calcGradientACN [ compound ] [ 2 ] + " = " + S + "\n" ;
1763
- }
1757
+ var compound = compoundList [ i ] ;
1764
1758
1765
- var lnk0 = lnkw - ( S * ( phi_i ) ) ;
1766
- cache += "lnk0 = " + lnk0 + "\n" ;
1767
- var k0 = Math . exp ( lnk0 ) ;
1768
- cache += "k0 = " + k0 + "\n" ;
1759
+ if ( solvent == "Methanol" ) {
1760
+ var lnkw = ( calcGradientMeOH [ compound ] [ 1 ] * tKelvin ) + calcGradientMeOH [ compound ] [ 0 ] ;
1761
+ var S = ( calcGradientMeOH [ compound ] [ 3 ] * tKelvin ) + calcGradientMeOH [ compound ] [ 2 ] ;
1762
+ } else {
1763
+ var lnkw = ( calcGradientACN [ compound ] [ 1 ] * tKelvin ) + calcGradientACN [ compound ] [ 0 ] ;
1764
+ var S = ( calcGradientACN [ compound ] [ 3 ] * tKelvin ) + calcGradientACN [ compound ] [ 2 ] ;
1765
+ }
1766
+
1767
+ var lnk0 = lnkw - ( S * ( phi_i ) ) ;
1768
+ var k0 = Math . exp ( lnk0 ) ;
1769
1769
1770
- var b = ( S * ( phi_f - phi_i ) * V0 ) / ( F * tG ) ;
1771
- cache += "b = " + b + "\n" ;
1770
+ var b = ( S * ( phi_f - phi_i ) * V0 ) / ( F * tG ) ;
1772
1771
1773
- var step1 = k0 - ( tD / t0 ) ;
1774
- var step2 = b * step1 + 1 ;
1775
- var step3 = ( t0 / b ) * Math . log ( step2 ) ;
1776
- var tR = t0 + tD + step3 ;
1777
- cache += "tR = " + tR + "\n" ;
1772
+ var step1 = k0 - ( tD / t0 ) ;
1773
+ var step2 = b * step1 + 1 ;
1774
+ var step3 = ( t0 / b ) * Math . log ( step2 ) ;
1775
+ var tR = t0 + tD + step3 ;
1778
1776
1779
- var kw = Math . exp ( lnkw ) ;
1780
- //var phi_e = (1/S)*Math.log((S*(deltaPhi/tG)*kw*t0*(k0-tD/t0)+1)/k0);
1781
-
1782
- if ( ( tR - tD - t0 ) < 0 || ( tR - tD - t0 ) > tG ) {
1783
- var phi_e = phi_i ;
1784
- } else {
1785
- var phi_e = gradientSlope * ( tR - tD - t0 ) + phi_i ;
1786
- }
1777
+ var kw = Math . exp ( lnkw ) ;
1778
+ //var phi_e = (1/S)*Math.log((S*(deltaPhi/tG)*kw*t0*(k0-tD/t0)+1)/k0);
1787
1779
1780
+ if ( ( tR - tD - t0 ) < 0 || ( tR - tD - t0 ) > tG ) {
1781
+ var phi_e = phi_i ;
1782
+ } else {
1783
+ var phi_e = gradientSlope * ( tR - tD - t0 ) + phi_i ;
1784
+ }
1788
1785
1786
+ var lnke = lnkw - ( S * ( phi_e ) ) ;
1787
+ var ke = Math . exp ( lnke ) ;
1789
1788
1790
- //console.log("tR: "+tR);
1791
- //console.log("phi_e: "+phi_e);
1792
- //console.log("NEW_phi_e: "+NEW_phi_e);
1793
- //console.log("--------------------");
1789
+ var sigma = Math . sqrt ( Math . pow ( ( t0 * 60 ) * ( ( 1 + ke ) / ( Math . sqrt ( N ) ) ) , 2 ) + Math . pow ( tau , 2 ) ) ;
1794
1790
1795
- //var phi_e = (((phi_f-phi_i)/tG)*tR)+phi_i;
1796
- cache += "phi_e = " + phi_e + "\n" ;
1791
+ var t = 0 ;
1792
+ var j = 0 ;
1793
+ var check = true ;
1794
+ var loops = 0 ;
1795
+ var tF = 0 ;
1797
1796
1798
- var lnke = lnkw - ( S * ( phi_e ) ) ;
1799
- cache += "lnke = lnkw - (" + S + "*(" + phi_e + ")) = " + lnke + "\n" ;
1800
- var ke = Math . exp ( lnke ) ;
1801
- cache += "ke = Math.exp(" + lnke + ") = " + ke + "\n" ;
1797
+ var compoundArray = new Array ( ) ;
1798
+ compoundArray [ 0 ] = compoundList [ i ] ;
1799
+ compoundArray [ 1 ] = ke . toFixed ( 4 ) ;
1800
+ compoundArray [ 2 ] = tR ;
1801
+ compoundArray [ 3 ] = sigma ;
1802
+ compoundArray [ 4 ] = Math . exp ( lnkw ) ; ;
1803
+ compoundArray [ 5 ] = S . toFixed ( 4 ) ;
1804
+ tableArray [ i ] = compoundArray ;
1805
+
1806
+ table [ i ] = [ ] ;
1807
+ table [ i ] [ 0 ] = compoundList [ i ] ;
1802
1808
1803
- var sigma = Math . sqrt ( Math . pow ( ( t0 * 60 ) * ( ( 1 + ke ) / ( Math . sqrt ( N ) ) ) , 2 ) + Math . pow ( tau , 2 ) ) ;
1804
- cache += "sigma = Math.sqrt(Math.pow((" + t0 + "*60)*((1+" + ke + ")/(Math.sqrt(" + N + "))), 2)+Math.pow(" + tau + ", 2)) = " + sigma ;
1809
+ var finalRun = false ;
1805
1810
1806
- //console.log(cache);
1811
+ while ( t <= tF ) {
1812
+ var Ct = 1000000 * ( W / 1000000 ) / ( Math . pow ( ( 2 * Math . PI ) , 0.5 ) * ( sigma / 60 ) * ( F / ( 60 * 1000 ) ) ) * Math . exp ( - Math . pow ( ( t - tR ) , 2 ) / ( 2 * Math . pow ( ( sigma / 60 ) , 2 ) ) ) ;
1813
+ if ( loops > 10000000 ) {
1814
+ alert ( "infinite loop" ) ;
1815
+ break ;
1816
+ }
1817
+ if ( Ct > 0.00001 ) {
1818
+ check = false ;
1819
+ }
1820
+
1821
+ if ( check == false && finalRun == false ) {
1822
+ //tF += 1;
1823
+ tF += ( 0.02 * tF ) ;
1824
+ finalRun = true ;
1825
+ }
1826
+
1827
+ cmpdData [ j ] = {
1828
+ "t" : t ,
1829
+ "Ct" : Ct
1830
+ } ;
1831
+ if ( check || Ct > 0.00001 ) {
1832
+ tF += step ;
1833
+ }
1834
+
1835
+ table [ i ] [ j + 1 ] = Ct ;
1836
+ t += step ;
1837
+ j ++ ;
1838
+ loops ++ ;
1839
+ }
1840
+ if ( tF > tF_max ) {
1841
+ tF_max = tF ;
1842
+ }
1807
1843
1808
- var t = 0 ;
1809
- var j = 0 ;
1810
- var check = true ;
1811
- var loops = 0 ;
1812
- var tF = 0 ;
1844
+ graphData [ i ] = cmpdData ;
1845
+ }
1846
+ } else {
1847
+ //time is set manually
1813
1848
1814
- var compoundArray = new Array ( ) ;
1815
- compoundArray [ 0 ] = compoundList [ i ] ;
1816
- compoundArray [ 1 ] = ke . toFixed ( 4 ) ;
1817
- compoundArray [ 2 ] = tR ;
1818
- compoundArray [ 3 ] = sigma ;
1819
- compoundArray [ 4 ] = Math . exp ( lnkw ) ; ;
1820
- compoundArray [ 5 ] = S . toFixed ( 4 ) ;
1821
- tableArray [ i ] = compoundArray ;
1822
-
1823
- table [ i ] = [ ] ;
1824
- table [ i ] [ 0 ] = compoundList [ i ] ;
1849
+ var step = parseFloat ( ( ( 60 ) / parseFloat ( document . getElementById ( "plot_points_general" ) . value ) ) . toFixed ( 3 ) ) ;
1825
1850
1826
- var finalRun = false ;
1851
+ for ( i = 0 ; i < compoundList . length ; i ++ ) {
1852
+ var cmpdData = [ ] ;
1853
+ var UsT = 0 ;
1854
+ var W = parseFloat ( ( ( Vinj / 1000000 ) * ( M [ i ] ) ) . toFixed ( 15 ) ) ;
1855
+ var cache = "" ;
1856
+ var compoundName = compoundList [ i ] ;
1827
1857
1828
- //var thisIsATest_peakValue = 0;
1829
- //var thisIsATest_peakTime = 0;
1858
+ var compound = compoundList [ i ] ;
1830
1859
1831
- while ( t <= tF ) {
1832
- var Ct = 1000000 * ( W / 1000000 ) / ( Math . pow ( ( 2 * Math . PI ) , 0.5 ) * ( sigma / 60 ) * ( F / ( 60 * 1000 ) ) ) * Math . exp ( - Math . pow ( ( t - tR ) , 2 ) / ( 2 * Math . pow ( ( sigma / 60 ) , 2 ) ) ) ;
1833
- if ( loops > 10000000 ) {
1834
- alert ( "infinite loop" ) ;
1835
- break ;
1860
+ if ( solvent == "Methanol" ) {
1861
+ var lnkw = ( calcGradientMeOH [ compound ] [ 1 ] * tKelvin ) + calcGradientMeOH [ compound ] [ 0 ] ;
1862
+ var S = ( calcGradientMeOH [ compound ] [ 3 ] * tKelvin ) + calcGradientMeOH [ compound ] [ 2 ] ;
1863
+ } else {
1864
+ var lnkw = ( calcGradientACN [ compound ] [ 1 ] * tKelvin ) + calcGradientACN [ compound ] [ 0 ] ;
1865
+ var S = ( calcGradientACN [ compound ] [ 3 ] * tKelvin ) + calcGradientACN [ compound ] [ 2 ] ;
1836
1866
}
1837
- if ( Ct > 0.00001 ) {
1838
- check = false ;
1867
+
1868
+ var lnk0 = lnkw - ( S * ( phi_i ) ) ;
1869
+ var k0 = Math . exp ( lnk0 ) ;
1870
+
1871
+ var b = ( S * ( phi_f - phi_i ) * V0 ) / ( F * tG ) ;
1872
+
1873
+ var step1 = k0 - ( tD / t0 ) ;
1874
+ var step2 = b * step1 + 1 ;
1875
+ var step3 = ( t0 / b ) * Math . log ( step2 ) ;
1876
+ var tR = t0 + tD + step3 ;
1877
+
1878
+ var kw = Math . exp ( lnkw ) ;
1879
+ //var phi_e = (1/S)*Math.log((S*(deltaPhi/tG)*kw*t0*(k0-tD/t0)+1)/k0);
1880
+
1881
+ if ( ( tR - tD - t0 ) < 0 || ( tR - tD - t0 ) > tG ) {
1882
+ var phi_e = phi_i ;
1883
+ } else {
1884
+ var phi_e = gradientSlope * ( tR - tD - t0 ) + phi_i ;
1839
1885
}
1840
-
1841
- if ( check == false && finalRun == false ) {
1842
- //tF += 1;
1843
- tF += ( 0.02 * tF ) ;
1844
- finalRun = true ;
1886
+
1887
+ var lnke = lnkw - ( S * ( phi_e ) ) ;
1888
+ var ke = Math . exp ( lnke ) ;
1889
+
1890
+ var sigma = Math . sqrt ( Math . pow ( ( t0 * 60 ) * ( ( 1 + ke ) / ( Math . sqrt ( N ) ) ) , 2 ) + Math . pow ( tau , 2 ) ) ;
1891
+
1892
+ var t = 0 ;
1893
+ var j = 0 ;
1894
+ var check = true ;
1895
+ var loops = 0 ;
1896
+ //var tF = 0;
1897
+
1898
+ var compoundArray = new Array ( ) ;
1899
+ compoundArray [ 0 ] = compoundList [ i ] ;
1900
+ compoundArray [ 1 ] = ke . toFixed ( 4 ) ;
1901
+ compoundArray [ 2 ] = tR ;
1902
+ compoundArray [ 3 ] = sigma ;
1903
+ compoundArray [ 4 ] = Math . exp ( lnkw ) ; ;
1904
+ compoundArray [ 5 ] = S . toFixed ( 4 ) ;
1905
+ tableArray [ i ] = compoundArray ;
1906
+
1907
+ table [ i ] = [ ] ;
1908
+ table [ i ] [ 0 ] = compoundList [ i ] ;
1909
+
1910
+ var finalRun = false ;
1911
+
1912
+ while ( t <= tF ) {
1913
+ var Ct = 1000000 * ( W / 1000000 ) / ( Math . pow ( ( 2 * Math . PI ) , 0.5 ) * ( sigma / 60 ) * ( F / ( 60 * 1000 ) ) ) * Math . exp ( - Math . pow ( ( t - tR ) , 2 ) / ( 2 * Math . pow ( ( sigma / 60 ) , 2 ) ) ) ;
1914
+ if ( loops > 10000000 ) {
1915
+ alert ( "infinite loop" ) ;
1916
+ break ;
1917
+ }
1918
+ if ( Ct > 0.00001 ) {
1919
+ check = false ;
1920
+ }
1921
+
1922
+ if ( check == false && finalRun == false ) {
1923
+ //tF += 1;
1924
+ //tF += (0.02 * tF);
1925
+ finalRun = true ;
1926
+ }
1927
+
1928
+ cmpdData [ j ] = {
1929
+ "t" : t ,
1930
+ "Ct" : Ct
1931
+ } ;
1932
+ if ( check || Ct > 0.00001 ) {
1933
+ //tF += step;
1934
+ }
1935
+
1936
+ table [ i ] [ j + 1 ] = Ct ;
1937
+ t += step ;
1938
+ j ++ ;
1939
+ loops ++ ;
1845
1940
}
1846
-
1847
- cmpdData [ j ] = {
1848
- "t" : t ,
1849
- "Ct" : Ct
1850
- } ;
1851
- if ( check || Ct > 0.00001 ) {
1852
- tF += step ;
1941
+ if ( tF > tF_max ) {
1942
+ tF_max = tF ;
1853
1943
}
1854
-
1855
- //if(Ct > thisIsATest_peakValue){
1856
- // thisIsATest_peakValue = Ct;
1857
- // thisIsATest_peakTime = t;
1858
- //}
1859
-
1860
- table [ i ] [ j + 1 ] = Ct ;
1861
- t += step ;
1862
- j ++ ;
1863
- loops ++ ;
1864
- }
1865
- if ( tF > tF_max ) {
1866
- tF_max = tF ;
1944
+
1945
+ graphData [ i ] = cmpdData ;
1867
1946
}
1868
- //console.log("peakValue:\n"+thisIsATest_peakValue);
1869
- //console.log("peakTime:\n"+thisIsATest_peakTime);
1870
1947
1871
- graphData [ i ] = cmpdData ;
1872
1948
}
1873
1949
1950
+
1951
+
1874
1952
var percentB = [ ] ;
1875
1953
1876
1954
for ( t = 0 ; t <= tF_max ; t += step ) {
0 commit comments