Public Member Functions | Protected Attributes

ph_sensor Class Reference
[DSim Models]

A simple model of a pH sensor. More...

#include <ph_sensor.h>

List of all members.

Public Member Functions

 ph_sensor (dsim_model_setup *setup)
void initialize_data ()
 Initialize parameters and the PH output.
void initialization_complete ()
void initialize_timestep ()

Protected Attributes

dsim_variable pK1_dsim
 Acid stream 1.
dsim_variable pK2_dsim
 Acid stream 2.
dsim_variable wA4_dsim
 Acid stream 4.
dsim_variable wB4_dsim
 Base stream 4.
dsim_variable pH_dsim
 Measured pH.

Detailed Description

A simple model of a pH sensor.

This sensor does not have a closed form equation for the output.

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

Definition at line 26 of file ph_sensor.h.


Member Function Documentation

void ph_sensor::initialization_complete (  )

Finish initialization. Request the wA4 and wB4 variables from the process model.

Definition at line 49 of file ph_sensor.cc.

{
    wA4_dsim    = parent()->request_local_variable("wA4");
    wB4_dsim    = parent()->request_local_variable("wB4");
}
void ph_sensor::initialize_timestep (  )

Compute the output of the sensor prior to integration. The PH is computed here from the parameters.

Definition at line 59 of file ph_sensor.cc.

{
    // Get values of dsim variables
    double wA4 = wA4_dsim.value_as_double();
    double wB4 = wB4_dsim.value_as_double();
    double pK1 = pK1_dsim.value_as_double();
    double pK2 = pK2_dsim.value_as_double();
    
    // Compute the ph output value
    double pH = compute_ph( wA4, wB4, pK1, pK2 );
    
    // Set the output variable    
    pH_dsim.set_value_as_double(pH);
}

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables