Documente Academic
Documente Profesional
Documente Cultură
Centro de Tecnologia
Departamento de Engenharia Qumica
Programa de Ps-Graduao em Engenharia Qumica
TESE DE DOUTORADO
Natal
Junho/2014
Jos Augusto Furtado de Oliveira
Natal
Junho/2014
Catalogao da Publicao na Fonte.
UFRN / CT / DEQ / PPGEQ
Biblioteca Setorial Professor Horcio Nicolas Solimo.
Prof. Dr. Edson Luiz Foletto Prof. Dr. Andr Lus Novais Mota
Membro Externo - UFSM Membro Externo - UFERSA
Ao Senhor Jesus, em primeiro lugar, por TUDO! Sem Ele nada seria possvel!
minha esposa Marizete e meus Filhos, Jssica e Samuel, pelo AMOR!
minha me, Eudzia, pela EDUCAO e SUPORTE, alm do natural para uma
me, que foram-me dados!
Agncia Nacional de Petrleo Gs Natural e Biocombustveis (ANP) pelo APOIO
FINANCEIRO.
Ao Centro de Pesquisas da Petrobras (CENPES) pela formao do grupo de PESQUISA
do MEG no Laboratrio de Fotoqumica e Equilbrio de Fases (FOTEQ).
Ao Prof. Osvaldo Chiavone Filho pela ORIENTAO e DEDICAO no desenvol-
vimento desta tese de doutorado.
Ao Prof. Afonso Avelino Dantas Neto pelo APOIO do Programa de Recursos Humanos
ANP-14 (PRH ANP-14).
Ao Prof. Eduardo Lins de Barros Neto pelo INCENTIVO!
Ao Prof. Humberto Neves Maia de Oliveira pelo CAFEZINHO!
Ao Prof. Jos Romualdo Dantas Vidal e Maria Carlenise Paiva de Alencar Moura pelo
ESTMULO e AMIZADE!.
Maria Jos de Sousa Brunet pela PACINCIA e RAPIDEZ nas diversas solicitaes
de vital importncia deste projeto.
Ao aluno de iniciao cientfica Bruno Dezan Samorini pela EFICINCIA.
A TODO o pessoal do Ncleo de Ensino e Pesquisa em Petrleo e Gs (NUPEG) e do
laboratrio de Fotoqumica e Equilbrio de Fases (FOTEQ) pelo COLEGUISMO.
E a todos que, embora no citados aqui, COLABORARAM de forma direta ou indireta
para o desenvolvimento desta tese de doutorado. MUITO OBRIGADO!
.
Primary processing of natural gas platforms as Mexilho Field (PMXL-1 ) in the Santos
Basin, where monoethylene glycol (MEG) has been used to inhibit the formation of
hydrates, present operational problems caused by salt scale in the recovery unit of MEG.
Bibliographic search and data analysis of salt solubility in mixed solvents, namely water
and MEG, indicate that experimental reports are available to a relatively restricted number
of ionic species present in the produced water, such as NaCl and KCl. The aim of this study
was to develop a method for calculating of salt solubilities in mixed solvent mixtures, in
explantion, NaCl or KCl in aqueous mixtures of MEG. The method of calculating extend
the Pitzer model, with the approach Lorimer, for aqueous systems containing a salt and
another solvent (MEG). Python language in the Integrated Development Environment
(IDE) Eclipse was used in the creation of the computational applications. The results
indicate the feasibility of the proposed calculation method for a systematic series of salt
(NaCl or KCl) solubility data in aqueous mixtures of MEG at various temperatures.
Moreover, the application of the developed tool in Python has proven to be suitable for
parameter estimation and simulation purposes.
bi molalidade de i
ni nmero de moles de i
Mi massa molecular de i
ci molaridade de i
V volume da soluo
i potencial qumico de i
T temperatura
P presso
ai atividade de i
i coeficiente de atividade de i
i,x coeficiente de atividade racional assimtrico
b0 molalidade unitria
M+ X eletrlito eletricamente neutro
+ nmero de ctions
z+ carga do ction
nmero de nions
z carga do nion
1 comprimento de Debye-Hckel
0 permissividade no vcuo
NA nmero de Avogrado
e carga do eltron
I fora inica
1 1
b um parmetro do modelo de Pitzer (b = 1, 2 kg 2 mol 2 )
VE volume de excesso
SE a entropia de excesso
GE energia livre de Gibbs parcial molar de excesso de i
kS constante de Setchenov
coeficiente osmtico
zM carga do ction
zX carga do nion
Sumrio
1 INTRODUO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.1 Atividade de produo no Campo de Mexilho1 . . . . . . . . . . . . 31
1.2 Formao de hidratos em tubulaes . . . . . . . . . . . . . . . . . . 33
1.3 Estrutura dos hidratos . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
1.4 Inibio da formao de hidratos . . . . . . . . . . . . . . . . . . . . . 35
1.5 Uso do MEG como inibidor de hidratos . . . . . . . . . . . . . . . . . 36
1.6 Problemas no processo de recuperao do MEG . . . . . . . . . . . . 36
2 REVISO BIBLIOGRFICA . . . . . . . . . . . . . . . . . . . . . . 41
2.1 Dados Experimentais . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.2 O monoetilenoglicol . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.3 Seleo dos sistemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.4 Equilbrio de Fases para Sistemas com Eletrlitos . . . . . . . . . . . 44
2.4.1 Escalas de concentrao . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.4.2 Potencial qumico . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.4.3 Estado padro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.4.4 Coeficiente de atividade mdio inico e molalidade mdia inica . . . . . . 47
2.4.5 Leis limitantes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.4.6 Energia livre de Gibbs para solues eletrolticas reais . . . . . . . . . . . . 49
2.4.7 Fugacidade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.5 Modelos Termodinmicos . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.5.1 Ideal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.5.2 Setchenov . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.5.3 Pitzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.6 Outros Modelos Termodinmicos . . . . . . . . . . . . . . . . . . . . 54
2.7 Ferramentas Computacionais . . . . . . . . . . . . . . . . . . . . . . . 56
3 METODOLOGIA . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.1 Molalidade e frao molar . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.1.1 Clculo da molalidade do sal na mistura de solventes . . . . . . . . . . . . 60
3.1.2 Clculo da frao molar do MEG livre de sal na mistura de solventes . . . . 60
3.2 Constantes dieltricas . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.2.1 Clculo das constantes dieltricas dos solventes puros . . . . . . . . . . . . 60
3.2.2 Clculo das constantes dieltricas da mistura de solventes . . . . . . . . . . 60
3.3 Densidades . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
1
As informaes presentes nesta seo foram obtidas de Petrobras (2007)
3.3.1 Clculo das densidades dos solventes puros . . . . . . . . . . . . . . . . . 61
3.3.2 Clculo das densidades da mistura de solventes . . . . . . . . . . . . . . . 61
3.4 Coeficiente de atividade . . . . . . . . . . . . . . . . . . . . . . . . . . 62
3.4.1 Clculo do coeficiente de atividade do sal pelo Modelo de Pitzer . . . . . . 62
3.4.2 Parmetros do modelo de Pitzer em gua . . . . . . . . . . . . . . . . . . 62
3.4.2.1 Clculo dos parmetros do modelo de Pitzer para o NaCl . . . . . . . . . . . . . . 62
3.4.2.2 Clculo dos parmetros do modelo de Pitzer para o KCl . . . . . . . . . . . . . . . 63
3.4.3 Constante de Debye-Hckel . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.4.3.1 Clculo da constante de Debye-Hckel para a gua . . . . . . . . . . . . . . . . . 63
3.4.3.2 Clculo da constante de Debye-Hckel para o MEG e para a mistura de solventes . . . 63
3.4.4 Clculo do coeficiente de atividade do sal em MEG . . . . . . . . . . . . . 64
3.4.5 Parmetros do modelo de Pitzer em mistura de solventes . . . . . . . . . . 64
3.5 Algoritmos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
3.5.1 Clculo das propriedades de excesso do sal em mistura de solventes . . . . 65
3.5.2 Clculo das demais propriedades . . . . . . . . . . . . . . . . . . . . . . . 67
4 RESULTADOS E DISCUSSES . . . . . . . . . . . . . . . . . . . . 71
4.1 Como os resultados foram calculados atravs do programa desen-
volvido . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.2 Sistemas com NaCl . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.2.1 Sistemas Binrios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.2.1.1 Sistema H2 O+NaCl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.2.1.2 Sistema MEG+NaCl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.2.2 Sistemas Ternrios (H2 O+MEG+NaCl) . . . . . . . . . . . . . . . . . . . 77
4.2.2.1 Potencial qumico padro de excesso do NaCl em mistura de solventes (Regresso) . . . 77
4.2.2.2 Potencial qumico padro de excesso do NaCl em mistura de solventes (Predio) . . . 79
4.2.2.3 Molalidade do NaCl em mistura de solventes (Regresso) . . . . . . . . . . . . . . 80
4.2.2.4 Molalidade do NaCl em mistura de solventes (Predio) . . . . . . . . . . . . . . . 81
4.2.2.5 Logaritmo de excesso da molalidade do NaCl em mistura de solventes (Regresso) . . . 82
4.2.2.6 Logaritmo de excesso da molalidade do NaCl em mistura de solventes (Predio) . . . 83
4.2.2.7 Logaritmo do coeficiente de atividade do NaCl em mistura de solventes (Regresso) . . 84
4.2.2.8 Logaritmo do coeficiente de atividade do NaCl em mistura de solventes (Predio) . . . 85
4.2.2.9 Logaritmo de excesso do coeficiente de atividade do NaCl em mistura de solventes
(Regresso) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.2.2.10 Logaritmo de excesso do coeficiente de atividade do NaCl em mistura de solventes (Predio) 87
4.3 Sistemas com KCl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.3.1 Sistemas Binrios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.3.1.1 Sistema H2 O+KCl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.3.1.2 Sistema MEG+KCl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.3.2 Sistemas Ternrios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
4.3.2.1 Potencial qumico padro de excesso do KCl em mistura de solventes (Regresso) . . . 91
4.3.2.2 .
Potencial qumico padro de excesso do KCl em mistura de solventes (Predio) . . . 93
4.3.2.3 Molalidade do KCl em mistura de solventes (Regresso) . . . . . . . . . . . . . . . 94
4.3.2.4 Molalidade do KCl em mistura de solventes (Predio) . . . . . . . . . . . . . . . 95
4.3.2.5 Logaritmo de excesso da molalidade do KCl em mistura de solventes (Regresso) . . . 96
4.3.2.6 Logaritmo de excesso da molalidade do KCl em mistura de solventes (Predio) . . . . 97
4.3.2.7 Logaritmo do coeficiente de atividade do KCl em mistura de solventes (Regresso) . . . 98
4.3.2.8 Logaritmo do coeficiente de atividade do KCl em mistura de solventes (Predio) . . . 99
4.3.2.9 Logaritmo de excesso do coeficiente de atividade do KCl em mistura de solventes (Regresso) 100
4.3.2.10 Logaritmo de excesso do coeficiente de atividade do KCl em mistura de solventes (Predio) 101
4.4 Validao do Modelo de Pitzer implementado . . . . . . . . . . . . . 102
4.5 Comparao do Modelo implementado com outros modelos . . . . . 103
4.5.1 Modelo Ideal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4.5.2 Modelo UNIQUAC+DH . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5 CONCLUSES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Referncias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
APNDICES 117
1 INTRODUO
1
As informaes presentes nesta seo foram obtidas de Petrobras (2007)
32 Captulo 1. INTRODUO
Fonte: Statoil
2 REVISO BIBLIOGRFICA
Fonte: o autor
Fonte: o autor
2.2 O monoetilenoglicol
O monoetilenoglicol, conhecido simplesmente como etilenoglicol, ou MEG, ou pelo
nome IUPAC: etano-1,2-diol, ou 1,2-etanodiol, um lcool com dois grupos-OH (um diol),
sendo largamente utilizado como um anticongelante automotivo. Puro um composto
inodoro, incolor, lquido xaroposo com um sabor doce. O MEG txico, e sua ingesto
considerada uma emergncia mdica. Sua densidade a 20 C 1.1132 g/cm3 , com
massa molecular 62.068 g/mol, ponto de fuso -12.9 C e Ponto de ebulio 197.3 C
(WIKIPEDIA, 2014).
O MEG o mais simples dos etilenoglicis. Normalmente obtido pela reao de
gua com xido de eteno. Reagindo-se MEG com xido de eteno, produz-se o dietilenoglicol
(DEG) e a partir deste, adicionando-se mais xido de eteno, chega-se ao trietilenoglicol
(TEG) (ANDRADE, 2009). O esquema das reaes de obteno destes compostos e sua
estrutura molecular so mostrados na Figura 11.
H2 C H2 C + H2 O HOCH2 CH2 OH
(nG)
" #
i (2.4)
ni T,P,nj6=i
i = i + RT ln ai = i + RT ln (i i ) (2.5)
{H O}
sMX = MX2 (2.6)
{MEG}
sMX = MX (2.7)
{H O+MEG}
sMX = MX2 (2.8)
Fonte: o autor.
i = 0i + RT ln (i xi ) (2.9)
M+ X
+ Mz+ + Xz (2.12)
onde a eletroneutralidade requer que + z+ + z = 0. Por comodidade, abreviaremos
M+ X por MX.
onde = + + .
yi P = xi Pisat (2.15)
e2 NA
ln i,c = zi2 (2.19)
80 r RT
Para solues aquosas diludas prximo a temperatura ambiente, no existe diferena sig-
nificativa entre molalidade e molaridade (PRAUSNITZ; LICHTENTHALER; AZEVEDO,
1999). Assim sendo, trocando as unidades do coeficiente de atividade e da fora inica na
Equao 2.19, temos:
1
ln i,b = A zi2 I 2 (2.20)
onde A :
!3
e2 2
NA2 1
A = (2solv ) 2 (2.21)
0 r RT 8
Para o eletrlito M+ X , usando Equao 2.13, e desprezando o subscrito b, temos a Lei
de Debye-Hckel:
1
ln = A |z+ z |I 2 (2.22)
O comportamento descrito pela Lei de Raoult (Equao 2.15) e pela Lei de Henry
(Equao 2.16) tende a ser o comportamento de solues reais conforme estas tendam
a ser diludas. Da mesma forma, a Lei de Debye-Hckel providencia uma representao
satisfatria do comportamento dos coeficientes de atividade em solues diludas, sendo
limitada para solues aquosas com fora inica at 0,01 mol/kg. A Lei de Debye-Hckel
Extendida (GUGGENHEIM, 1935) aumentou o limite de aplicao no clculo de coeficiente
de atividade para solues aquosas com fora inica at 0,1 mol/kg:
1
1 X 2 AI 2
ln = i zi 1 + B I (2.23)
i 1 + bI 2
M E M M id (2.24)
onde Mi representa uma propriedade parcial molar de i e Miid representa uma propriedade
parcial molar ideal de i.
A propriedade parcial molar da energia livre de Gibbs, que funo das variveis
operacionais T e P , vale o teorema de Euler ou a caracterstica de aditividade (PRAUSNITZ;
LICHTENTHALER; AZEVEDO, 1999).
Para um sistema aberto, multicomponente e com uma nica fase, tem-se:
Dividindo a Equao 2.26 por RT e somando com a equao Equao 2.27, tem-se:
nG nV nS nG X Gi
d = dP + dT + dni (2.28)
RT RT RT RT 2 i RT
onde H a energia livre de Helmholtz.
Como G = H T S, tem-se, substituindo na Equao 2.27, uma relao fundamental
para G bastante til em termodinmica de solues, ou seja:
nG nV nH X Gi
d = dP dT + dni (2.29)
RT RT RT 2 i RT
2.4.7 Fugacidade
Da termodinmica clssica, temperatura constante, temos:
fi
di RT d ln fi
i = i + RT d ln (2.31)
fi
Fonte: o autor.
fi = bi i,b
Hi,b (2.34)
2.5.1 Ideal
A definio do logaritmo de excesso da solubilidade (LORIMER, 1993) permite
uma avaliao simplificada do comportamento das solues aquosas com MEG e o sal
em estudo. Isto , considerando soluo ideal no necessrio usar-se modelo de energia
livre de excesso. Primeiramente, deve-se definir o logaritmo ideal da solubilidade que foi
escolhida como uma regra linear da composio para uma mistura binria de solventes:
{H O+MEG} id {H O+MEG} {H O} {H O+MEG} {MEG}
h i
ln bMX2 2
xH2 O ln bMX2 + xMEG
2
ln bMX (2.35)
{H O+MEG} id
h i
onde ln bMX2 o logaritmo ideal da molalidade do sal MX em gua e MEG,
{H2 O+MEG} {H O+MEG}
xH2 O a frao molar da gua livre de sal, xMEG
2
a frao molar do MEG
{H2 O} {MEG}
livre de sal, ln bMX o logaritmo ideal da molalidade do sal MX em gua e ln bMX o
logaritmo ideal da molalidade do sal MX em MEG.
A definio do logaritmo de excesso da solubilidade foi feita conforme a Equao 2.24:
2.5.2 Setchenov
O efeito linear do solvente sobre a solubilidade do sal numa escala logartmica pode
ser mensurado pela equao de Setchenov (Equao 2.37), que expressa o efeito salting-out
(LEE, 1997), que justamente o oposto do que ocorre no processo de regenerao do MEG,
mas acompanha o mesmo fenmeno fsico.
{H O+MEG} {H O} {H O+MEG}
ln bMX2 = ln bMX2 + kS xMEG
2
(2.37)
{H O+MEG} {H O}
Onde bMX2 a molalidade do sal MX em gua e MEG, bMX2 a molalidade do
sal MX em gua e kS a constante de Setchenov. Aplicando uma correlao equivalente
entre o produto de solubilidade de um componente em gua e o mesmo em uma mistura
de solventes (gua+MEG) usando essa equao de Setchenov, pode-se estimar o produto
de solubilidade nesse novo meio solvente (OLIVEIRA et al., 2010).
2.5.3 Pitzer
Seguindo a abordagem de Lorimer (1993), que usa a teoria de McMillan-Mayer,
possvel corrigir as no-idealidades da fase lquida com uma equao de coeficiente de
atividade, como o modelo de Pitzer. O modelo de Pitzer foi desenvolvido para o solvente
gua e portanto a aplicao dele para mistura de solventes requer uma estratgia para
estimar os parmetros solvente orgnico-sal.
Na termodinmica de solues eletrolticas comum expressar os modelos de
correo das no idealidades pelo coeficiente osmtico (solvente) ou pelo coeficiente de
atividade (soluto). A definio do coeficiente osmtico dada pela Equao 2.38.
ln aH2 O
P (2.38)
MH2 O i bi
2M X 2 (M X )3/2
= 1 + |zM zX | fMX
+b BMX + b2 CMX (2.39)
2M X 2 2 (M X )
3/2
ln MX =
|zM zX | fMX +b BMX + b
CMX (2.40)
onde:
2
" #
I 1/2 I 1/2
fMX = A e
fMX = A ln 1 + bI 1/2 + (2.41)
1 + bI 1/2 b 1 + bI 1/2
!3/2
1 2N0 w
1/2
e2
A = (2.42)
3 1000 DkT
|zM zX | b
I= e b = 1, 2 kg0,5 mol0,5 (para solues aquosas a 25 deg C) (2.43)
2 b0
= M + X e b0 = 1 mol/kgH2 O (2.44)
(1)
2MX 1 2
(0) (1) 1/2 (0) I 1/2
BMX = MX + MX eI e BMX
= 2MX + 1 1 + I 1/2
I e
2 I 2
(2.45)
3 3
CMX = (M MMX + X MXX ) e CMX
= CMX (2.47)
(M X ) 1/2 2
(0) (1)
sendo MX , MX , MMX , MXX so parmetros do modelos e , M e X referem-se
aos coeficientes estequiomtricos do sal, do ction e do nion, respectivamente e, zM e zX
referem-se carga do ction e do nion, respectivamente.
Para expressar o efeito trmicos, os parmetros do modelo devem ser considerados
dependentes da temperatura (JR. et al., 1986). Lorimer aplicou o modelo de Pitzer para
misturas de solventes determinando o parmetro como funo da constante dieltrica e
da composio de solvente livre de sal. Essa modelagem foi aplicada neste trabalho e ser
descrita no Captulo 3.
3 METODOLOGIA
Fonte: o autor
{H O+MEG}
2
bMEG = mMX
mH2 O+MEG MMX
1000 (3.2)
{H O+MEG} {H O+MEG}
n
r,H2 O+MEG = exp xH2 O
2
ln r,H2 O + xMEG
2
ln r,MEG + (3.9)
{H O+MEG} {H2 O+MEG}
2
xH2 O xMEG h
{H2 O+MEG} {H2 O+MEG}
i
+ 153, 6 + 57, 3 xH2 O xMEG
T
{H O+MEG} {H O+MEG}
sendo xH2 O
2
= 1 xMEG
2
.
3.3 Densidades
2 4
H2 O = 17, 863 + 58, 606 0,35 95, 396 3 + 213, 89 141, 26 3 MH2 O (3.10)
MEG = 1,315
MMEG (3.11)
( )
T 0,21868
1+ 1 720
0,25125
sendo = 1 T
647,096
.
1
H2 O+MEG = H2 O+MEG = {H2 O+MEG} {H O+MEG}
(3.12)
wH2 O /H2 O + wMEG
2
/MEG
{H O+MEG}
2
{H O+MEG} {H O+MEG} {H O+MEG} xMEG MMEG
sendo xH2 O
2
= 1 xMEG
2
, wMEG
2
= {H2 O+MEG} {H2 O+MEG} e
xH O MH2 O +xMEG MMEG
2
{H O+MEG} {H O+MEG}
2
wH2 O = 1 wMEG
2
.
2 +b z 2
bM zM
Ib = 2
X X
(3.13)
Ib0,5
X = 2b ln 1 + bIb0,5 + 1+bIb0,5
(3.14)
fMX = A X (3.15)
0,5
1e
I
b (1+Ib0,5 0,52 Ib )
Y = 2 Ib
(3.16)
(0) (1)
BMX =2 MX + MX Y (3.17)
CMX = 1, 5CMX
(3.18)
h i
ln MX = |zM zX | fMX
+ 2bMX M X
MX
BMX + bMX (M X )0,5 CMX
(3.19)
1 1
! !
(0){H O} T
NaCl 2 (T ) = 0, 0765 777, 03 4, 4706 ln +
T 298, 15 298, 15
+0, 008946 (T 298, 15) 0, 0000033158 T 2 298, 152 (3.20)
(1){H O}
NaCl 2 (T ) = 0, 2664 + 0, 000061608 (T 298, 15) +
+0, 0000010715 T 2 298, 152 (3.21)
1 1
!
{H O}
CNaCl2 (T ) = 0, 00127 + 33, 317 +
T 298, 15
!
T
+0, 09421 ln 0, 00004655 (T 298, 15) (3.22)
298, 15
{H O} 0, 234117693834228
CKCl 2 (T ) = 0, 00133515934994478 + +
T 225
0, 75896583546707
(3.25)
T
(0){solvente} (0){H2 O}
MX = MX (3.29)
(1){solvente}
MX = 0 exp (A ln r,solvente + B) (3.30)
{solvente} {H O}
CMX = CMX 2 (3.31)
(1){H2 O} (1){MEG}
ln MX /MX (1){H O}
MX 2
onde 0 = 1, A = ln(r,H2 O /r,MEG )
e B = ln 0
A ln r,H2 O .
3.5 Algoritmos
Atravs do conjunto de equaes apresentados anteriormente podemos calcular
{H O+MEG}
E
bMX2
as propriedades de excesso: molalidade ( ln b0
), coeficiente de atividade
iE iE
{H O+MEG}
h h
0{H O+MEG}
( ln MX2 ) e potencial qumico ( MX 2 ), para tanto usamos a definio
de propriedade de excesso (Equao 2.24) e a regra de mistura ideal:
M id = M x + M (1 x) (3.32)
4 RESULTADOS E DISCUSSES
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
0 5,169456 0,580512
1 0,003319 0,000360
2 -0,762002 0,120679
Fonte: o autor
Fonte: o autor.
0 0,413063 0,025925
1 -0,000722 0,000079
Fonte: o autor
Fonte: o autor.
0 8.085783 0.338373
1 -0.007834 0.000996
2 -17.962668 1.590260
3 0.037503 0.004678
4 13.113160 1.674601
5 -0.016159 0.004914
Fonte: o autor
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
0 -28,334183 1,467987
1 -0,011414 0,000942
2 5,845133 0,306710
Fonte: o autor
Fonte: o autor.
0 -1,872213 0,165790
1 0,005120 0,000528
Fonte: o autor
Fonte: o autor.
0 1.433040 3.651707
1 -0.010232 0.012044
2 -20.275677 16.940293
3 0.050808 0.055854
4 12.410073 17.367966
5 -0.018566 0.057203
Fonte: o autor
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor.
Fonte: o autor
5 CONCLUSES
Referncias
CHEN, C.-C. et al. Local composition model for excess gibbs energy of electrolyte
systems. part i: Single solvent, single completely dissociated electrolyte systems. AIChE
Journal, American Institute of Chemical Engineers, v. 28, n. 4, p. 588596, jul. 1982.
ISSN 1547-5905. Disponvel em: <http://doi.wiley.com/10.1002/aic.690280410>. Citado
na pgina 63.
DAHL, S.; MACEDO, E. A. The mhv2 model: A unifac-based equation of state model for
vapor-liquid and liquid-liquid equilibria of mixtures with strong electrolytes. Industrial &
Engineering Chemistry Research, v. 31, n. 4, p. 11951201, abr. 1992. ISSN 0888-5885.
Disponvel em: <http://pubs.acs.org/doi/abs/10.1021/ie00004a033>. Citado na pgina
55.
DEBYE, P.; HCKEL, E. The theory of electrolytes. i. lowering of freezing point and
related phenomena. Physikalische Zeitschrift, v. 24, p. 185206, 1923. Citado 2 vezes nas
pginas 48 e 49.
FIGUEIREDO, C. S. et al. Fluid Phase Equilibria (em Publicao), Salt solubility data
for sodium chloride and mono ethylene glycol aqueous systems from 293.15 to 403.15 K.
2014. Citado 2 vezes nas pginas 41 e 42.
HAMER, W. J.; WU, Y.-C. Osmotic coefficients and mean activity coefficients
of uni-univalent electrolytes in water at 25 c. Journal of Physical and Chemical
Reference Data, NIST, v. 1, n. 4, p. 10471100, 1972. ISSN 0047-2689. Disponvel em:
<http://link.aip.org/link/?JPR/1/1047/1>. Citado na pgina 102.
JOUYBAN, A.; SOLTANPOUR, S.; CHAN, H.-K. A simple relationship between dielectric
constant of mixed solvents with solvent composition and temperature. International
Journal of Pharmaceutics, v. 269, n. 2, p. 353360, jan. 2004. ISSN 0378-5173. Disponvel
em: <http://linkinghub.elsevier.com/retrieve/pii/S0378517303005118>. Citado na
pgina 61.
3FSubscriptionId%3D0JYN1NVW651KCA56C102%26tag%3Dtechkie-20%26linkCode%
3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0470697261>.
Citado na pgina 47.
SANDLER, S. I. (Ed.). Models for Thermodynamic and Phase Equilibria Calculations. 1. ed.
Nova Iorque: Marcel Dekker, 1993. 704 p. ISBN 978-0-8247-9130-8. Disponvel em: <http:
//www.amazon.com/Thermodynamic-Equilibria-Calculations-Chemical-Industries/dp/
0824791304%3FSubscriptionId%3D0JYN1NVW651KCA56C102%26tag%3Dtechkie-20%
26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%
3D0824791304>. Citado na pgina 55.
APNDICE A ARTIGO
Abstract In order to correlate and optimize ex- Camacho et al., 2007). For the first case, an evaluation
perimental data either from the laboratory or indus- of the thermodynamic consistency of the data can be
try, one needs a robust method of data regression. provided, since activity coefficient models fulfill the ex-
Among the non-linear parameter estimation meth- act definition of partial molar excess Gibbs energy.
ods it may be pointed out of Levenberg, which ap- Systematic evaluation of thermodynamic properties
plies the conversion of an arbitrary matrix into a of solutions of sodium chloride (NaCl) in water, e.g.,
positive definite one. Later, Marquardt applied the boiling point and osmotic coefficient, with an extensive
same procedure, calculating parameter in an it- experimental database, was provided by Clarke and
erative form. The Levenberg-Marquardt algorithm Glew (1985). VLE calculation for mixed solvents elec-
is described and two routine for correlating vapor- trolyte systems have been applied using functional
liquid equilibrium data for pure component and group activity coefficient model, i.e., UNIFAC (Kikic et
mixtures, based on this efficient method, have been al., 1991). It was taken into account the electrostatic
applied. The routines have been written with an in- term with Debye-Huckel term, normalized according to
terface very accessible for both users and program- the theory of Mc-Millan-Mayer. However, the estimated
mers, using Python language. The flexibility of the parameters present scattering and large order of magni-
developed programs for introducing the desired de- tude. Loehe and Donohue (1997) described a survey of
tails is quite interesting for both process simulators the literature models to determine thermodynamic prop-
and modeling properties. Furthermore, for mixtures erties of aqueous systems with strong electrolytes.
with electrolytes, it was obtained a coherent and Thomsen et al. (2004) have presented a systematic
compatible relation for the structural parameters of modeling work with mixed electrolytes and mixed sol-
the salt species, with the aid of the method and the vents systems for solid-liquid-vapor equilibrium data,
graphical interface designed. using UNIQUAC also. Haghtalab and Peyvandi (2009)
Keywords Nonlinear Regression, Levemberg- have proposed a new version of UNIQUAC model for
Marquardt Method, Vapor-Liquid Equilibria, electrolyte solutions that requires just two fitted interac-
Mixed Solvents Electrolyte Systems. tion parameters per binary aqueous system. The struc-
tural parameters of the ionic species were evaluated
I. INTRODUCTION considering solvation for the determination of the radii.
The phenomena and properties involved in the chemical This study aimed to describe the Levenberg-
processes present, usually, non-linear behavior. There- Marquardt computational procedure for estimation of
fore, it is needed a robust method of non-linear regres- vapor-liquid equilibrium model parameters. Validations
sion for providing the required correlation of the ex- of the method are present for pure component vapor
perimental data collected, either from the laboratory or pressure and binary VLE data. Application to strong
from the industry. electrolytes in mixed solvents systems has also been
Bard (1974) pointed out three methods of parameter performed, using UNIQUAC model. It is proposed a
estimation, i.e., least squares, maximum likelihood and new form to determine structural UNIQUAC parameters
Bayesian. The method of least squares is the oldest and of the ions that is compatible with the solvent species
most widely used estimation procedure. It can be ap- parameters.
plied directly to a deterministic model, without any
II. METHODS
knowledge being taken of the probability distribution of
A. Levenberg-Marquardt Method
the observations. This feature satisfies quite well the
The method presented by Levenberg (1944) utilizes a
propose of correlating most of the desired thermody-
conversion of an arbitrary matrix into a positive definite
namic properties and process variables.
one. This method rests on the observation that if P is
For solving these unconstrained problems, the
any positive definite matrix, then Ai + P is positive
Levenberg-Marquardt method has proven very reliable
results. In this work the Levenberg-Marquardt algoritm definite for sufficiently large, no matter what Ai.
is described in a simple form. Marquardt (1963) suggested an iterative algorithm for
This parameter estimation method has been repro- the selection of .
duced and applied for the correlation of vapor-liquid The importance of working with a definite positive
equilibrium (VLE) data using activity coefficient and matrix is to satisfy the necessary and sufficient condi-
equation of state approaches (Lazzs, 2010; Camacho- tions of minimization in the data regression, where the
least square of the residuals (ei) is to be found.
B. Levenberg-Marquardt Algorithm (xii) If * > 1.1(1) continue on the step (xiii). Else, set
In this section the Levenberg-Marquardt algorithm ap-
plied for a nonlinear parameter estimation is described = (1) and go to the step (xx);
in four phases. (xiii) Compute = 1 +
( 2) *
( )
Initialization:
(xiv) If ( 2 ) < (1) continue on the step (xv). Else, set
(i) Enter min (a minimum value of the step length ,
= (1) and go to the step (xx);
e.g. 10-7), (a positive small number, e.g. 10-7), y
(xv) Set = * and go to the step (xx);
(vector of the dependent variables), X (matrix of
Interpolation of :
the independent variables) and 1 (vector of the [ (
(xvi) Set = max 0.25(1) ; min 0.75(1) ; * ; )]
initial guess of the parameters to be estimated). (xvii) If min go to the step (xx). Else, continue on
Set J = 1 and = 0.01 (Marquardt parameter);
the step (xviii);
Calculate e (vector of the residuals) and
(xviii) Compute = (1 + ) and set J = J + 1 ;
(ii) ( 2)
1 = (1 ) (objective function), where
(xix) If ( 2) < 1 go to the step (xx). Else, set =
(1)
ei = yi f i (X , ) and = ei 2 ; 2
(1)
i
(iii) Calculate q (gradient of ) and A (approxima- and * =
(
2 + ( 2 )
(1)
)
, and return to the
tion of the Hessian matrix of the function ), step (xvi);
1 e (xx) Calculate 2 = 1 + ;
where qi = = 2 j e j j and
i i Termination:
(xxi) The criterion of termination is tested, using 1
e ek
Aij = 2k k ; and 2 , as an example suggested by Marquardt
i j (1963), is given according to the following equa-
i j Pij = 0 tion:
(iv) Calculate Pi = j, Aij = 0Pij = 1 i +1, j i , j j ... j = 1,2,..., l
i = j, A 0P = A
ij ij ij (
where j = 10 4 i , j + 10 3 . )
(v) Calculate A + P , reminding that these values If the criterion is satisfied for all parameters, itera-
may be directly evaluated by: tions are terminated and 2 is accepted as the so-
i j Aij + Pij = Aij lution . Otherwise, set = 10 and 1 = 2 ,
*
Aij + Pij i = j , Aij = 0 Aij + Pij = and return to the step (ii).
i = j , A 0 A + P = A (1 + )
ij ij ij ij C. Vapor-Liquid Equilibrium Data Regression
(vi) Calculate = (A + P ) q (vector in the direc-
1 In order to demonstrate the applicability of the imple-
mented Levenberg-Marquardt method, two programs
tion of the proposed step), = 1 + and
(1)
for correlating vapor-liquid equilibrium data have been
(1)
= ( ), (1)
where (A + P ) 1
and are
developed.
Antoine Constants Estimation
evaluated by the Cholesky method, see, e.g., Fox The first program allows data correlation of vapor pres-
(1964), which is specific for the inversion of a sure and temperature for pure components, using the
definite positive matrix; Antoine equation. In Eq. (1) we have that Psat is the va-
(vii) If (1) < 1 accept 2 = , replace by
(1)
por pressure, T is the saturation temperature, and A, B
max(0.1 ,) and go to the step (xxi). Or else, and C are the adjusted Antoine constants. This form of
the Antoine equation is usual in the literature; however
continue from the step (viii);
(viii) Compute (1) = 2 J , (1) = 1 + (1) and ( ) the user may, easily, apply a modified version of the
correlation both in terms of the logarithm base and
=q .
T
With these values units.
log10 P sat (mmHg ) = A
[2( )] is calculated;
B
(1) 2 (1)
* = + (1) T ( C ) + C
(1)
rameters to be estimated, name of the substance, number Table 1. Correlation and consistency test of the vapor-liquid
of data points and list of the experimental pairs of vapor equilibrium data for the n-heptane(1) + ethyl butyrate(2) at
pressure and saturation temperature. Indication of the 100 C (Kojima and Tochigi, 1979).
units and the literature source from which the data has Model A B P (%) y1**
been retrieved is also requested. An output is provided Margules 0.5563 1.36 0.0057
where information about the iterations performed during 2- suffixes
the execution is registered, allowing the detection and Margules 0.7486 0.4059 0.87 0.0097
identification of an eventual error. After convergence, 3- suffixes
the values of the estimated constants are displayed to- Van Laar 0.4664 0.5769 0.76 0.0096
Wilson 0.3928 1.1612 1.02 0.0089
gether with respective interval confidences, standard
NTRL* 1.2171 -0.4020 0.98 0.0091
deviations and correlation matrix of the parameters. The * C is the random parameter and has been set to 0.3, as default value.
program also provides the relative and absolute devia- ** The values of the absolute average deviation are lower than 0.01
tions in terms of vapor pressure and the estimation of ( y1 < 0 . 01 ), indicating that the data are considered to be consistent,
the normal boiling point, at 760 mmHg, using the ob- according to Fredenslund et al. (1977).
tained correlation. Results for propyl acetate have been
It may be pointed out that the activity coefficients
compared with Boublik et al. (1984) and validated the
depend on the temperature, liquid mole fraction and
implemented program. The Antoine correlation for the
their parameters, which are adjusted from phase equilib-
propyl acetate has presented relative deviation (P) of rium data reduction. To give an illustration, Eq. (5)
0.04% and estimated the following parameters with cor- shows the simple Margules 2-suffixes gamma model,
responding confidence intervals: A = 7.030080.03391, for both components.
B = 1290.20019.505 and C = 209.4662.161.
ln 1 = Ax22 ; ln 2 = Ax12 (5)
Reduction and consistency test of vapor-liquid equilib-
Therefore, the data reduction for the mixture is simi-
rium data for binary systems
lar to the Antoine correlation, and may also be repre-
The second program developed is to accomplish the cor-
sented by Eq. (2), which defines the objective function
relation of vapor-liquid equilibrium data for mixtures,
in terms of the pressure. For the mixture the differences
using activity coefficient models presented in the litera-
are that the saturation pressure is replaced by the total
ture (Prausnitz et al., 1999), i.e. Margules 2-suffixes,
pressure and the parameters come from the activity co-
Margules 3-suffixes, Van Laar, Wilson and NRTL
efficient model instead of the Antoine equation. After
(Non-Random Two Liquids). Therefore, data regression
the data regression, the vapor composition may be
consists of the corresponding parameter estimation of
evaluated, according to Eq. (6).
the activity coefficient model. In the case that the VLE
data set is complete, i.e. presents the values of tempera- 1 x1 P1sat
y1,calcd = (6)
ture, total pressure, liquid and vapor compositions, the x1 1 P1 + (1 x1 ) 2 P2sat
sat
correlation tests also the thermodynamic consistency of The vapor-liquid equilibrium data set for the n-
the experimental data set. This is due to the fact that the heptane(1) + ethyl butyrate(2) system at 100 C pre-
activity coefficient models (i) respect the exact thermo- sented by Kojima and Tochigi (1979) has been used to
dynamic definition of partial molar excess Gibbs en- test the nonlinear regression method implemented. The
ergy. developed program allows parameter estimation of the
(
ln i
)
n G E RT GE
= i
five activity coefficient models listed at Table 1. It may
(3) be observed that all models have fitted satisfactorily the
ni T , P ,n RT
i j experimental data. Furthermore, the deviations pre-
Thus, the Euler theorem may be applied, i.e. the ad- sented indicate that the experimental data is consistent.
ditive property, together with the fundamental equation Concerning the operation of the program for correlating
for GE, resulting in the so-called Gibbs-Duhem relation, vapor-liquid equilibrium data of mixtures, it may be
see Prausnitz et al. (1999). This is the base of the ther- pointed out that all information relative to the system is
modynamic consistency test of an experimental phase given by the input file. The model is chosen during the
equilibrium data set. We may find in the literature, in execution of the program, together with the initial guess
general, two tests for thermodynamic consistency of of the gamma coefficients and the Marquardt parameter.
VLE data, i.e. area test and deviation test. In our case, An output file is also created. Similar to the Antoine
we have applied the deviation test which is in fact a data program, this output file contains information related to
correlation followed by the analysis of the deviations the iterations realized, during the execution of the
(see Fredenslund et al., 1977). We may describe, easily, Levenberg-Marquardt method.
the VLE data correlation of a binary system by writing After convergence, the values of the estimated pa-
the total pressure equation (Barker, 1953), and neglect- rameters together with confidence intervals are pre-
ing the nonidealities of the vapor phase, which is a rea- sented together with the correlation matrix and standard
sonable simplification for low pressures and nonasso- deviations. Furthermore, the dependent variables are
ciating components. properly compared, and for the case of isothermic data,
Pcalcd = x11 P1sat + (1 x1 ) 2 P2sat (4) the percent average pressure deviation and the absolute
average mole fraction of the vapor phase deviation are
displayed, from which a thermodynamic consistence Table 3: Estimated UNIQUAC interaction parameters (aij) in
evaluation of the equilibrium data is prompt provided. kelvin for the studied systems with methanol (MeOH), ethanol
(EtOH), water (H2O) and sodium chloride (NaCl)
Vapor-liquid equilibrium correlation for mixtures with i \ j MeOH EtOH H2O NaCl
electrolytes MeOH 0.00 432.85a -103.32b -932.37d
The Levenberg-Marquardt method was also applied for EtOH -261.57a 0.00 -12.47c -878.07d
two aqueous ternary mixtures with methanol and NaCl H2O 150.07b 166.12c 0.00 -925.33d
and ethanol and NaCl with the second program. The NaCl 5817.00d 4722.55d 53.67d 0.00
a
corresponding binary systems have also been correlated. Parameters estimated from methanol+ethanol VLE data (Niesen et.
The UNIQUAC activity coefficient model (Abrams and al., 1986; Kurihara et al., 1993).
b
Parameters estimated from methanol+water VLE data (Soujanya et.
Prausnitz, 1975) was applied in its original form and al., 2010; Yao et. al., 1999; Kurihara et al., 1993).
considering NaCl as one molecular species, i.e., neglect- c
Parameters estimated from ethanol+water VLE data (Pemberton and
ing the dissociation. Mash, 1978; Niesen et. al., 1986; Kurihara et al., 1993, 1995; Arce et.
Table 2 reports structural parameters used for the al., 1996; Navarro-Espinosa et al., 2010; Lai et al. 2014).
d
Parameters estimated from water+NaCl, methanol+water+NaCl and
studied species. It should be pointed out that structural ethanol+water+NaCl VLE data (Clarke and Glew, 1985; Gmehling,
parameters of the salt species, i.e., surface area and vol- 1997; Yang and Lee, 1998; Jdecke et al., 2005), fixing
ume parameters were determined from the values of the MeOH+EtOH, MeOH+H2O and EtOH+H2O parameters determined
water and a molar mass ratio. Two goals have been previouslya,b,c.
achieved using this approach. One was to provide data
fitting capability with a reasonable order of magnitude
of the structural parameters. Secondly, compatibility
with the interaction parameters estimated for non-
electrolyte binary mixtures are encountered. This is also
an important feature for predictability of the model and
group contribution applications like UNIFAC (Kikic et
al., 1991). Values of r and q for ionic species have been
fitted by Macedo et al. (1990). Another approach en-
countered in the literature is the increment of the pa-
rameters from the ionic radii by considering solvation.
However, the use of these two methods demands esti-
mation of new solvent-solvent parameters and thereby
compatibility requirement is not fulfilled. By the other
hand, using the values of r and q calculated from the
values of water and a ratio of the molar masses, as pre- Fig. 1. Vapor-liquid equilibrium diagrams for metha-
sented in Table 2, it was obtained the desired compati- nol(1)+water(2)+NaCl(3) at 314.6 K; solid symbols experi-
bility and simultaneously good correlation capability, mental (Jdecke et. al., 2005) and open symbols: UNIQUAC
eliminating the problem of low structural values due to this work: z and {, x1 =0.0328; S and U, x1=0.0789;
the size of the ion for UNIQUAC equation. and , x1=0.216; T and V, x1=0.466.
Table 3 presents the estimated UNIQUAC interac-
tion parameters for the species studied. It should be
pointed out that the non-electrolyte binary systems have
been correlated initial and separately and then with
these predetermined values the salt-solvent constants
were estimated from the corresponding experimental
data. All calculations have presented absolute average
deviation in terms of vapor mole fraction lower than
0.01 and relative average deviation in terms of pressure
less than 2%. These deviations indicate the consistency
of the experimental data and also the quality of the pa-
rameters that gather many experimental points and dif-
ferent sources.
Figures 1 and 2 illustrate the quality of the correla-
tion obtained for the aqueous ternary systems with
methanol and NaCl at 314.6 K and with ethanol and
Fig. 2. VLE y-x diagram for the system ethanol(1)+water
NaCl at 700 mmHg, respectively.
(2)+NaCl(3) at 700 mmHg; 32 experimental points with salt
Table 2: Structural parameters for UNIQUAC model. mole fraction in the range of 0.001-0.1; z experimental data
Species i Methanol Ethanol Water NaCl (Gmehling, 1997); { calculated values with UNIQUAC (this
ri 1.4311 2.1055 0.9200 2.9845a work).
qi 1.4320 1.9720 1.4000 4.5417b
a
ri = rwater (M i M water ) ; b qi = qwater (M i M water )
York (1964). Niesen, V., A. Palavra, A.J. Kidnay and V.F. Yesavage,
Fredenslund, A., J. Gmehling and P. Rasmussen, Vapor- An apparatus for vapor-liquid equilibrium at ele-
Liquid Equilibria Using UNIFAC, Elsevier, Am- vated temperatures and pressures and selected re-
sterdan (1977). sults for the water-ethanol and methanol-ethanol
Gmehling, J., Dortmund Data Bank (DDB) systems, Fluid Phase Equil., 31, 283-298 (1986).
electrolytes (ELE). Oldenburg, Germany: DDBST Pemberton, R.C. and C.J. Mash, Thermodynamic
GmbH (1997). properties of aqueous non-electrolyte mixtures II.
Haghtalab, A. and K. Peyvandi, Electrolyte- Vapour pressures and excess Gibbs energies for
UNIQUAC-NRF model for the correlation of the water + ethanol at 303.15 to 363.15 K determined
mean activity coefficient of electrolyte solutions, by an accurate static method, J. Chem. Thermo-
Fluid Phase Equilibria, 281, 163171 (2009). dynamics, 10, 867-888 (1978).
Jdecke, M., A.P.S. Kamps and G. Maurer, Experi- Prausnitz, J.M., R.N. Lichtenthaler and E.G. Azevdo,
mental Investigation of the Influence of NaCl on Molecular Thermodynamics of Fluid Phase Equi-
the Vapor-Liquid Equilibrium of CH3OH + H2O, libria, Prentice-Hall (1999).
J. Chem. Eng. Data, 50, 138-141 (2005). Soujanya, J., B. Satyavathi and T.E. Vittal Prasad, Ex-
Kikic, I., M. Fermeglia and P. Rasmussen, UNIFAC perimental (vapour + liquid) equilibrium data of
Prediction of Vapor-Liquid Equilibria in Mixed (methanol + water + glycerol) and (methanol +
Solvent-Salt Systems, Chemical Eng. Science, 46, glycerol) systems at atmospheric and sub-
2775-2780 (1991). atmospheric pressures, J. Chem. Thermod., 42,
Kojima, K. and K. Tochigi, Prediction of Vapor-Liquid 621-624 (2010).
Equilibria by the ASOG, Elsevier, Amsterdam Thomsen, K., M.C. Iliuta and P. Rasmussen, Extended
(1979). UNIQUAC model for correlation and prediction of
Kurihara, K. M. Nakamichi and K. Kojima, Isobaric vaporliquidliquidsolid equilibria in aqueous
vapor-liquid equilibria for methanol + ethanol + salt systems containing non-electrolytes. Part B.
water and the three constituent binary systems, J. Alcohol (ethanol, propanols, butanols)watersalt
Chem. Eng. Data, 38, 446-449 (1993). systems, Chem. Eng. Sci., 59, 36313647 (2004).
Kurihara, K., T. Minoura, K. Takeda and K. Kojima, Yang, S. and C.S. Lee, Vapor-Liquid Equilibria of Wa-
Isothermal Vapor-Liquid Equilibria for Methanol ter + Methanol in the Presence of Mixed Salts, J.
+ Ethanol+Water, Methanol+Water, and Ethanol + Chem. Eng. Data, 43, 558-561 (1998).
Water, J. Chem. Eng. Data, 40, 679-684 (1995). Yao, J., H. Li and S. Han, Vaporliquid equilibrium
Lai, H.S., Y. Lin and C.-H. Tu, Isobaric (vapor + liq- data for methanolwaterNaCl at 45C, Fluid
uid) equilibria for the ternary system of (ethanol + Phase Equil., 162, 253-260 (1999).
water + 1,3-propanediol) and three constituent bi-
nary systems at P = 101.3 kPa, J. Chem. Ther-
mod., 68, 13-19 (2014).
Lazzs, J.A., Optimization of activity coefficient mod-
els to describe vaporliquid equilibrium of (alco-
hol + water) mixtures using a particle swarm algo-
rithm, Comp. and Mathem. with Applicat., 60,
22602269 (2010).
Levenberg, K., A method for the solution of certain
nonlinear problems in least squares, Quart. Appl.
Math., 2, 164-168 (1944).
Loehe, J.R. and M.D. Donohue, Recent advances in
modeling thermodynamic properties of aqueous
strong electrolyte systems, AIChE J., 43, 1, 180
195 (1997).
Macedo, E.A., P. Skovborg and P. Rasmussen, Calcu-
lation of phase equilibria for solutions of strong
eletrolytes in solvent-water mixtures, Chem. Eng.
Sci., 45, 875-882 (1990).
Maquardt, D.W., An algorithm for least squares esti-
mation of nonlinear parameters, SIAM J., 11, 431-
441 (1963).
Navarro-Espinosa, I.R., C.A. Cardona and J.A. Lpez,
Experimental measurements of vaporliquid
equilibria at low pressure: Systems containing al-
cohols, esters and organic acids, Fluid Phase
Equil., 287, 141-145 (2010).
APNDICE B PROGRAMA
COMPUTACIONAL VLE
62 </ w i d g e t>
63 </ i t e m>
64 </ l a y o u t>
65 </ i t e m>
66 <i t e m>
67 <l a y o u t c l a s s=" QHBoxLayout " name=" h o r i z o n t a l L a y o u t _ 3 ">
68 <i t e m>
69 <w i d g e t c l a s s=" QCheckBox " name=" checkBox_TRange ">
70 <p r o p e r t y name=" t e x t ">
71 < s t r i n g>& ; Use o n l y e x p e r i m e n t a l d a t a i n t h e t e m p e r a t u r e r a n g e ( oC ) :</ s t r i n g>
72 </ p r o p e r t y>
73 </ w i d g e t>
74 </ i t e m>
75 <i t e m>
76 <w i d g e t c l a s s=" QLabel " name=" label_TMin ">
77 <p r o p e r t y name=" e n a b l e d ">
78 <b o o l> f a l s e</ b o o l>
79 </ p r o p e r t y>
80 <p r o p e r t y name=" t e x t ">
81 < s t r i n g>Mi& ; nimum =</ s t r i n g>
82 </ p r o p e r t y>
83 <p r o p e r t y name=" buddy ">
84 < c s t r i n g>lineEdit_TMin</ c s t r i n g>
85 </ p r o p e r t y>
86 </ w i d g e t>
87 </ i t e m>
88 <i t e m>
89 <w i d g e t c l a s s=" QLineEdit " name=" lineEdit_TMin ">
90 <p r o p e r t y name=" e n a b l e d ">
91 <b o o l> f a l s e</ b o o l>
92 </ p r o p e r t y>
93 </ w i d g e t>
94 </ i t e m>
95 <i t e m>
96 <w i d g e t c l a s s=" QLabel " name=" label_TMax ">
97 <p r o p e r t y name=" e n a b l e d ">
98 <b o o l> f a l s e</ b o o l>
99 </ p r o p e r t y>
100 <p r o p e r t y name=" t e x t ">
101 < s t r i n g>Ma& ; ximum =</ s t r i n g>
102 </ p r o p e r t y>
103 <p r o p e r t y name=" buddy ">
104 < c s t r i n g>lineEdit_TMax</ c s t r i n g>
105 </ p r o p e r t y>
106 </ w i d g e t>
107 </ i t e m>
108 <i t e m>
109 <w i d g e t c l a s s=" QLineEdit " name=" lineEdit_TMax ">
110 <p r o p e r t y name=" e n a b l e d ">
111 <b o o l> f a l s e</ b o o l>
112 </ p r o p e r t y>
113 </ w i d g e t>
114 </ i t e m>
115 </ l a y o u t>
116 </ i t e m>
117 <i t e m>
118 <w i d g e t c l a s s=" QTextEdit " name=" t e x t E d i t " />
119 </ i t e m>
120 <i t e m>
121 <l a y o u t c l a s s=" QHBoxLayout " name=" h o r i z o n t a l L a y o u t _ 4 ">
122 <i t e m>
123 <w i d g e t c l a s s=" QPushButton " name=" pushButton_Run ">
124 <p r o p e r t y name=" t e x t ">
125 < s t r i n g>& ; Run</ s t r i n g>
126 </ p r o p e r t y>
127 </ w i d g e t>
128 </ i t e m>
129 <i t e m>
130 <s p a c e r name=" h o r i z o n t a l S p a c e r ">
131 <p r o p e r t y name=" o r i e n t a t i o n ">
132 <enum>Q t : : H o r i z o n t a l</enum>
133 </ p r o p e r t y>
134 <p r o p e r t y name=" s i z e H i n t " s t d s e t=" 0 ">
135 < s i z e>
136 <width>40</ width>
137 <h e i g h t>20</ h e i g h t>
138 </ s i z e>
139 </ p r o p e r t y>
140 </ s p a c e r>
141 </ i t e m>
UNIQUAC.py
1 #! / u s r / b i n / env python
2 # c o d i n g : u t f 8
3 from __future__ import d i v i s i o n
4 from PySide . QtGui import Q A p p l i c a t i o n , QDialog , Q F i l e D i a l o g
5 from PySide . QtCore import QFile , QTextStream
6 import s y s
7 from numpy import
8 import m a t p l o t l i b . p y p l o t a s p l t
9
10 import ui_Form
11 import ThermodynamicModels
12 from numpy . f 2 p y . a u x f u n c s import i s a r r a y
13
14 c l a s s Form ( QDialog , ui_Form . Ui_Form ) :
15
16 def __init__ ( s e l f ) :
17 super ( Form , s e l f ) . __init__ ( )
18 s e l f . setupUi ( s e l f )
19 s e l f . t e x t E d i t . s e t S t y l e S h e e t ( f o n t : 8 pt \ " C o u r i e r \ " ; )
20 s e l f . checkBox_FixedAij . s t a t e C h a n g e d . c o n n e c t ( s e l f . t o g g l e C h e c k B o x _ F i x e d A i j )
21 s e l f . checkBox_TRange . s t a t e C h a n g e d . c o n n e c t ( s e l f . toggleCheckBox_TRange )
22 s e l f . pushButton_Browse . c l i c k e d . c o n n e c t ( s e l f . browse )
23 s e l f . pushButton_Run . c l i c k e d . c o n n e c t ( s e l f . r u n C a l c u l a t i o n s )
24 s e l f . pushButton_Exit . c l i c k e d . c o n n e c t ( s e l f . e x i t P r o g r a m )
25 s e l f . show ( )
26
27 def t o g g l e C h e c k B o x _ F i x e d A i j ( s e l f ) :
28 f l a g = s e l f . checkBox_FixedAij . i s C h e c k e d ( )
29 s e l f . lineEdit_FixedAij . setEnabled ( f l a g )
30
31 def toggleCheckBox_TRange ( s e l f ) :
32 f l a g = s e l f . checkBox_TRange . i s C h e c k e d ( )
33 s e l f . label_TMin . s e t E n a b l e d ( f l a g )
34 s e l f . label_TMax . s e t E n a b l e d ( f l a g )
35 s e l f . lineEdit_TMin . s e t E n a b l e d ( f l a g )
36 s e l f . lineEdit_TMax . s e t E n a b l e d ( f l a g )
37
38 def browse ( s e l f ) :
39 s e l f . textEdit . clear ()
40 fName , _ = Q F i l e D i a l o g . getOpenFileName ( s e l f , F i l e n a m e o f t h e d a t a s e t , . , Dataset
( . dat ) ; ; A l l f i l e s ( . ) )
41 i f fName : s e l f . l i n e E d i t _ D a t a f i l e . s e t T e x t ( fName )
42 return
43
44 def r u n C a l c u l a t i o n s ( s e l f ) :
45 fName = s e l f . l i n e E d i t _ D a t a f i l e . t e x t ( )
46 i f fName . s t r i p ( ) == : return
47 i f not Q F i l e ( fName ) . e x i s t s : return
48 s e l f . n l _ r e g r e s s i o n ( fName )
49
50 def e x i t P r o g r a m ( s e l f ) :
51 s e l f . close ()
52
53 def p r i n t T e x t ( s e l f , t e x t ) :
54 s e l f . t e x t E d i t . i n s e r t P l a i n T e x t ( t e x t . d e c o d e ( u t f 8 ) )
55
56 def n l _ r e g r e s s i o n ( s e l f , fName ) :
57 import s c i p y . s t a t s a s s t a t s
58 import s c i p y . o p t i m i z e a s o p t i m i z e
59 s e l f . textEdit . clear ()
60 def readData ( s t r e a m ) : return s t r e a m . r e a d L i n e ( ) . s p l i t ( # ) [ 0 ] . s p l i t ( )
61 f=Q F i l e ( fName )
62 f . open ( Q F i l e . ReadOnly | Q F i l e . T r u n c a t e | Q F i l e . Text )
63 s t r e a m = QTextStream ( f )
64 s e l f . p r i n t T e x t ( D a t a f i l e : {}\ n\n . format ( fName ) )
65 Comp = readData ( s t r e a m ) ; NComp = len (Comp)
66 s e l f . p r i n t T e x t ( VLE System : )
67 f o r i in range (NComp1) :
68 s e l f . p r i n t T e x t ( ( { } ) {} + . format ( i +1 ,Comp [ i ] ) )
69 s e l f . p r i n t T e x t ( ( { } ) {}\n\n . format (NComp, Comp[ 1 ] ) )
70 EqAntoine , r , q = [ ] , [ ] , [ ]
71 f o r i in range (NComp) :
72 EqAntoine_i = [ ]
73 NEqs = i n t ( readData ( s t r e a m ) [ 0 ] )
74 i f NEqs==0: EqAntoine . append ( 0 . )
75 else :
76 f o r j in range ( NEqs ) : EqAntoine_i . append (map( f l o a t , readData ( s t r e a m ) ) )
77 EqAntoine . append ( EqAntoine_i )
78 f o r eq in EqAntoine :
79 i f eq ! = 0 . :
80 i f len ( eq ) >1:
81 T0=None
82 f o r i in range ( len ( eq ) 1) :
83 T1 , T2 , T3 , T4=eq [ i ] [ 2 ] , eq [ i ] [ 1 ] , eq [ i + 1 ] [ 2 ] , eq [ i +1 ][ 1 ]
84 i f i >0: eq [ i 1][ 1]=T0
85 T0=(T2 ( T4T3 )+T3 ( T2T1 ) ) / ( ( T4T3 ) +(T2T1 ) )
86 eq [ 2][ 1]=T0 ; eq [ 1][ 2]=T0
87 f o r i in range (NComp) :
88 l i n e = map( f l o a t , readData ( s t r e a m ) )
89 r . append ( l i n e [ 0 ] ) ; q . append ( l i n e [ 1 ] )
90 r = array ( r ) ; q = array (q)
91 x , y , PExp , TExp = [ ] , [ ] , [ ] , [ ]
92 f o r i in range (NComp) : x . append ( [ ] ) ; y . append ( [ ] )
93 s e l f . printText ( R e f e r e n c e o f data : \ n )
94 NRef , R e f s = 1 , [ ]
95 while not s t r e a m . atEnd ( ) :
96 notUse = i n t ( readData ( s t r e a m ) [ 0 ] )
97 r e f = s t r e a m . r e a d L i n e ( ) . s p l i t ( # ) [ 0 ] . s t r i p ( )
98 SysOrder = map( lambda x : i n t ( x ) 1, readData ( s t r e a m ) )
99 NPoints = SysOrder . pop ( ) +1
100 SysType = len ( SysOrder )
101 NOutOfRange = 0
102 f o r _ in range ( NPoints ) :
103 l i n e = map( f l o a t , readData ( s t r e a m ) )
104 i f notUse : continue
105 i f s e l f . checkBox_TRange . i s C h e c k e d ( ) :
106 i f l i n e [ 1] < f l o a t ( s e l f . lineEdit_TMin . t e x t ( ) ) or
l i n e [ 1] > f l o a t ( s e l f . lineEdit_TMax . t e x t ( ) ) :
107 NOutOfRange += 1
108 continue
109 f o r i in range ( SysType 1) :
110 x [ SysOrder [ i ] ] . append ( l i n e [ i ] )
111 y [ SysOrder [ i ] ] . append ( l i n e [ i+SysType 1] )
112 x [ SysOrder [ SysType 1 ] ] . append (1. sum( l i n e [ 0 : SysType 1] ) )
113 y [ SysOrder [ SysType 1 ] ] . append (1. sum( l i n e [ SysType 1:2 SysType 2] ) )
114 f o r i in s e t ( range (NComp) )s e t ( SysOrder ) :
115 x [ i ] . append ( 0 . )
116 y [ i ] . append ( 0 . )
117 PExp . append ( l i n e [ 2 ] )
118 TExp . append ( l i n e [ 1 ] )
119 R e f s . append ( NRef )
120 i f notUse : txtNoUsed = (>>NOTUSED<<)
121 else : txtNoUsed =
122 i f SysType < 1 :
123 s e l f . p r i n t T e x t ( \n=>ERROR: SysType < 2 )
124 e l i f SysType == 2 :
125 s e l f . p r i n t T e x t ( {: <35} . format ( ( { } ) B i n a r y VLE System
{ } : . format ( NRef , tuple ( a r r a y ( SysOrder ) +1) ) ) )
126 e l i f SysType == 3 :
127 s e l f . p r i n t T e x t ( {: <35} . format ( ( { } ) Ternary VLE System
{ } : . format ( NRef , tuple ( a r r a y ( SysOrder ) +1) ) ) )
128 e l i f SysType == 4 :
129 s e l f . p r i n t T e x t ( {: <35} . format ( ( { } ) Q u at e r na r y VLE System
{ } : . format ( NRef , tuple ( a r r a y ( SysOrder ) +1) ) ) )
130 e l i f SysType > 4 :
131 s e l f . p r i n t T e x t ( {: <35} . format ( ( { } ) {}nary VLE System
{ } : . format ( SysType , tuple ( NRef , a r r a y ( SysOrder ) +1) ) ) )
132 s e l f . p r i n t T e x t ( { : 4 g } { : 4 g } ( ou t o f T r a n g e ) = { : 4 g } p o i n t s => {}{}\ n \
133 . format ( NPoints , NOutOfRange , NPointsNOutOfRange , r e f , txtNoUsed ) )
134 NRef += 1
135 f . close ()
136 x = array ( x ) .T; y = array ( y ) .T; PExp = a r r a y ( PExp ) ; TExp = a r r a y ( TExp ) ; NRef = a r r a y ( NRef )
137 PSat = [ ]
138 f o r T in TExp :
139 PSat_i = [ ]
140 f o r i in range (NComp) :
141 i f type ( EqAntoine [ i ] )==f l o a t : PSat_i . append ( 0 . )
142 else :
143 eqUsed = F a l s e
144 f o r eq in EqAntoine [ i ] :
145 A, B , C, T1 , T2 = eq
146 i f T1<=T<T2 :
147 PSat_i . append ( 1 0 (AB/ (C+T) ) )
148 eqUsed = True ; break
149 i f eqUsed : continue
150 s e l f . p r i n t T e x t ( \n=>ERROR: I m p o s s i b l e t o c a l c u l a t e PSat )
151 s e l f . p r i n t T e x t ( w i t h o u t A n t o i n e E q u a t i o n ( { } ) f o r T= {} C . \
152 . format (Comp [ i ] , T) )
153 return
154 PSat . append ( PSat_i )
155 PSat = a r r a y ( PSat )
156 TExp += 2 7 3 . 1 5 # C => K
157 theta_fixed_i , theta_fixed = [ ] , [ ]
158 def f_LCtoI ( l , c , n ) :
159 a = l n+c ; return aa / / ( n+1)1
160 def f_ItoLC ( i , n ) :
161 l = i / / ( n1) ; c = i %(n1)
162 i f c>=l : c+=1
163 return l , c
164 i f s e l f . checkBox_FixedAij . i s C h e c k e d ( ) :
165 f o r v a l u e in s e l f . l i n e E d i t _ F i x e d A i j . t e x t ( ) . s p l i t ( , ) :
166 l i n , c o l , num = map( eval , v a l u e . s p l i t ( ) )
167 t h e t a _ f i x e d _ i . append ( f_LCtoI ( l i n 1 , c o l 1 ,NComp) )
168 t h e t a _ f i x e d . append (num)
169 t h e t a _ i = sorted ( s e t ( range (NComp (NComp1) ) )s e t ( t h e t a _ f i x e d _ i ) )
170 def f (X, t h e t a ) :
171 f o r i , num in zip ( t h e t a _ i , t h e t a ) : a [ f_ItoLC ( i , NComp) ] = num
172 gamma = ThermodynamicModels .UNIQUAC( r , q , a , X, TExp )
173 return a r r a y (map(sum, Xgamma PSat ) )
174 def plus_minus ( a , b ) : return ab , a+b
175 t h e t a 0 = ( random . rand (NComp (NComp1)len ( t h e t a _ f i x e d ) ) 2 0 0 0 1 0 0 0 . ) . a s t y p e ( i n t ) . a s t y p e ( f l o a t )
176 N, P = x . s h a p e [ 0 ] , t h e t a 0 . s h a p e [ 0 ]
177 a = z e r o s ( ( NComp, NComp) )
178 f o r i , num in zip ( t h e t a _ f i x e d _ i , t h e t a _ f i x e d ) : a [ f_ItoLC ( i , NComp) ] = num
179 s e l f . p r i n t T e x t ( \ n A i j = [ [ )
180 idx = 0
181 f o r i in range (NComp) :
182 f o r j in range (NComp) :
183 i f i==j : s e l f . p r i n t T e x t ( { : ^ 1 0 } . format ( 0 ) )
184 else :
185 k = f_LCtoI ( i , j , NComp)
186 i f k in t h e t a _ f i x e d _ i :
187 s e l f . p r i n t T e x t ( { : ^ 1 0 } . format ( { : 7 . 2 f } . format ( t h e t a _ f i x e d [ t h e t a _ f i x e d _ i . i n d e x ( k ) ] ) ) )
188 else :
189 s e l f . p r i n t T e x t ( { : ^ 1 0 } . format ( t h e t a [ { } ] . format ( i d x ) ) ) ; i d x+=1
190 i f i < NComp1: s e l f . p r i n t T e x t ( ] \ n [ )
191 s e l f . p r i n t T e x t ( ] ] \ n\ n I n i t i a l Guess : \ n A i j = [ [ )
192 l =0
APNDICE C PROGRAMA
COMPUTACIONAL JAFOSSMS
Form2.ui
1 <?xml version=" 1 . 0 " e n c o d i n g="UTF8" ?>
2 <u i version=" 4 . 0 ">
3 < c l a s s>Form</ c l a s s>
4 <w i d g e t c l a s s=" QWidget " name=" Form ">
5 <p r o p e r t y name=" geometry ">
6 <r e c t>
7 <x>0</x>
8 <y>0</y>
9 <width>752</ width>
10 <h e i g h t>485</ h e i g h t>
11 </ r e c t>
12 </ p r o p e r t y>
13 <p r o p e r t y name=" s i z e P o l i c y ">
14 < s i z e p o l i c y h s i z e t y p e=" Minimum " v s i z e t y p e=" Minimum ">
15 <h o r s t r e t c h>0</ h o r s t r e t c h>
16 <v e r s t r e t c h>0</ v e r s t r e t c h>
17 </ s i z e p o l i c y>
18 </ p r o p e r t y>
19 <p r o p e r t y name=" w i n d o w T i t l e ">
20 < s t r i n g>JAFO S a l t S o l u b i l i t i e s i n Mixed S o l v e n t s (JAFOSSMS)</ s t r i n g>
21 </ p r o p e r t y>
22 <l a y o u t c l a s s=" QVBoxLayout " name=" v e r t i c a l L a y o u t _ 6 ">
23 <i t e m>
24 <l a y o u t c l a s s=" QHBoxLayout " name=" h o r i z o n t a l L a y o u t _ D a t a f i l e ">
25 <i t e m>
26 <w i d g e t c l a s s=" QLabel " name=" l a b e l _ D a t a f i l e ">
27 <p r o p e r t y name=" f o n t ">
28 <f o n t>
29 <f a m i l y>Ubuntu</ f a m i l y>
30 < p o i n t s i z e>11</ p o i n t s i z e>
31 </ f o n t>
32 </ p r o p e r t y>
33 <p r o p e r t y name=" t e x t ">
34 < s t r i n g>& ; D a t a f i l e :</ s t r i n g>
35 </ p r o p e r t y>
36 <p r o p e r t y name=" buddy ">
37 < c s t r i n g>l i n e E d i t _ D a t a f i l e</ c s t r i n g>
38 </ p r o p e r t y>
39 </ w i d g e t>
40 </ i t e m>
41 <i t e m>
42 <w i d g e t c l a s s=" QLineEdit " name=" l i n e E d i t _ D a t a f i l e ">
43 <p r o p e r t y name=" f o n t ">
44 <f o n t>
45 <f a m i l y>Ubuntu</ f a m i l y>
46 < p o i n t s i z e>11</ p o i n t s i z e>
47 </ f o n t>
48 </ p r o p e r t y>
49 </ w i d g e t>
50 </ i t e m>
51 <i t e m>
52 <w i d g e t c l a s s=" QPushButton " name=" pushButton_Datafile_Browse ">
53 <p r o p e r t y name=" f o n t ">
54 <f o n t>
55 <f a m i l y>Ubuntu</ f a m i l y>
56 < p o i n t s i z e>11</ p o i n t s i z e>
57 </ f o n t>
58 </ p r o p e r t y>
59 <p r o p e r t y name=" t e x t ">
60 < s t r i n g>& ; Browse</ s t r i n g>
61 </ p r o p e r t y>
136 APNDICE C. PROGRAMA COMPUTACIONAL JAFOSSMS
62 </ w i d g e t>
63 </ i t e m>
64 </ l a y o u t>
65 </ i t e m>
66 <i t e m>
67 <w i d g e t c l a s s=" QTabWidget " name=" tabWidget_1 ">
68 <p r o p e r t y name=" e n a b l e d ">
69 <b o o l> f a l s e</ b o o l>
70 </ p r o p e r t y>
71 <p r o p e r t y name=" f o n t ">
72 <f o n t>
73 <f a m i l y>Ubuntu</ f a m i l y>
74 </ f o n t>
75 </ p r o p e r t y>
76 <p r o p e r t y name=" c u r r e n t I n d e x ">
77 <number>0</ number>
78 </ p r o p e r t y>
79 <w i d g e t c l a s s=" QWidget " name=" t a b _ G e n e r a l R e p o r t ">
80 < a t t r i b u t e name=" t i t l e ">
81 < s t r i n g>GENERAL & ;REPORT</ s t r i n g>
82 </ a t t r i b u t e>
83 <l a y o u t c l a s s=" QVBoxLayout " name=" v e r t i c a l L a y o u t _ 4 ">
84 <i t e m>
85 <w i d g e t c l a s s=" QTextEdit " name=" t e x t E d i t _ G e n e r a l R e p o r t " />
86 </ i t e m>
87 <i t e m>
88 <l a y o u t c l a s s=" QHBoxLayout " name=" h o r i z o n t a l L a y o u t _ S a v e _ P r i n t _ G e n e r a l R e p o r t ">
89 <i t e m>
90 <w i d g e t c l a s s=" QPushButton " name=" pushButton_SaveGeneralReport ">
91 <p r o p e r t y name=" t e x t ">
92 < s t r i n g>Sa& ; ve G e n e r a l Report</ s t r i n g>
93 </ p r o p e r t y>
94 </ w i d g e t>
95 </ i t e m>
96 <i t e m>
97 <w i d g e t c l a s s=" QPushButton " name=" p u s h B u t t o n _ P r i n t G e n e r a l R e p o r t ">
98 <p r o p e r t y name=" t e x t ">
99 < s t r i n g>& ; P r i n t G e n e r a l Report</ s t r i n g>
100 </ p r o p e r t y>
101 </ w i d g e t>
102 </ i t e m>
103 </ l a y o u t>
104 </ i t e m>
105 </ l a y o u t>
106 </ w i d g e t>
107 <w i d g e t c l a s s=" QWidget " name=" t a b _ S i n g l e S o l v e n t ">
108 < a t t r i b u t e name=" t i t l e ">
109 < s t r i n g>& ; SINGLE SOLVENT</ s t r i n g>
110 </ a t t r i b u t e>
111 <l a y o u t c l a s s=" QVBoxLayout " name=" v e r t i c a l L a y o u t _ 2 ">
112 <i t e m>
113 <l a y o u t c l a s s=" QGridLayout " name=" g r i d L a y o u t _ P l o t 1 ">
114 <i t e m row=" 0 " column=" 1 ">
115 <l a y o u t c l a s s=" QHBoxLayout " name=" h o r i z o n t a l L a y o u t _ P l o t 1 _ O r d i n a t e ">
116 <i t e m>
117 <w i d g e t c l a s s=" QLabel " name=" l a b e l _ P l o t 1 _ O r d i n a t e _ 1 ">
118 <p r o p e r t y name=" f o n t ">
119 <f o n t>
120 <w e i g h t>75</ w e i g h t>
121 <b o l d>t r u e</ b o l d>
122 </ f o n t>
123 </ p r o p e r t y>
124 <p r o p e r t y name=" t e x t ">
125 < s t r i n g>O r d i n a t e : </ s t r i n g>
126 </ p r o p e r t y>
127 </ w i d g e t>
128 </ i t e m>
129 <i t e m>
130 <w i d g e t c l a s s=" QComboBox " name=" comboBox_Plot1_Ordinate_Concentration ">
131 <p r o p e r t y name=" f o n t ">
132 <f o n t>
133 < p o i n t s i z e>11</ p o i n t s i z e>
134 </ f o n t>
135 </ p r o p e r t y>
136 <i t e m>
137 <p r o p e r t y name=" t e x t ">
138 < s t r i n g>M o l a l i t y</ s t r i n g>
139 </ p r o p e r t y>
140 </ i t e m>
141 <i t e m>
60 s e l f . s e t W i n d o w T i t l e ( Choose t h e i s o t h e r m s f o r r e g r e s s i o n )
61 e l i f comboBox_Mode . c u r r e n t I n d e x ( ) == 1 :
62 T = l i s t ( f_T ( T_prd ) )
63 s e l f . s e t W i n d o w T i t l e ( Choose t h e i s o t h e r m s f o r p r e d i c t i o n )
64 else :
65 s e l f . reject ()
66 s e l f . lineEdit = lineEdit
67 T_set = s e t (map( eval , l i n e E d i t . t e x t ( ) . s p l i t ( ) ) )
68 s e l f . T_sorted = sorted ( s e t (T) | T_set )
69 l a y o u t = QGridLayout ( )
70 s e l f . c h e c k b o x s= [ ]
71 f o r c o l in range ( 4 ) :
72 row = 0
73 f o r t in s e l f . T_sorted [ c o l : : 4 ] :
74 n = T. count ( t )
75 if n < 1:
76 cb = QCheckBox ( {} {} ( none p o i n t ) . d e c o d e ( u t f 8 ) . format ( t , str_T ) )
77 e l i f n == 1 :
78 cb = QCheckBox ( {} {} ( 1 p o i n t ) . d e c o d e ( u t f 8 ) . format ( t , str_T ) )
79 elif n > 1:
80 cb = QCheckBox ( {} {} ( { } p o i n t s ) . d e c o d e ( u t f 8 ) . format ( t , str_T , n ) )
81 l a y o u t . addWidget ( cb , row , c o l )
82 i f t in T_set :
83 cb . s e t C h e c k e d ( True )
84 row += 1
85 s e l f . c h e c k b o x s . append ( cb )
86 buttonBox = QDialogButtonBox ( QDialogButtonBox . C a n c e l | QDialogButtonBox . Ok)
87 l a y o u t . addWidget ( buttonBox , row +1 , 0 , 1 , 4 )
88 buttonBox . a c c e p t e d . c o n n e c t ( s e l f . a c c e p t )
89 buttonBox . r e j e c t e d . c o n n e c t ( s e l f . r e j e c t e d )
90 s e l f . setLayout ( layout )
91
92 def a c c e p t ( s e l f ) :
93 T = [ eval ( cb . t e x t ( ) . s p l i t ( ) [ 0 ] ) f o r cb in s e l f . c h e c k b o x s i f cb . i s C h e c k e d ( ) ]
94 s e l f . l i n e E d i t . s e t T e x t ( . j o i n (map( s tr , sorted (T) ) ) )
95 QDialog . a c c e p t ( s e l f )
96
97 def r e j e c t e d ( s e l f ) :
98 QDialog . r e j e c t e d ( s e l f )
99
100 c l a s s JAFOSSMS( QDialog , ui_Form . Ui_Form ) :
101 def __init__ ( s e l f ) :
102 super (JAFOSSMS, s e l f ) . __init__ ( )
103 s e l f . setupUi ( s e l f )
104 s e l f . comboBox_Isotherms_Temperature_index = 0
105 s e l f . t e x t D o c u m e n t _ S t a t i s t i c s = QTextDocument ( )
106 s e l f . textDocument_GeneralReport = QTextDocument ( )
107 s e l f . t e x t E d i t _ S t a t i s t i c s . setDocument ( s e l f . t e x t D o c u m e n t _ S t a t i s t i c s )
108 s e l f . t e x t E d i t _ G e n e r a l R e p o r t . setDocument ( s e l f . textDocument_GeneralReport )
109 s e l f . t e x t E d i t _ S t a t i s t i c s . s e t S t y l e S h e e t ( f o n t : 8 pt \ " C o u r i e r \ " ; )
110 s e l f . t e x t E d i t _ G e n e r a l R e p o r t . s e t S t y l e S h e e t ( f o n t : 8 pt \ " C o u r i e r \ " ; )
111 s e l f . textCursor_Statistics = s e l f . textEdit_Statistics . textCursor ()
112 s e l f . textCursor_GeneralReport = s e l f . textEdit_GeneralReport . textCursor ( )
113 r e = ( ( [ + ] ? ( ( \ d [ . ] ? \ d+) | ( \ d + [ . ] ? \ d ) ) ( [ eE ] [ + ] ? \ d+) ? ) \ s )
114 editor = s e l f . lineEdit_Isotherms
115 v a l i d a t o r = QRegExpValidator ( QRegExp ( r e ) , e d i t o r )
116 s e l f . lineEdit_Isotherms . setValidator ( validator )
117 s e l f . pushButton_Datafile_Browse . c l i c k e d . c o n n e c t ( s e l f . browse )
118 s e l f . pushButton_Plot1 . c l i c k e d . c o n n e c t ( s e l f . p l o t 1 )
119 s e l f . pushButton_Plot2 . c l i c k e d . c o n n e c t ( s e l f . p l o t 2 )
120 s e l f . pushButton_Plot3 . c l i c k e d . c o n n e c t ( s e l f . p l o t 3 )
121 s e l f . pushButton_Plot4 . c l i c k e d . c o n n e c t ( s e l f . p l o t 4 )
122 s e l f . pushButton_Run . c l i c k e d . c o n n e c t ( s e l f . r u n C a l c u l a t i o n s )
123 s e l f . pushButton_Exit . c l i c k e d . c o n n e c t ( qApp , SLOT( " q u i t ( ) " ) )
124 s e l f . pushButton_SaveGeneralReport . c l i c k e d . c o n n e c t ( s e l f . s a v e G e n e r a l R e p o r t )
125 s e l f . pushButton_PrintGeneralReport . c l i c k e d . connect ( s e l f . printGeneralReport )
126 s e l f . p u shB u t t o n _ Pr i n t G r a p hi c . c l i c k e d . c o n n e c t ( s e l f . p r i n t G r a p h i c )
127 s e l f . pushButton_SaveStatistics . c l i c k e d . connect ( s e l f . s a v e S t a t i s t i c s )
128 s e l f . pushButton_PrintStatistics . c l i c k e d . connect ( s e l f . p r i n t S t a t i s t i c s )
129 s e l f . checkBox_Graphic . s t a t e C h a n g e d . c o n n e c t ( s e l f . s h o w N a v i g a t i o n T o o l b a r )
130 s e l f . comboBox_Plot1_Abscissa_Temperature . c u r r e n t I n d e x C h a n g e d . c o n n e c t (
131 s e l f . clearGraphicsAndStatistics )
132 s e l f . comboBox_Plot1_Ordinate_Concentration . c u r r e n t I n d e x C h a n g e d . c o n n e c t (
133 s e l f . clearGraphicsAndStatistics )
134 s e l f . comboBox_Plot1_Ordinate_Solvent . c u r r e n t I n d e x C h a n g e d . c o n n e c t (
135 s e l f . clearGraphicsAndStatistics )
136 s e l f . comboBox_Isotherms_Mode . c u r r e n t I n d e x C h a n g e d . c o n n e c t (
137 s e l f . clearGraphicsAndStatistics )
138 s e l f . comboBox_Isotherms_Temperature . c u r r e n t I n d e x C h a n g e d [ i n t ] . c o n n e c t (
139 s e l f . convertTemperature )
299 # ==================================================================================================
300 # PITZER, 1973
301 #
302 def I_b ( s e l f , b_MX) :
303 b_M, b_X = nu_Mb_MX, nu_Xb_MX
304 return (b_Mz_M2.+b_Xz_X 2 . ) / 2 .
305 def X_phi ( s e l f , I_b , b_= 1 . 2 ) :
306 sqrt_I_b = s q r t ( I_b )
307 return sqrt_I_b / ( 1 . +b_ sqrt_I_b )
308 def X_gamma( s e l f , I_b , b_= 1 . 2 ) :
309 sqrt_I_b = s q r t ( I_b )
310 return 2 . / b_ l o g ( 1 . +b_ sqrt_I_b )+ s e l f . X_phi ( I_b )
311 def f_phi_MX ( s e l f , A_phi , X_phi ) :
312 return A_phiX_phi
313 def f_gamma_MX( s e l f , A_phi , X_gamma) :
314 return A_phiX_gamma
315 def Y_phi ( s e l f , I_b , a l p h a = 2 . ) :
316 sqrt_I_b = s q r t ( I_b )
317 return exp( a l p h a sqrt_I_b )
318 def Y_gamma( s e l f , I_b , a l p h a = 2 . ) :
319 sqrt_I_b = s q r t ( I_b )
320 return ( 1 . ( 1 . + a l p h a sqrt_I_b 0.5 a l p h a 2 . I_b ) s e l f . Y_phi ( I_b ) ) / ( a l p h a 2 . I_b )
321 def B_phi_MX( s e l f , beta0_MX , beta1_MX , Y_phi ) :
322 return beta0_MX+beta1_MXY_phi
323 def B_gamma_MX( s e l f , beta0_MX , beta1_MX , Y_gamma) :
324 return 2 . ( beta0_MX+beta1_MXY_gamma)
325 def C_gamma_MX( s e l f , C_phi_MX) :
326 return 1 . 5 C_phi_MX
327 def p h i ( s e l f , b_MX, f_phi_MX , B_phi_MX, C_phi_MX) :
328 return 1+abs (z_Mz_X) f_phi_MX+2.b_MXnu_Mnu_X/nu_MX (B_phi_MX+b_MX (nu_Mnu_X) 0 . 5
329 C_phi_MX)
330 def ln_gamma_MX( s e l f , b_MX, f_gamma_MX, B_gamma_MX, C_gamma_MX) :
331 return abs (z_Mz_X) f_gamma_MX+2.b_MXnu_Mnu_X/nu_MX (B_gamma_MX+b_MX (nu_Mnu_X) 0 . 5
332 C_gamma_MX)
333 # ==================================================================================================
334 # SILVESTER and PITZER, 1977 ( NaCl ) ; ARCHER, 1999 (KCl)
335 #
336 def f _ P i t z e r _ p a r a m e t e r s ( s e l f , i , T) :
337 Tr = 2 9 8 . 1 5 # K
338 i f MX == NaCl :
339 q =[[ 0.0765 , 0.2664 , 0.00127 ] ,
340 [ 777.03 , 0. , 33.317 ],
341 [ 4.4706 , 0. , 0.09421 ] ,
342 [ 0 . 0 0 8 9 4 6 , 6 . 1 6 0 8 e 5 , 4.655 e 5 ] ,
343 [ 3.3158 e 6 , 1 . 0 7 1 5 e 6 , 0. ]]
344 q = array ( q ) .T
345 return ( q [ i , 0 ] + q [ i , 1 ] ( 1 / T1/Tr )+q [ i , 2 ] l o g (T/Tr )+q [ i , 3 ] ( TTr )+
346 q [ i , 4 ] ( T2Tr 2 ) )
347 e l i f MX == KCl :
348 b = [ [ 0.413229483398493 , 0.206691413598171 , 0.00133515934994478] ,
349 [ 0.0870121476114027 , 0.102544606022162 , 0. ],
350 [ 0.101413736179231 , 0. , 0. ],
351 [ 0.0199822538522801 , 0. , 0.00234117693834228] ,
352 [ 0.0998120581680816 , 0. , 0.00075896583546707] ,
353 [ 0. , 0.00188349608000903 , 0. ]]
354 b = array (b) .T
355 T0 = 1 . 0 # K
356 return ( b [ i , 0 ] + 1 e 2b [ i , 1 ] ( TTr ) /T0+1e 5b [ i , 2 ] ( ( TTr ) /T0 ) 2+1 e2 b [ i , 3 ] T0 / (T225)+
357 1 e3 b [ i , 4 ] ( T0/T)+1e6 b [ i , 5 ] ( T0 / (T225) ) 3 )
358 return None
359 def beta0_MX_H2O( s e l f , T) :
360 return s e l f . f _ P i t z e r _ p a r a m e t e r s ( 0 , T)
361 def beta1_MX_H2O( s e l f , T) :
362 return s e l f . f _ P i t z e r _ p a r a m e t e r s ( 1 , T)
363 def C_phi_MX_H2O( s e l f , T) :
364 return s e l f . f _ P i t z e r _ p a r a m e t e r s ( 2 , T)
365 # ==================================================================================================
366 # CHEN, BRITT, e t a l . , 1982
367 #
368 def A_phi_H2O( s e l f , T) :
369 return ( 6 1 . 4 4 53 4 exp ( ( T 2 7 3 . 1 5 ) / 2 7 3 . 1 5 ) +2.864468 exp ( 2 . ( T 2 7 3 . 1 5 ) / 2 7 3 . 1 5 ) +183.5379
370 l o g (T/ 2 7 3 . 1 5 ) 0 . 6 8 2 0 2 2 3 (T 2 7 3 . 1 5 ) + 0 . 0 0 0 7 8 7 5 6 9 5 (T 2 . 2 7 3 . 1 5 2 . ) + 5 8 . 9 5 7 8 8 ( 2 7 3 . 1 5 /T) )
371 # ==================================================================================================
372 # DebyeHuckel c o n s t a n t i n o t h e r s o l v e n t
373 #
374 def A_phi_solvent ( s e l f , A_phi_H2O , rho_H2O , epsilon_r_H2O , r h o _ s o l v e n t , e p s i l o n _ r _ s o l v e n t ) :
375 return ( ( r h o _ s o l v e n t /rho_H2O ) 0 . 5 ( epsilon_r_H2O / e p s i l o n _ r _ s o l v e n t ) 1 . 5 A_phi_H2O)
376 # ==================================================================================================
377 # LORIMER, 1993
378 #
858
859 i f x_SF_MEG_in_H2O_MEG_prd != [ ] :
860 s e l f . p r i n t T e x t (CHARS_EQUAL+ \nEQUILIBRIUMDATASELECTEDFORPREDIC
861 TION\n +CHARS_EQUAL+ \n )
862 s e l f . p r i n t V e c t o r s ( x_SF_MEG_in_H2O_MEG , x_SF_MEG_in_H2O_MEG_prd, ,
863 b_MX_in_H2O_MEG , b_MX_in_H2O_MEG_prd, mol . kg ^( 1) , T , T_prd ,
864 K , R e f e r e n c e , [ b i b r e f [ i ] f o r i in idx_set_prd ] , )
865 s e l f . p r i n t T e x t (CHARS_MINUS+ \nTOTALPOINTS : {0}\ n . format ( len (
866 x_SF_MEG_in_H2O_MEG_prd) ) )
867
868 s e l f . p r i n t T e x t (CHARS_EQUAL+ \nENDOFREADING, SELECTINGANDCONVERTING
869 UNITSEQUILIBRIUMDATA\n +CHARS_NUMBER+ \n 3 )
870
871 s e l f . p r i n t T e x t (CHARS_NUMBER+ \nSELECTINGEQUILIBRIUMDATAANDREGRESSI
872 ONTHEIRSFORSOLUTIONSWITHSINGLESOLVENT . . . \ n +CHARS_EQUAL+
873 \n )
874 g l o b a l b_MX_in_H2O, T_MX_in_H2O, idx_MX_in_H2O
875 g l o b a l b_MX_in_MEG, T_MX_in_MEG, idx_MX_in_MEG
876 (b_MX_in_H2O, T_MX_in_H2O, idx_MX_in_H2O , b_MX_in_MEG,T_MX_in_MEG,
877 idx_MX_in_MEG) = [ ] , [ ] , [ ] , [ ] , [ ] , [ ]
878 f o r b , x ,T , i in zip (b_MX_in_H2O_MEG_reg, x_SF_MEG_in_H2O_MEG_reg,
879 T_reg , i d x _ s e t _ r e g ) :
880 if x < 0.01:
881 a r r a y (b_MX_in_H2O . append ( b ) )
882 a r r a y (T_MX_in_H2O . append (T) )
883 a r r a y (idx_MX_in_H2O . append ( i ) )
884 elif x > 0.99:
885 a r r a y (b_MX_in_MEG. append ( b ) )
886 a r r a y (T_MX_in_MEG. append (T) )
887 a r r a y (idx_MX_in_MEG . append ( i ) )
888 b_MX_in_H2O = a r r a y (b_MX_in_H2O)
889 T_MX_in_H2O = a r r a y (T_MX_in_H2O)
890 idx_MX_in_H2O = a r r a y (idx_MX_in_H2O)
891 b_MX_in_MEG = a r r a y (b_MX_in_MEG)
892 T_MX_in_MEG = a r r a y (T_MX_in_MEG)
893 idx_MX_in_MEG = a r r a y (idx_MX_in_MEG)
894
895 s e l f . p r i n t T e x t ( EQUILIBRIUMDATASELECTEDFORH2O\n +CHARS_MINUS+ \n )
896 s e l f . p r i n t V e c t o r s ( b_MX_in_H2O , b_MX_in_H2O, mol . kg ^( 1) , T ,
897 T_MX_in_H2O, K , R e f e r e n c e , [ b i b r e f [ i ] f o r i in idx_MX_in_H2O ] ,
898 )
899 fstr_b_MX_in_H2O = T, t h e t a : exp ( t h e t a [ 0 ] + t h e t a [ 1 ] T+t h e t a [ 2 ] l o g (T) )
900 s e l f . p r i n t T e x t (CHARS_EQUAL+ \nREGRESSIONFORH2O: \ n +CHARS_MINUS+ \n )
901 g l o b a l f_b_MX_in_H2O , theta_b_MX_in_H2O
902 f_b_MX_in_H2O , theta_b_MX_in_H2O = s e l f . n l _ r e g r e s s i o n ( fstr_b_MX_in_H2O ,
903 T_MX_in_H2O, b_MX_in_H2O, [ 1 , . 0 0 1 , 1 ] )
904
905 s e l f . p r i n t T e x t (CHARS_EQUAL+ \nEQUILIBRIUMDATASELECTEDFORMEG\n +
906 CHARS_MINUS+ \n )
907 s e l f . p r i n t V e c t o r s ( b_MX_in_MEG , b_MX_in_MEG, mol . kg ^( 1) , T ,
908 T_MX_in_MEG, K , R e f e r e n c e , [ b i b r e f [ i ] f o r i in idx_MX_in_MEG ] ,
909 )
910 fstr_b_MX_in_MEG = T, t h e t a : exp ( t h e t a [ 0 ] + t h e t a [ 1 ] T)
911 s e l f . p r i n t T e x t (CHARS_EQUAL+ \nREGRESSIONFORMEG: \ n +CHARS_MINUS+ \n )
912 g l o b a l f_b_MX_in_MEG, theta_b_MX_in_MEG
913 f_b_MX_in_MEG, theta_b_MX_in_MEG = s e l f . n l _ r e g r e s s i o n ( fstr_b_MX_in_MEG ,
914 T_MX_in_MEG, b_MX_in_MEG, [ 1 , . 0 0 1 ] )
915
916 s e l f . p r i n t T e x t (CHARS_EQUAL+ \nEQUILIBRIUMDATASELECTEDANDREGRESSION
917 SFINISHED\n +CHARS_NUMBER+ \n 3 )
918
919 g l o b a l mu0_MX_in_H2O_MEG_E_DividedBy_nRT_reg
920 g l o b a l ln_gamma_MX_in_H2O_MEG_E_reg, ln_b_MX_in_H2O_MEG_E_reg
921 g l o b a l ln_gamma_MX_in_H2O_MEG_reg
922 (mu0_MX_in_H2O_MEG_E_DividedBy_nRT_reg , ln_gamma_MX_in_H2O_MEG_E_reg,
923 ln_b_MX_in_H2O_MEG_E_reg, ln_gamma_MX_in_H2O_MEG_reg) =
s e l f . f _ e x c e s s (b_MX_in_H2O_MEG_reg,
924 f_b_MX_in_H2O( T_reg , theta_b_MX_in_H2O ) ,
925 f_b_MX_in_MEG( T_reg , theta_b_MX_in_MEG) ,
926 x_SF_MEG_in_H2O_MEG_reg,
927 s e l f . A_phi_H2O( T_reg ) ,
928 s e l f . beta0_MX_H2O( T_reg ) ,
929 s e l f . beta1_MX_H2O( T_reg ) ,
930 s e l f . C_phi_MX_H2O( T_reg ) ,
931 s e l f . rho_H2O ( T_reg ) ,
932 s e l f . rho_MEG( T_reg ) ,
933 s e l f . epsilon_r_H2O ( T_reg ) ,
934 s e l f . epsilon_r_MEG ( T_reg ) ,
935 T_reg )
936
937 g l o b a l mu0_MX_in_H2O_MEG_E_DividedBy_nRT_prd
938 g l o b a l ln_gamma_MX_in_H2O_MEG_E_prd, ln_b_MX_in_H2O_MEG_E_prd
939 g l o b a l ln_gamma_MX_in_H2O_MEG_prd
940 (mu0_MX_in_H2O_MEG_E_DividedBy_nRT_prd , ln_gamma_MX_in_H2O_MEG_E_prd,
941 ln_b_MX_in_H2O_MEG_E_prd, ln_gamma_MX_in_H2O_MEG_prd) =
s e l f . f _ e x c e s s (b_MX_in_H2O_MEG_prd,
942 f_b_MX_in_H2O( T_prd , theta_b_MX_in_H2O ) ,
943 f_b_MX_in_MEG( T_prd , theta_b_MX_in_MEG) ,
944 x_SF_MEG_in_H2O_MEG_prd,
945 s e l f . A_phi_H2O( T_prd ) ,
946 s e l f . beta0_MX_H2O( T_prd ) ,
947 s e l f . beta1_MX_H2O( T_prd ) ,
948 s e l f . C_phi_MX_H2O( T_prd ) ,
949 s e l f . rho_H2O ( T_prd ) ,
950 s e l f . rho_MEG( T_prd ) ,
951 s e l f . epsilon_r_H2O ( T_prd ) ,
952 s e l f . epsilon_r_MEG ( T_prd ) ,
953 T_prd )
954
955 s e l f . p r i n t T e x t (CHARS_NUMBER+ \ n S t a r t i n g r e g r e s s i o n S e t o f E x p e r i m e n t s .
956 . . \ n +CHARS_NUMBER+ \n 2 )
957 def f 3 (X, a ) :
958 x , t , f=X [ 0 ] , X [ 1 ] , 0
959 f o r i in range ( 0 , len ( a ) , 2 ) :
960 f += ( a [ i ]+ a [ i +1] t ) x ( i / 2 )
961 f = x(1x )
962 return f
963 t h e t a 0 = random . rand ( 6 ) 100 200
964 g l o b a l f_mu0_MX_in_H2O_MEG_E_DividedBy_nRT
965 g l o b a l theta_mu0_MX_in_H2O_MEG_E_DividedBy_nRT
966 (f_mu0_MX_in_H2O_MEG_E_DividedBy_nRT ,
967 theta_mu0_MX_in_H2O_MEG_E_DividedBy_nRT) = s e l f . n l _ r e g r e s s i o n ( (
968 f 3 , f u n c t i o n ) , a r r a y ( [ x_SF_MEG_in_H2O_MEG_reg,
969 T_reg ] ) , mu0_MX_in_H2O_MEG_E_DividedBy_nRT_reg , t h e t a 0 )
970 s e l f . p r i n t T e x t (CHARS_NUMBER+ \ n F i n i s h i n g r e g r e s s i o n S e t o f E x p e r i m e n t s
971 \n +CHARS_NUMBER+ \n )
972 s e l f . tabWidget_1 . s e t E n a b l e d ( True )
973 QApplication . restoreOverrideCursor ( )
974
975 def s e l e c t P o i n t s ( s e l f , x _ a l l , T_all , T) :
976 return [ x _ a l l [ i ] f o r i in range ( len ( T_all ) ) i f abs ( T_all [ i ]T) < 0 . 0 5 ]
977
978 def l i m i t s _ x y ( s e l f , x1 , x2 ) :
979 x_min , x_max = min(min( x1 ) , min( x2 ) ) , max(max( x1 ) , max( x2 ) )
980 Delta_x = abs (x_maxx_min ) / 2 0 .
981 return [ x_minDelta_x , x_max+Delta_x ]
982
983 def minmaxPlot ( s e l f , x , n=20) :
984 xmin , xmax = min( x ) , max( x )
985 dx = abs ( xmaxxmin ) /n
986 return xmindx , xmax+dx
987
988 def p l o t 1 ( s e l f ) :
989 Q A p p l i c a t i o n . s e t O v e r r i d e C u r s o r ( Qt . WaitCursor )
990 s e l f . t e x t E d i t _ S t a t i s t i c s . setText ( )
991 # Choice S o l v e n t
992 i f s e l f . comboBox_Plot1_Ordinate_Solvent . c u r r e n t I n d e x ( ) == 0 :
993 y l a b e l , T_MX_in_solvent , b_MX_in_solvent = H_2O , T_MX_in_H2O, b_MX_in_H2O
994 idx_MX_in_solvent , f_rho , f_x_SF = idx_MX_in_H2O , s e l f . rho_H2O , lambda _: 0 . 0
995 f_b_MX_in_solvent , theta_b_MX_in_solvent = f_b_MX_in_H2O , theta_b_MX_in_H2O
996 e l i f s e l f . comboBox_Plot1_Ordinate_Solvent . c u r r e n t I n d e x ( ) == 1 :
997 y l a b e l , T_MX_in_solvent , b_MX_in_solvent = MEG , T_MX_in_MEG, b_MX_in_MEG
998 idx_MX_in_solvent , f_rho , f_x_SF = idx_MX_in_MEG, s e l f . rho_MEG, lambda _: 1 . 0
999 f_b_MX_in_solvent , theta_b_MX_in_solvent = f_b_MX_in_MEG, theta_b_MX_in_MEG
1000 # Choice Temperature
1001 i f s e l f . comboBox_Plot1_Abscissa_Temperature . c u r r e n t I n d e x ( ) == 0 :
1002 f_T = lambda _ : _
1003 x l a b e l = r $T\ \ l e f t ( \ rm{K}\ r i g h t ) $
1004 e l i f s e l f . comboBox_Plot1_Abscissa_Temperature . c u r r e n t I n d e x ( ) == 1 :
1005 f_T = K_to_C
1006 x l a b e l = r $T\ \ l e f t ( ^ \ c i r c \rm{C}\ r i g h t ) $
1007 e l i f s e l f . comboBox_Plot1_Abscissa_Temperature . c u r r e n t I n d e x ( ) == 2 :
1008 f_T = K_to_R
1009 x l a b e l = r $T\ \ l e f t ( ^ \ c i r c \rm{R}\ r i g h t ) $
1010 e l i f s e l f . comboBox_Plot1_Abscissa_Temperature . c u r r e n t I n d e x ( ) == 3 :
1011 f_T = K_to_F
1012 x l a b e l = r $T\ \ l e f t ( ^ \ c i r c \rm{F}\ r i g h t ) $
1013 # Choice C o n c e n t r a t i o n
1014 i f s e l f . comboBox_Plot1_Ordinate_Concentration . c u r r e n t I n d e x ( ) == 0 :
1015 f _ c o n c e n t r a t i o n 1 = lambda _: _ [ 0 ]
1016 f _ c o n c e n t r a t i o n 2 = lambda _ : _
1017 y l a b e l = r $b ^{\{\rm{ +y l a b e l+r }\}}_{\rm{ +MX+r }}\ \ l e f t ( \ rm{ mol \ c d o t kg ^{1}}\ r i g h t ) $
1018 e l i f s e l f . comboBox_Plot1_Ordinate_Concentration . c u r r e n t I n d e x ( ) == 1 :
1019 f _ c o n c e n t r a t i o n 1 = s e l f .b_MX_in_H2O_MEG_to_c_MX_in_H2O_MEG
1020 f _ c o n c e n t r a t i o n 2 = f_rho
1021 y l a b e l = r $c ^{\{\rm{ +y l a b e l+r }\}}_{\rm{ +MX+r }}\ \ l e f t ( \ rm{ mol \ c d o t L^{1}}\ r i g h t ) $
1022 e l i f s e l f . comboBox_Plot1_Ordinate_Concentration . c u r r e n t I n d e x ( ) == 2 :
1023 f _ c o n c e n t r a t i o n 1 = s e l f .b_MX_in_H2O_MEG_to_x_MX_in_H2O_MEG
1024 f _ c o n c e n t r a t i o n 2 = f_x_SF
1025 y l a b e l = r $x ^{\{\rm{ +y l a b e l+r }\}}_{\rm{ +MX+r }} $
1026 e l i f s e l f . comboBox_Plot1_Ordinate_Concentration . c u r r e n t I n d e x ( ) == 3 :
1027 f _ c o n c e n t r a t i o n 1 = s e l f .b_MX_in_H2O_MEG_to_w_MX_in_H2O_MEG
1028 f _ c o n c e n t r a t i o n 2 = lambda _ : _
1029 y l a b e l = r $w^{\{\rm{ +y l a b e l+r }\}}_{\rm{ +MX+r }} $
1030 f _ c o n c e n t r a t i o n = lambda b , T : f _ c o n c e n t r a t i o n 1 ( b , f _ c o n c e n t r a t i o n 2 (T) )
1031 ax = s e l f . mplWidget_Graphic . c a n v a s . ax
1032 ax . c l e a r ( )
1033 xmin , xmax = s e l f . minmaxPlot ( T_MX_in_solvent )
1034 i f xmin < 0 :
1035 xmin = 0
1036 T = l i n s p a c e ( xmin , xmax , 5 0 )
1037 x c u r v e = f_T (T)
1038 y c u r v e = f _ c o n c e n t r a t i o n ( f_b_MX_in_solvent (T, theta_b_MX_in_solvent ) , T)
1039 xmin , xmax , ymin , ymax = min( x c u r v e ) , max( x c u r v e ) , min( y c u r v e ) , max( y c u r v e )
1040 ax . p l o t ( x c u r v e , y c u r v e , g , lw =2)
1041 l = l i s t ( s e t ( idx_MX_in_solvent ) )
1042 Ycurve , Y p o i n t s = a r r a y ( [ ] ) , a r r a y ( [ ] )
1043 f o r i d x in range ( len ( l ) ) :
1044 T = a r r a y ( [ T f o r T, i in zip ( T_MX_in_solvent , idx_MX_in_solvent ) i f i == l [ i d x ] ] )
1045 x p o i n t s = f_T (T)
1046 y p o i n t s = f _ c o n c e n t r a t i o n ( a r r a y ( [ b f o r b , i in zip ( b_MX_in_solvent , idx_MX_in_solvent )
1047 i f i == l [ i d x ] ] ) , T)
1048 xmin , xmax , ymin , ymax = (min( xmin , min( x p o i n t s ) ) , max( xmax , max( x p o i n t s ) ) ,
1049 min( ymin , min( y p o i n t s ) ) , max( ymax , max( y p o i n t s ) ) )
1050 ax . p l o t ( x p o i n t s , y p o i n t s , COLORS_AND_MARKERS[ i d x ] )
1051 y c u r v e = f _ c o n c e n t r a t i o n ( f_b_MX_in_solvent (T, theta_b_MX_in_solvent ) , T)
1052 Ycurve , Y p o i n t s = c o n c a t e n a t e ( ( Ycurve , y c u r v e ) ) , c o n c a t e n a t e ( ( Ypoints , y p o i n t s ) )
1053 s e l f . c a l c u l a t e S t a t i s t i c s ( Ycurve , Y p o i n t s )
1054 ax . s e t _ x l a b e l ( x l a b e l , f o n t s i z e =16)
1055 ax . s e t _ y l a b e l ( y l a b e l , f o n t s i z e =16)
1056 l s t L e g e n d = [ b i b r e f [ i ] f o r i in l ]
1057 lstLegend . i n s e r t (0 , Regression )
1058 ax . l e g e n d ( l s t L e g e n d , l o c =0 , f o n t s i z e =12 , n c o l =2 , f a n c y b o x=True , shadow=True )
1059 ax . g r i d ( True )
1060 ax . s e t _ x l i m ( s e l f . minmaxPlot ( [ xmin , xmax ] ) )
1061 ax . s e t _ y l i m ( s e l f . minmaxPlot ( [ ymin , ymax ] ) )
1062 s e l f . mplWidget_Graphic . c a n v a s . draw ( )
1063 s e l f . mplWidget_Graphic . s e t E n a b l e d ( True )
1064 s e l f . checkBox_Graphic . s e t E n a b l e d ( True )
1065 s e l f . p u shB u t t o n _ Pr i n t G r a p hi c . s e t E n a b l e d ( True )
1066 s e l f . t e x t E d i t _ S t a t i s t i c s . s e t E n a b l e d ( True )
1067 s e l f . p u s h B u t t o n _ S a v e S t a t i s t i c s . s e t E n a b l e d ( True )
1068 s e l f . p u s h B u t t o n _ P r i n t S t a t i s t i c s . s e t E n a b l e d ( True )
1069 s e l f . tabWidget_1 . s e t C u r r e n t I n d e x ( 3 )
1070 QApplication . restoreOverrideCursor ( )
1071
1072 def p l o t 2 ( s e l f ) :
1073 Q A p p l i c a t i o n . s e t O v e r r i d e C u r s o r ( Qt . WaitCursor )
1074 T_choice = s e l f . T_to_K ( )
1075 i f len ( T_choice ) < 1 :
1076 QApplication . restoreOverrideCursor ( )
1077 return
1078 s e l f . t e x t E d i t _ S t a t i s t i c s . setText ( )
1079 # Choice C o n c e n t r a t i o n
1080 i f s e l f . comboBox_Plot2_Ordinate_Concentration . c u r r e n t I n d e x ( ) == 0 :
1081 f _ c o n c e n t r a t i o n 1 = lambda _ : _ [ 0 ]
1082 f _ c o n c e n t r a t i o n 2 = lambda _ : _ [ 0 ]
1083 y l a b e l = r $b ^{\{\rm{H_2O+MEG}\}}_{\rm{ +MX+r }}\ \ l e f t ( \ rm{ mol \ c d o t kg ^{1}}\ r i g h t ) $
1084 e l i f s e l f . comboBox_Plot2_Ordinate_Concentration . c u r r e n t I n d e x ( ) == 1 :
1085 f _ c o n c e n t r a t i o n 1 = s e l f .b_MX_in_H2O_MEG_to_c_MX_in_H2O_MEG
1086 f _ c o n c e n t r a t i o n 2 = lambda x_SF , T : s e l f . rho_H2O_MEG( s e l f . rho_H2O (T) , s e l f . rho_MEG(T) ,
x_SF )
1087 y l a b e l = r $c ^{\{\rm{H_2O+MEG}\}}_{\rm{ +MX+r }}\ \ l e f t ( \ rm{ mol \ c d o t L^{1}}\ r i g h t ) $
1088 e l i f s e l f . comboBox_Plot2_Ordinate_Concentration . c u r r e n t I n d e x ( ) == 2 :
1089 f _ c o n c e n t r a t i o n 1 = s e l f .b_MX_in_H2O_MEG_to_x_MX_in_H2O_MEG
1090 f _ c o n c e n t r a t i o n 2 = lambda _ : _ [ 0 ]
1091 y l a b e l = r $x ^{\{\rm{H_2O+MEG}\}}_{\rm{ +MX+r }} $
1092 e l i f s e l f . comboBox_Plot2_Ordinate_Concentration . c u r r e n t I n d e x ( ) == 3 :
1093 f _ c o n c e n t r a t i o n 1 = s e l f .b_MX_in_H2O_MEG_to_w_MX_in_H2O_MEG
1094 f _ c o n c e n t r a t i o n 2 = lambda _ : _ [ 0 ]
1334 s e l f . t e x t E d i t _ S t a t i s t i c s . s e t E n a b l e d ( True )
1335 s e l f . p u s h B u t t o n _ S a v e S t a t i s t i c s . s e t E n a b l e d ( True )
1336 s e l f . p u s h B u t t o n _ P r i n t S t a t i s t i c s . s e t E n a b l e d ( True )
1337 s e l f . tabWidget_1 . s e t C u r r e n t I n d e x ( 3 )
1338 QApplication . restoreOverrideCursor ( )
1339
1340 def p l o t 4 ( s e l f ) :
1341 Q A p p l i c a t i o n . s e t O v e r r i d e C u r s o r ( Qt . WaitCursor )
1342 T_choice = s e l f . T_to_K ( )
1343 i f len ( T_choice ) < 1 :
1344 QApplication . restoreOverrideCursor ( )
1345 return
1346 s e l f . t e x t E d i t _ S t a t i s t i c s . setText ( )
1347 # Choice E x c e s s Function
1348 i f s e l f . comboBox_Plot4_Ordinate_ExcessFunction . c u r r e n t I n d e x ( ) == 0 :
1349 y _ a l l = [ mu0_MX_in_H2O_MEG_E_DividedBy_nRT_reg , mu0_MX_in_H2O_MEG_E_DividedBy_nRT_prd ]
1350 y l a b e l = r $ {\ l e f t [ \mu^{0\{\rm{H_2O+MEG}\}}_{\rm{ +MX+r }}\ r i g h t ] } ^ { \ rm{E}} / {nRT} $
1351 e l i f s e l f . comboBox_Plot4_Ordinate_ExcessFunction . c u r r e n t I n d e x ( ) == 1 :
1352 y _ a l l = [ ln_gamma_MX_in_H2O_MEG_E_reg, ln_gamma_MX_in_H2O_MEG_E_prd ]
1353 y l a b e l = r $ {\ l e f t [ \ l n \ \gamma^{\{\rm{H_2O+MEG}\}}_{\rm{ +MX+r }}\ r i g h t ] } ^ { \ rm{E}} $
1354 e l i f s e l f . comboBox_Plot4_Ordinate_ExcessFunction . c u r r e n t I n d e x ( ) == 2 :
1355 y _ a l l = [ ln_b_MX_in_H2O_MEG_E_reg, ln_b_MX_in_H2O_MEG_E_prd ]
1356 y l a b e l = r $ {\ l e f t [ \ l n \ b ^{\{\rm{H_2O+MEG}\}}_{\rm{ +MX+r }}\ r i g h t ] } ^ { \ rm{E}} $
1357 # Choice S o l v e n t
1358 i f s e l f . comboBox_Plot4_Abscissa_Solvent . c u r r e n t I n d e x ( ) == 0 :
1359 x l a b e l , f_x_SF = MEG , lambda _ : _
1360 e l i f s e l f . comboBox_Plot4_Abscissa_Solvent . c u r r e n t I n d e x ( ) == 1 :
1361 x l a b e l , f_x_SF = H_2O , lambda _: 1_
1362 # Choice S a l t f r e e C o n c e n t r a t i o n
1363 i f s e l f . comboBox_Plot4_Abscissa_Concentration . c u r r e n t I n d e x ( ) == 0 :
1364 f _ S F _ c o n c e n t r a t i o n 1 = f_x_SF
1365 f _ S F _ c o n c e n t r a t i o n 2 = lambda _ : _
1366 x l a b e l = r $x ^{\rm{H_2O+MEG}}_{\rm{ +x l a b e l+r }} $
1367 e l i f s e l f . comboBox_Plot4_Abscissa_Concentration . c u r r e n t I n d e x ( ) == 1 :
1368 f _ S F _ c o n c e n t r a t i o n 1 = f_x_SF
1369 f _ S F _ c o n c e n t r a t i o n 2 = s e l f .x_SF_MEG_in_H2O_MEG_to_w_SF_MEG_in_H2O_MEG
1370 x l a b e l = r $w^{\rm{H_2O+MEG}}_{\rm{ +x l a b e l+r }} $
1371 f _ S F _ c o n c e n t r a t i o n = lambda x_SF : f _ S F _ c o n c e n t r a t i o n 1 ( f _ S F _ c o n c e n t r a t i o n 2 ( x_SF ) )
1372 # Choice Mode
1373 i f s e l f . comboBox_Isotherms_Mode . c u r r e n t I n d e x ( ) == 0 :
1374 leg_mode , x _ a l l , y _ a l l , T_all = ( r $ \rm{ R e g r e s s i o n }\ ( , x_SF_MEG_in_H2O_MEG_reg,
1375 y _ a l l [ 0 ] , T_reg )
1376 e l i f s e l f . comboBox_Isotherms_Mode . c u r r e n t I n d e x ( ) == 1 :
1377 leg_mode , x _ a l l , y _ a l l , T_all = ( r $ \rm{ P r e d i c t i o n }\ ( , x_SF_MEG_in_H2O_MEG_prd,
1378 y _ a l l [ 1 ] , T_prd )
1379 # Choice Temperature
1380 i f s e l f . comboBox_Isotherms_Temperature . c u r r e n t I n d e x ( ) == 0 :
1381 f_T = lambda _ : _
1382 str_T = r \ \rm{K}
1383 e l i f s e l f . comboBox_Isotherms_Temperature . c u r r e n t I n d e x ( ) == 1 :
1384 f_T = K_to_C
1385 str_T = r \ ^\ c i r c \rm{C}
1386 e l i f s e l f . comboBox_Isotherms_Temperature . c u r r e n t I n d e x ( ) == 2 :
1387 f_T = K_to_R
1388 str_T = r \ ^\ c i r c \rm{R}
1389 e l i f s e l f . comboBox_Isotherms_Temperature . c u r r e n t I n d e x ( ) == 3 :
1390 f_T = K_to_F
1391 str_T = r \ ^\ c i r c \rm{F}
1392 ax = s e l f . mplWidget_Graphic . c a n v a s . ax
1393 ax . c l e a r ( )
1394 lstLegend = [ ]
1395 xmin , xmax , ymin , ymax = 0 . 0 , 1 . 0 , None , None
1396 x_SF = l i n s p a c e ( xmin , xmax , 5 0 )
1397 f o r i , t in enumerate ( T_choice ) :
1398 T = z e r o s _ l i k e ( x_SF )+t
1399 mu0_MX_in_H2O_MEG_E_DividedBy_nRT = f_mu0_MX_in_H2O_MEG_E_DividedBy_nRT(
1400 [ x_SF , T ] , theta_mu0_MX_in_H2O_MEG_E_DividedBy_nRT)
1401 b_MX_in_H2O = f_b_MX_in_H2O(T, theta_b_MX_in_H2O )
1402 b_MX_in_MEG = f_b_MX_in_MEG(T, theta_b_MX_in_MEG)
1403 b_MX_in_H2O_MEG = f s o l v e ( s e l f . fsolve_b_MX_in_H2O_MEG , b_MX_in_H2O(1x_SF )+
1404 b_MX_in_MEGx_SF , a r g s =(mu0_MX_in_H2O_MEG_E_DividedBy_nRT, b_MX_in_H2O,
1405 b_MX_in_MEG, x_SF , T) )
1406 A_phi_H2O = s e l f . A_phi_H2O(T)
1407 beta0_MX_H2O = s e l f . beta0_MX_H2O(T)
1408 beta1_MX_H2O = s e l f . beta1_MX_H2O(T)
1409 C_phi_MX_H2O = s e l f . C_phi_MX_H2O(T)
1410 F_excess = s e l f . f _ e x c e s s (b_MX_in_H2O_MEG, b_MX_in_H2O, b_MX_in_MEG,
1411 x_SF , A_phi_H2O , beta0_MX_H2O , beta1_MX_H2O ,
1412 C_phi_MX_H2O, s e l f . rho_H2O (T) , s e l f . rho_MEG(T) ,
1413 s e l f . epsilon_r_H2O (T) , s e l f . epsilon_r_MEG (T) , T)
1414 x c u r v e = f _ S F _ c o n c e n t r a t i o n ( x_SF )
1415 y c u r v e = F_excess [ s e l f . comboBox_Plot4_Ordinate_ExcessFunction . c u r r e n t I n d e x ( ) ]
1416 i f ymin :
1417 ymin = min( ymin , min( y c u r v e ) )
1418 else :
1419 ymin = min( y c u r v e )
1420 i f ymax :
1421 ymax = max( ymax , max( y c u r v e ) )
1422 else :
1423 ymax = max( y c u r v e )
1424 ax . p l o t ( x c u r v e , y c u r v e , COLORS_AND_MARKERS[ i ] [ 0 ] + , lw =2)
1425 l s t L e g e n d . append ( leg_mode+s t r ( f_T ( t ) )+str_T+r ) $ )
1426 Ycurve , Y p o i n t s = a r r a y ( [ ] ) , a r r a y ( [ ] )
1427 f o r i , t in enumerate ( T_choice ) :
1428 x_SF = a r r a y ( s e l f . s e l e c t P o i n t s ( x _ a l l , T_all , t ) )
1429 i f len ( x_SF ) > 0 :
1430 x p o i n t s = f _ S F _ c o n c e n t r a t i o n ( x_SF )
1431 y p o i n t s = a r r a y ( s e l f . s e l e c t P o i n t s ( y _ a l l , T_all , t ) )
1432 ymin , ymax = min( ymin , min( y p o i n t s ) ) , max( ymax , max( y p o i n t s ) )
1433 ax . p l o t ( x p o i n t s , y p o i n t s , COLORS_AND_MARKERS[ i ] )
1434 l s t L e g e n d . append ( r $ \rm{ E x p e r i m e n t a l \ p o i n t s \ } ( +s t r ( f_T ( t ) )+str_T+r ) $ )
1435 # Statistics
1436 T = z e r o s _ l i k e ( x_SF )+t
1437 mu0_MX_in_H2O_MEG_E_DividedBy_nRT = f_mu0_MX_in_H2O_MEG_E_DividedBy_nRT(
1438 [ x_SF , T ] , theta_mu0_MX_in_H2O_MEG_E_DividedBy_nRT)
1439 b_MX_in_H2O = f_b_MX_in_H2O(T, theta_b_MX_in_H2O )
1440 b_MX_in_MEG = f_b_MX_in_MEG(T, theta_b_MX_in_MEG)
1441 b_MX_in_H2O_MEG = f s o l v e ( s e l f . fsolve_b_MX_in_H2O_MEG , b_MX_in_H2O(1x_SF )+
1442 b_MX_in_MEGx_SF , a r g s =(mu0_MX_in_H2O_MEG_E_DividedBy_nRT, b_MX_in_H2O,
1443 b_MX_in_MEG, x_SF , T) )
1444 A_phi_H2O = s e l f . A_phi_H2O(T)
1445 beta0_MX_H2O = s e l f . beta0_MX_H2O(T)
1446 beta1_MX_H2O = s e l f . beta1_MX_H2O(T)
1447 C_phi_MX_H2O = s e l f . C_phi_MX_H2O(T)
1448 F_excess = s e l f . f _ e x c e s s (b_MX_in_H2O_MEG, b_MX_in_H2O, b_MX_in_MEG,
1449 x_SF , A_phi_H2O , beta0_MX_H2O , beta1_MX_H2O ,
1450 C_phi_MX_H2O, s e l f . rho_H2O (T) , s e l f . rho_MEG(T) ,
1451 s e l f . epsilon_r_H2O (T) , s e l f . epsilon_r_MEG (T) , T)
1452 y c u r v e = F_excess [ s e l f . comboBox_Plot4_Ordinate_ExcessFunction . c u r r e n t I n d e x ( ) ]
1453 Ycurve , Y p o i n t s = c o n c a t e n a t e ( ( Ycurve , y c u r v e ) ) , c o n c a t e n a t e ( ( Ypoints , y p o i n t s ) )
1454 s e l f . c a l c u l a t e S t a t i s t i c s ( Ycurve , Y p o i n t s )
1455 ax . s e t _ x l a b e l ( x l a b e l , f o n t s i z e =16)
1456 ax . s e t _ y l a b e l ( y l a b e l , f o n t s i z e =16)
1457 ax . l e g e n d ( l s t L e g e n d , l o c =0 , f o n t s i z e =12 , n c o l =2 , f a n c y b o x=True , shadow=True )
1458 ax . g r i d ( True )
1459 ax . s e t _ x l i m ( s e l f . minmaxPlot ( [ xmin , xmax ] ) )
1460 ax . s e t _ y l i m ( s e l f . minmaxPlot ( [ ymin , ymax ] ) )
1461 s e l f . mplWidget_Graphic . c a n v a s . draw ( )
1462 s e l f . mplWidget_Graphic . s e t E n a b l e d ( True )
1463 s e l f . checkBox_Graphic . s e t E n a b l e d ( True )
1464 s e l f . p u s hB u t t o n _ Pr i n t G r a p hi c . s e t E n a b l e d ( True )
1465 s e l f . t e x t E d i t _ S t a t i s t i c s . s e t E n a b l e d ( True )
1466 s e l f . p u s h B u t t o n _ S a v e S t a t i s t i c s . s e t E n a b l e d ( True )
1467 s e l f . p u s h B u t t o n _ P r i n t S t a t i s t i c s . s e t E n a b l e d ( True )
1468 s e l f . tabWidget_1 . s e t C u r r e n t I n d e x ( 3 )
1469 QApplication . restoreOverrideCursor ( )
1470
1471 def main ( ) :
1472 app = Q A p p l i c a t i o n ( s y s . a r g v )
1473 __ = JAFOSSMS ( )
1474 s y s . e x i t ( app . exec_ ( ) )
1475
1476 i f __name__ == __main__ :
1477 main ( )