@@ -143,8 +143,8 @@ line_counter = :continue
143143using ModelPredictiveControl
144144
145145calc_a_H(pH) = 10.0^(-pH)
146- calc_ċ_A(c_Ain, q_Ain, c_Aout, q_out) = (60/V)*(q_Ain * c_Ain - q_out * c_Aout)
147- calc_ċ_B(c_Bin, q_Bin, c_Bout, q_out) = (60/V)*(q_Bin * c_Bin - q_out * c_Bout)
146+ calc_ċ_A(c_Ain, q_Ain, c_Aout, q_out, V ) = (60/V)*(q_Ain * c_Ain - q_out * c_Aout)
147+ calc_ċ_B(c_Bin, q_Bin, c_Bout, q_out, V ) = (60/V)*(q_Bin * c_Bin - q_out * c_Bout)
148148calc_res(a_H, c_A, c_B, Kw, Ka) = a_H + c_B - (Kw / a_H) - (Ka * c_A / (Ka + a_H))
149149function fq!(ẋ, res, x, a, u, d, p)
150150 c_Ain, c_Bin, Kw, Ka, V = p
@@ -155,8 +155,8 @@ function fq!(ẋ, res, x, a, u, d, p)
155155 c_Aout = c_A # [mol/L]
156156 c_Bout = c_B # [mol/L]
157157 a_H = calc_a_H(pH)
158- ẋ[1] = calc_ċ_A(c_Ain, q_Ain, c_Aout, q_out)
159- ẋ[2] = calc_ċ_B(c_Bin, q_Bin, c_Bout, q_out)
158+ ẋ[1] = calc_ċ_A(c_Ain, q_Ain, c_Aout, q_out, V )
159+ ẋ[2] = calc_ċ_B(c_Bin, q_Bin, c_Bout, q_out, V )
160160 res[1] = calc_res(a_H, c_A, c_B, Kw, Ka)
161161 return nothing
162162end
@@ -273,8 +273,8 @@ function f̂q!(dx̂, res, x̂, a, u, d, p̂)
273273 c_Aout = c_A
274274 c_Bout = c_B
275275 a_H = calc_a_H(pH)
276- dx̂[1] = calc_ċ_A(c_Ain, q_Ain, c_Aout, q_out)
277- dx̂[2] = calc_ċ_B(c_Bin, q_Bin, c_Bout, q_out)
276+ dx̂[1] = calc_ċ_A(c_Ain, q_Ain, c_Aout, q_out, V )
277+ dx̂[2] = calc_ċ_B(c_Bin, q_Bin, c_Bout, q_out, V )
278278 dx̂[3] = calc_ċ_Ain(c_Ain)
279279 res[1] = calc_res(a_H, c_A, c_B, Kw, Ka)
280280 return nothing
0 commit comments