Skip to content

Commit e6c3d98

Browse files
authored
Merge pull request #515 from JuliaControl/doc_debug_ph
doc: avoid global `V` variable in pH neutralization tutorial
2 parents eeab857 + 924c226 commit e6c3d98

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎docs/src/manual/nonlinmpc2.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ line_counter = :continue
143143
using ModelPredictiveControl
144144
145145
calc_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)
148148
calc_res(a_H, c_A, c_B, Kw, Ka) = a_H + c_B - (Kw / a_H) - (Ka * c_A / (Ka + a_H))
149149
function 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
162162
end
@@ -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

Comments
 (0)