Em muitos casos, o fechamento de balanços materiais leva à formulação do problema na forma de um sistema linear. Segue um exemplo.
Feche o balanço material para a espécie 𝐴,𝐵,𝐶 no fluxograma a seguir. São informadas:
a razão entre as vazões totais da corrente 5 pela corrente 6, sendo igual a 0,7.
Vamos aos balanços: $$ \begin{array}{ccc} \rm{ para \ o \ A} & \rm{para \ o \ B} & \rm{ para \ o \ C} \\ \hline & Mix & \\ N_{A,1} + N_{A,6}+ N_{A,9} = N_{A,2} & N_{B,1} + N_{B,6}+ N_{B,9} = N_{B,2} & N_{C,1} + N_{C,6}+ N_{C,9} = N_{C,2} \\ \hline & Reator & \\ N_{A,3} = N_{A,2} \cdot \left(1-XR1 \right) & N_{B,3} = N_{B,2} + 2 \cdot N_{A,2} \cdot XR1 & N_{C,3} = N_{C,2} \\ \hline & Separador \ S1 & \\ N_{A,7} = N_{A,3} \cdot rA7 & N_{B,7} = N_{B,3} \cdot rB7 & N_{C,7}=N_{C,3} \cdot rC7 \\ N_{A,4} = N_{A,3} \cdot \left(1-rA7\right) & N_{B,4} = N_{B,3} \cdot \left(1-rA7\right) & N_{C,4}=N_{C,3} \cdot \left(1-rA7\right) \\ \hline & Tê \ de \ divisao & \\ N_{A,5} = 0,7 \cdot N_{A,6} & N_{B,5} = 0,7 \cdot N_{B,6} & N_{C,5} = 0,7 \cdot N_{C,6} \\ N_{A,4} = N_{A,5} + N_{A,6} & N_{B,4} = N_{B,5} + N_{B,6} & N_{C,4} = N_{C,5} + N_{C,6} \\ \hline & Reator R2 & \\ N_{A,8} = N_{A,7} \cdot \left(1-XR2 \right) & N_{B,8} = N_{B,7} & N_{C,8} = N_{C,7} + N_{A,7} \cdot XR2 \\ \hline & Separador \ S2 & \\ N_{A,9} = N_{A,8} \cdot rA9 & N_{B,9} = N_{B,8} \cdot rB9 & N_{C,9}=N_{C,8} \cdot rC9 \\ N_{A,10} = N_{A,8} \cdot \left(1-rA9\right) & N_{B,10} = N_{B,8} \cdot \left(1-rB9\right) & N_{C,10}=N_{C,8} \cdot \left(1-rC9\right) \\ \hline & Informacoes \ adicionais & \\ N_{A,10} = 0,05 \cdot N_{C,10} & N_{B,1} = 5 & N_{C,10} = 1200 \\ \hline \end{array} $$
Podemos empilhar estas 30 equações na forma (primeiro todas as equações do A, depois todas as equações do B, e depois todas as equações do C):
$$ \begin{array}{c|ccc} & N_{A,1} - N_{A,2} + N_{A,6}+ N_{A,9} & = & 0 \\ & N_{A,2} \cdot \left(1-XR1 \right) - N_{A,3} & = & 0 \\ & N_{A,3} \cdot rA7 - N_{A,7} & = & 0\\ & N_{A,3} \cdot \left(1-rA7 \right) - N_{A,4} & = & 0\\ \rm{Eq \ A } & N_{A,5} - 0,7 \cdot N_{A,6} & = & 0 \\ & -N_{A,4} + N_{A,5} + N_{A,6} & = & 0 \\ & N_{A,7} \cdot \left(1-XR2 \right) - N_{A,8} & = & 0 \\ & N_{A,8} \cdot rA9 - N_{A,9} & = & 0 \\ & N_{A,8} \cdot \left(1- rA9 \right) - N_{A,10} & = & 0 \\ & N_{A,10} - 0,05 \cdot N_{C,10} & = & 0 \\ \hline & N_{B,1} - N_{B,2} + N_{B,6}+ N_{B,9} & = & 0 \\ & N_{A,2} \cdot XR1 + N_{B,2} - N_{A,3} & = & 0 \\ & N_{B,3} \cdot rB7 - N_{B,7} & = & 0\\ & N_{B,3} \cdot \left(1-rB7 \right) - N_{B,4} & = & 0\\ \rm{Eq \ B } & N_{B,5} - 0,7 \cdot N_{B,6} & = & 0 \\ & -N_{B,4} + N_{B,5} + N_{B,6} & = & 0 \\ & N_{B,7} - N_{B,8} & = & 0 \\ & N_{B,8} \cdot rB9 - N_{B,9} & = & 0 \\ & N_{B,8} \cdot \left(1- rB9 \right) - N_{B,10} & = & 0 \\ & N_{B,1} & = & 5 \\ \hline & N_{C,1} - N_{C,2} + N_{C,6}+ N_{C,9} & = & 0 \\ & N_{C,2} - N_{C,3} & = & 0 \\ & N_{C,3} \cdot rC7 - N_{C,7} & = & 0\\ & N_{C,3} \cdot \left(1-rC7 \right) - N_{C,4} & = & 0\\ \rm{Eq \ C } & N_{C,5} - 0,7 \cdot N_{C,6} & = & 0 \\ & -N_{C,4} + N_{C,5} + N_{C,6} & = & 0 \\ & N_{A,7}\cdot XR2 + N_{C,7} - N_{C,8} & = & 0 \\ & N_{C,8} \cdot rC9 - N_{C,9} & = & 0 \\ & N_{C,8} \cdot \left(1- rC9 \right) - N_{C,10} & = & 0 \\ & N_{C,10} & = & 1200 \\ \end{array} $$Ou seja, temos um sistema com 30 equações. Apenas para visualizá-lo, vamos representar sua forma:
Do ponto de vista de variáveis, no sistema acima, empilhanos primeiro todas as vazões de A, depois todas as vazões de B, depois todas as vazões de C. Ou seja, temos 30 variáveis, de 1 a 10 primeiras seriam as vazões de A, da 11 a 20 as vazões de B e de 21 a 30 as vazões de C:
$$ N_{A,1},N_{A,2},N_{A,3},...,N_{A,10} \ \rm{correspondem \ a } \ x_1,x_2,x_3,...,x_{10}, $$$$ N_{B,1},N_{B,2},N_{B,3},...,N_{B,10} \ \rm{correspondem \ a } \ x_{11},x_{12},x_{13},...,x_{20}, $$$$ N_{C,1},N_{C,2},N_{C,3},...,N_{C,10} \ \rm{correspondem \ a } \ x_{21},x_{21},x_{23},...,x_{30}, $$Note que as equações, em termos das variáveis x1 a x30 ficam:
$$ \begin{array}{c|ccc} & x_{1} - x_{2} + x_{6}+ x_{9} & = & 0 \\ & x_{2} \cdot \left(1-XR1 \right) - x_{3} & = & 0 \\ & x_{3} \cdot rA7 - x_{7} & = & 0\\ & x_{3} \cdot \left(1-rA7 \right) - x_{4} & = & 0\\ \rm{Eq \ A } & x_{A,5} - 0,7 \cdot x_{6} & = & 0 \\ & -x_{4} + x_{A,5} + x_{6} & = & 0 \\ & x_{7} \cdot \left(1-XR2 \right) - x_{8} & = & 0 \\ & x_{8} \cdot rA9 - x_{A,9} & = & 0 \\ & x_{8} \cdot \left(1- rA9 \right) - x_{10} & = & 0 \\ & x_{10} - 0,05 \cdot x_{30} & = & 0 \\ \hline & x_{11} - x_{12} + x_{16}+ x_{19} & = & 0 \\ & x_{A,2} \cdot XR1 + x_{12} - x_{A,3} & = & 0 \\ & x_{13} \cdot rB7 - x_{17} & = & 0\\ & x_{13} \cdot \left(1-rB7 \right) - x_{14} & = & 0\\ \rm{Eq \ B } & x_{15} - 0,7 \cdot x_{16} & = & 0 \\ & -x_{14} + x_{15} + x_{16} & = & 0 \\ & x_{17} - x_{18} & = & 0 \\ & x_{18} \cdot rB9 - x_{19} & = & 0 \\ & x_{18} \cdot \left(1- rB9 \right) - x_{20} & = & 0 \\ & x_{11} & = & 5 \\ \hline & x_{21} - x_{22} + x_{26}+ x_{29} & = & 0 \\ & x_{22} - x_{23} & = & 0 \\ & x_{23} \cdot rC7 - x_{27} & = & 0\\ & x_{23} \cdot \left(1-rC7 \right) - x_{24} & = & 0\\ \rm{Eq \ C } & x_{25} - 0,7 \cdot x_{26} & = & 0 \\ & -x_{24} + x_{25} + x_{26} & = & 0 \\ & x_{7}\cdot XR2 + x_{27} - x_{28} & = & 0 \\ & x_{28} \cdot rC9 - x_{29} & = & 0 \\ & x_{28} \cdot \left(1- rC9 \right) - x_{30} & = & 0 \\ & x_{30} & = & 1200 \\ \end{array} $$A seguir é apresentado o código em Scilab.
Scilab
clear;clc;close;
XR1 = 0.75; XR2 = 0.42
rA7 = 0.92; rB7 =0.06; rC7=1;
rA9 = 0.94; rB9 =0.93; rC9=0.03;
A = zeros(30,10)
y = zeros(30,1)
razao_5_6 = .7
// A*x =y
// x1 a x10 ==> NA1 a NA10
// x11 a x20 ==> NB1 a NB10
// x21 a x30 ==> NC1 a NC10
// Balanço para A
A(1,[1,2,6,9]) = [1,-1,1,1]
A(2,[2,3]) = [(1-XR1),-1]
A(3,[3,7]) = [rA7,-1]
A(4,[3,4]) = [1-rA7,-1]
A(5,[5,6]) = [1,-razao_5_6 ]
A(6,[4,5,6]) = [1,-1,-1]
A(7,[7,8]) = [1-XR2,-1]
A(8,[8,9]) = [rA9,-1]
A(9,[8,10]) = [1-rA9,-1]
A(10,[10,30]) = [1,-0.05]
// Balanços p/ B
A(11,[11,12,16,19]) = [1,-1,1,1]
A(12,[2,12,13]) = [2*XR1,1,-1] //
A(13,[13,17]) = [rB7,-1]
A(14,[13,14]) = [1-rB7,-1]
A(15,[15,16]) = [1,-razao_5_6 ]
A(16,[14,15,16]) = [1,-1,-1]
A(17,[17,18]) = [1,-1]
A(18,[18,19]) = [rB9,-1]
A(19,[18,20]) = [1-rB9,-1]
A(20,11) = 1
y(20) = 5
// Balanços p/ C
A(21,[21,22,26,29]) = [1,-1,1,1]
A(22,[22,23]) = [1,-1] //
A(23,[23,27]) = [rC7,-1]
A(24,[23,24]) = [1-rC7,-1]
A(25,[25,26]) = [1,-razao_5_6 ]
A(26,[24,25,26]) = [1,-1,-1]
A(27,[7,27,28]) = [XR2,1,-1]
A(28,[28,29]) = [rC9,-1]
A(29,[28,30]) = [1-rC9,-1]
A(30,1) = 1
y(30) = 1200
xsol = inv(A)*y
Em Python, o código a seguir resolve o problema como:
Python
import numpy as np
# Entrada de dados
XR1 = 0.75; XR2 = 0.42
rA7 = 0.92; rB7 =0.06; rC7=1;
rA9 = 0.94; rB9 =0.93; rC9=0.03;
razao_5_6 = .7
A = np.zeros((30,30))
y = np.zeros((30,1))
# Formulação do problema como A*x =y
# x1 a x10 ==> NA1 a NA10
# x11 a x20 ==> NB1 a NB10
# x21 a x30 ==> NC1 a NC10
# Os balanços serão escritos como [equacao,[posicoes_nao_nulas],[valores]]. Posteriormente, estes dados serão usados para montar as matrizes do sistema linear.
# Balanço para A
Acoef=[[0, [1,2,6,9],[1,-1,1,1]],
[1, [2,3], [1-XR1,-1]],
[2, [3,7], [rA7,-1]],
[3, [3,4], [1-rA7,-1]],
[4, [5,6], [1,-razao_5_6]],
[5, [4,5,6], [1,-1,-1]],
[6, [7,8] , [1-XR2,-1]],
[7, [8,9] , [rA9,-1]],
[8, [8,10] , [1-rA9,-1]],
[9, [10,30], [1,-0.05]]]
# Balanço para B
Bcoef =[[10, [11,12,16,19] , [1,-1,1,1]],
[11, [2,12,13] , [2*XR1,1,-1]],
[12, [13,17] , [rB7,-1]],
[13, [13,14] , [1-rB7,-1]],
[14, [15,16] , [1,-razao_5_6]],
[15, [14,15,16] , [1,-1,-1]],
[16, [17,18] , [1,-1]],
[17, [18,19] , [rB9,-1]],
[18, [18,20] , [1-rB9,-1]],
[19, [11] , [1]]]
y[19] = 5
# Balanço para C
Ccoef = [[20, [21,22,26,29], [1,-1,1,1]],
[21, [22,23] , [1,-1]],
[22, [23,27] , [rC7,-1]],
[23, [23,24] , [1-rC7,-1]],
[24, [25,26] , [1,-razao_5_6]],
[25, [24,25,26] , [1,-1,-1]],
[26, [7,27,28] , [XR2,1,-1]],
[27, [28,29] , [rC9,-1]],
[28, [28,30] , [1-rC9,-1]],
[29, [1] , [1]]]
y[29] = 1200
# Monta uma lista de coeficientes
M = Acoef + Bcoef + Ccoef
y = y.reshape(30) # redimensiona o y
# Monta o sistema linear
neq = len(M)
for i in range(30):
eq = M[i][0]
pos = M[i][1]
val = M[i][2]
m = len(pos)
for j in range(m):
A[i][pos[j]-1] = val[j]
# Resolve o sistema e linear e imprime o resultado.
x = np.linalg.solve(A,y)
print(x.reshape((30,1)))
[[ 1.20000000e+03] [ 1.39075725e+03] [ 3.47689311e+02] [ 2.78151449e+01] [ 1.14532950e+01] [ 1.63618499e+01] [ 3.19874166e+02] [ 1.85527017e+02] [ 1.74395396e+02] [ 1.11316210e+01] [ 5.00000000e+00] [ 3.25849981e+03] [ 5.34463568e+03] [ 5.02395754e+03] [ 2.06868840e+03] [ 2.95526914e+03] [ 3.20678141e+02] [ 3.20678141e+02] [ 2.98230671e+02] [ 2.24474699e+01] [ 8.82852699e+01] [ 9.51708087e+01] [ 9.51708087e+01] [-0.00000000e+00] [ 0.00000000e+00] [-0.00000000e+00] [ 9.51708087e+01] [ 2.29517959e+02] [ 6.88553876e+00] [ 2.22632420e+02]]
Os resultados estão apresentados a seguir (vazões em kmol/s):
$$ {\begin{pmatrix}\mathsf{\text{NA1}}&\mathsf{\text{1200}}&\mathsf{\text{NB1}}&\mathsf{\text{5}}&\mathsf{\text{NC1}}&\mathsf{\text{88.28527}}\cr \mathsf{\text{NA2}}&\mathsf{\text{1390.7572}}&\mathsf{\text{NB2}}&\mathsf{\text{3258.4998}}&\mathsf{\text{NC2}}&\mathsf{\text{95.170809}}\cr \mathsf{\text{NA3}}&\mathsf{\text{347.68931}}&\mathsf{\text{NB3}}&\mathsf{\text{5344.6357}}&\mathsf{\text{NC3}}&\mathsf{\text{95.170809}}\cr \mathsf{\text{NA4}}&\mathsf{\text{27.815145}}&\mathsf{\text{NB4}}&\mathsf{\text{5023.9575}}&\mathsf{\text{NC4}}&\mathsf{\text{0}}\cr \mathsf{\text{NA5}}&\mathsf{\text{11.453295}}&\mathsf{\text{NB5}}&\mathsf{\text{2068.6884}}&\mathsf{\text{NC5}}&\mathsf{\text{0}}\cr \mathsf{\text{NA6}}&\mathsf{\text{16.36185}}&\mathsf{\text{NB6}}&\mathsf{\text{2955.2691}}&\mathsf{\text{NC6}}&\mathsf{\text{0}}\cr \mathsf{\text{NA7}}&\mathsf{\text{319.87417}}&\mathsf{\text{NB7}}&\mathsf{\text{320.67814}}&\mathsf{\text{NC7}}&\mathsf{\text{95.170809}}\cr \mathsf{\text{NA8}}&\mathsf{\text{185.52702}}&\mathsf{\text{NB8}}&\mathsf{\text{320.67814}}&\mathsf{\text{NC8}}&\mathsf{\text{229.51796}}\cr \mathsf{\text{NA9}}&\mathsf{\text{174.3954}}&\mathsf{\text{NB9}}&\mathsf{\text{298.23067}}&\mathsf{\text{NC9}}&\mathsf{\text{6.8855388}}\cr \mathsf{\text{NA10}}&\mathsf{\text{11.131621}}&\mathsf{\text{NB10}}&\mathsf{\text{22.44747}}&\mathsf{\text{NC10}}&\mathsf{\text{222.63242}}\cr \end{pmatrix}}$ $$