RHSpH:

Path: Dynamics/Process

% Simulates a simple model of a pH process. 
 The process consists of an  acid (HNO3) stream, buffer (NaHCO3) stream, and
 base (NaOH) stream that are mixed in a stirred tank. The chemical equilibria
 is modeled by introducing two reaction invariants for each inlet stream.

           +        -         -         =
   wAi = [H ]i - [OH ]i - [HCO3]i - 2[CO3]i
                        -         =
   wBi = [H2CO3]i + [HCO3]i + 2[CO3]i

--------------------------------------------------------------------------
   Form:
   xDot = RHSpH( x, t, d )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   x           (3,1) State [wA4;wB4;h] h is liquid level
   t           (1,1) Time (unused)
   d           (.)   Structure
                     .wA1       (1,1) See above
                     .wA2       (1,1)
                     .wA3       (1,1)
                     .wB1       (1,1)
                     .wB2       (1,1)
                     .wB3       (1,1)
                     .pK1       (1,1) Base 10 log of equilibrium constant
                     .pK2       (1,1) Base 10 log of equilibrium constant
                     .a         (1,1) Crosssectional area of mixing tank
                     .cV        (1,1) Valve coefficient
                     .n         (1,1) Valve exponent
                     .z         (1,1) Vertical distance between bottom of
                                      tank and outlet of effluent
                     .q1        (1,1) Volumetric flow of HNO3
                     .q2        (1,1) Volumetric flow of NaHCO3
                     .q3        (1,1) Volumetric flow of NaOH

   -------
   Outputs
   -------
   xDot        (3,1) State derivative

--------------------------------------------------------------------------
   Reference: Henson, M. A. and D. E. Seborg. (1997.) Nonlinear Process 
              Control,  Prentice-Hall. pp. 207-210.
--------------------------------------------------------------------------

Back to the Dynamics Module page