For Testing Complex Controls
Introduction
In previously released functional specifications, Strategic Automation Services (SAS) described several complex controls, such as centrifugal compressor controls, heater pass outlet temperature balance, advanced distillation overhead controls, and many more. These functional specifications are all on the SAS website.
The complex controls were tested using DCS-based simulation to provide realistic feedback. The purpose of this document is to describe how to build simulation software in standard Foxboro DCS blocks.
Instrument Types
The simulation software must provide inputs for the following instrument types:
- Flows
- Pressures
- Levels
- Temperatures
- Analyzers
Each is discussed separately below.
Flow Simulation – Simple Approach
Flows can be simulated simply or rigorously, depending upon the situation. The simplest approach is usually called loopback. The flow is assumed to be directly proportional to the flow controller output.
F = K * (FCout / 100) (1)
where:
F = simulated flow
K = flow at 100% output
FCout = flow controller output
Control valves exhibiting non-linearity, such as equal percentage, can be simulated using characterizer blocks. However, this complication is seldom warranted.
Before the calculated flow is sent to the controller’s analog input, it should be slightly filtered to simulate a lag. A filter time of 0.03 to 0.10 minutes is usually sufficient.
Flow Simulation – Rigorous Approach
Flow is dependent on the upstream and downstream pressures as well as the control valve position (see Figure 1).
F = K * (FCout / 100) * SQRT [(Pup – Pdn) / Pdref] (2)
where:
F = simulated flow
K = flow at 100% output and pressure differential at Pdref
FCout = flow controller output
SQRT = square root function
Pup = upstream pressure
Pdn = downstream pressure
Pdref = reference differential pressure
Note that equation 2 is the same as equation 1 when the term (Pup – Pdn) is equal to Pdref. Therefore, the same calculation can be used for either approach.
As stated previously, the calculated flow should be slightly filtered to simulate a lag. Noise can be applied for more realism, and a bias can be added to simulate transmitter bias. This approach must be used in pressure-flow networks in which flow and pressure interact (to be discussed later).
Flow Simulation – Centrifugal Compressor Anti-Surge Control
In a previously released SAS functional specification, compressor anti-surge controls are described in some detail. The surge line is defined in terms of pressure ratio (Rc) and suction flow orifice dP:
Rc = Pd / Ps (3a)
hc = hs * Ps / Psr (3b)
where:
Pd = discharge pressure (absolute)
Ps = suction pressure (absolute)
Psr = suction reference pressure at which performance curve data were obtained
hc = suction orifice differential pressure corrected for suction pressure deviation from design (percent of
ange)
hs = suction orifice differential pressure (percent of range)
The value of hc is obtained from the surge line using the current Rc, and then hs is calculated by rearranging equation 3b:
hs = hc * Psr / Ps (3c)
Note that the term hs is at suction conditions. If the flow meter is in the discharge line, then hs must be adjusted to discharge conditions and the anti-surge flow controller setpoint Fo calculated as follows:
ho = hs * (ρor / ρo) * (ρs / ρsr) (4)
Fo = Fmax * SQRT (ho / 100) (5)
where:
ho = orifice differential pressure at discharge conditions
ρo = flowing density at actual orifice conditions
ρor = flowing density at reference orifice conditions
ρs = flowing density at actual suction conditions
ρsr = flowing density at reference suction conditions
Fmax = orifice flow range
For ideal gases, flowing density can be calculated as follows:
ρ = P * M / (R * T * Z) (6)
where:
P = absolute pressure
M = molecular weight
R = ideal gas constant
T = absolute temperature
Z = compressibility
Flow Simulation – Centrifugal Compressor
Like flow through a control valve, flow through a centrifugal compressor is also dependent on the upstream and downstream pressures. However, the flow depends on other factors, such as compressor speed (see Figure 2). The anti-surge control calculations previously discussed can be used to simulate flow through a compressor.
First, the pressure ratio (Rc) must be calculated via equation 3a. Then, the compressor performance curves can be used to lookup the flow hc (as shown by the dashed lines in Figure 2). Finally, equations 3c through 6 can be used to calculate the flow through the compressor.
Note: The flow for speeds between the performance curves must be interpolated.
Pressure Simulation
Pressure is dependent on the balance between flows into the node (i.e., sensor location) and flows out (see Figure 3).
P = Pprev + Ka * (ΣFin – ΣFout) (7)
where:
P = simulated pressure
Pprev = previously calculated pressure
Ka = accumulation factor
ΣFin = sum of all flows in
ΣFout = sum of all flows out
Gas flows are used for determining gas pressure and liquid flows are used for determining liquid pressure.
Please note that the current value of the pressure is dependent on the previous value. This feature makes pressure an “integrating” variable. When the flows into the node equal the flows out, then the pressure is unchanged. The pressure changes only when the flows are not balanced.
Before the calculated pressure is sent to the analog input, it should be slightly filtered to simulate a lag. A filter time of 0.03 to 0.10 minutes is usually sufficient.
Pressure-Flow Network Simulation
Equations 2 and 3a show that flow is dependent upon pressure and equation 7 shows that pressure is dependent upon flow. In a network such as that in Figure 4, the simulation calculations are highly interactive, requiring an iterative approach. The iterations occur at the block execution frequency, which should be as fast as possible (typically 0.5 seconds). The accumulation factor (Ka) in equation 7 must be tuned to provide rapid convergence without excessive overshoot.
Using the flow and pressure labels in Figure 4, the flows are calculated as follows (F1 and P4 are given):
F2 = f (P1, P2) Note: Eq 3 -6
F3 = K3 * (FCout / 100) * SQRT [(P2 – P1) / Pd3ref]
F4 = F2 – F3
F5 = f (P3, P2) Note: Eq 3 -6
F6 = K6 * (FCout / 100) * SQRT [(P3 – P2) / Pd6ref]
F7 = K7 * (PCout / 100) * SQRT [(P3 – P4) / Pd7ref]
The pressures are calculated as follows:
P1 = P1prev + K1a * (F1 + F3 – F2)
P2 = P2prev + K2a * (F2 + F6 – F3 – F5)
P3 = P3prev + K3a * (F5 – F6 – F7)
The flow simulation block, to be discussed in the DCS Implementation section of this document, includes a feedforward option to speed up convergence. For example, feedforward would be used for flow F7 in Figure 4 so that any change in flow F1 would be immediately passed on to flow F7, rather than waiting for the intermediate flows and pressures to respond.
Level Simulation
Level is similar to pressure in that it is dependent on the balance between flows into the vessel and the flows out (see Figure 5). However, the flows are liquid flows in this case.
L = Lprev + Ka * (ΣFin – ΣFout) (8)
where:
L = simulated level
Lprev = previously calculated level
Ka = accumulation factor
ΣFin = sum of all flows in
ΣFout = sum of all flows out
Like pressure, the current value of the level is dependent on the previous value. This feature makes level an “integrating” variable also. When the flows into the vessel equal the flows out, then the level is unchanged. The level changes only when the flows are not balanced.
Before entering the calculation, the individual flows should be filtered to simulate a lag. Flows into the vessel sometimes take more time to affect the level than flows out.
Boiling liquid levels, such as in a boiler steam drum, are more complicated. The level shrinks and swells as the pressure in the drum varies. This discussion does not include boiling levels.
Temperature Simulation
Temperatures have in common the effect of thermal lag. As a result, a considerable lag exists between the manipulated variable and its effect on the temperature. Otherwise, temperatures in general have little in common.
However, the following types of temperatures each have a consistent approach to being simulated:
- Fired heater combined outlet temperature
- Fired heater pass outlet temperatures
- Heat exchanger outlet temperature
- Distillation tray temperature
Temperature Simulation – Fired Heater Combined Outlet
The fired heater outlet temperature is dependent on several factors (see Figure 6). First, the heat released by the fuel is calculated in equation 9 (fuel gas is assumed):
Qrel = Htval * Ffuel (9)
Next, the heat absorbed by the feed to the heater is calculated using the heater efficiency:
Qabs = Qrel * Eff / 100 (10)
The heat absorbed can be related to the outlet temperature via the sensible heat equation:
Qabs = Cp * Ffeed * (Tout – Tin) (11)
The left-hand terms of equations 10 and 11 can be set equal and rearranged to obtain equation 12:
Tout = Htval * Eff * Ffuel / (100 * Cp * Ffeed) + Tin (12)
where:
Qrel = heat released from fuel (MMBTU/Hr)
Qabs = heat absorbed by feed (MMBTU/Hr)
Htval = fuel gas heating value (BTU/MSCF)
Ffuel = fuel gas flow (MSCF/Hr)
Eff = heater efficiency (%)Cp = feed heat capacity (MBTU/B-DegF)
Ffeed = feed flow (B/Hr)
Tin = feed inlet temperature (DegF)
Tout = feed outlet temperature (DegF)
Before entering the calculation, the individual variables should be filtered to simulate a lag. The heat curve of vaporizing feeds can be approximated by using average liquid heat capacity.
Temperature Simulation – Heater Pass Outlets
The fired heater pass outlet temperatures can be simulated as follows (see Figure 7):
Ftot = ΣFi (13)
dTi = [(Ri * Ftot – Fi) / Fi] * (Tout – Tin) (14)
Ti = Tout + dTi (15)
where:
Ftot = total of all pass flows
Fi = pass i flow
dTi = pass i temperature deviation from combined outlet temperature
Ri = pass i flow ratio target for balanced temperature
Tin = heater inlet temperature
Tout = combined outlet temperature
Ti = pass i outlet temperature
Before entering the calculation, the individual variables should be filtered to simulate a lag.
Temperature Simulation – Heat Exchanger Outlet
The outlet temperature of a shell-and-tube heat exchanger can be simulated via the sensible heat equation (see Figure 8):
Q = Cp1 * F1 * (Tin1 – Tout1) (16)
Q = Cp2 * F2 * (Tout2 – Tin2) (17)
Equation 17 can be rearranged to obtain equation 18 with Q being calculated using equation 16:
Tout2 = Q / (Cp2 * F2) + Tin2 (18)
where:
Q = heat transferred (MMBTU/Hr)
Cp1 = stream 1 heat capacity (MBTU/B-DegF)
F1 = steam 1 flow (B/Hr)
Tin1 = stream 1 inlet temperature (DegF)
Tout1 = stream 1 outlet temperature (DegF)
Cp2 = stream 2 heat capacity (MBTU/B-DegF)
F2 = steam 2 flow (B/Hr)
Tin2 = stream 2 inlet temperature (DegF)
Tout2 = stream 2 outlet temperature (DegF)
If stream1 is condensing steam, then Equation 16 can be used by entering the latent heat into Cp1, the constant 1.0 into Tin1, and the constant 0.0 into Tout1.
Before entering the calculation, the individual variables should be filtered to simulate a lag. Note: Stream 2 is being heated by stream 1 in equations 16-18.
Temperature Simulation – Distillation Tray
The tray temperature in a distillation column can be simulated by characterizing it versus the manipulated variable. For example, the tray temperature in Figure 9 is dependent primarily on the sidedraw product yield (i.e., ratio of product to feed flow). As the yield increases, the temperature will increase due to heavier components being drawn up to the tray. Therefore, the tray temperature should be controlled by manipulating the sidedraw yield.
The yield must first be calculated and then lag and deadtime applied to it before entering the characterization.
Analyzer Simulation
Like temperatures, analyzer inputs in general have very little in common. However, the following types of analyzers each have a consistent approach to being simulated:
- Distillation tray composition
- pH
- Fired heater stack oxygen
Analyzer Simulation – Distillation Tray
The tray composition in a distillation column can be simulated by characterizing it versus the tray temperature. For example, an increasing temperature indicates that heavier components are being drawn up to the tray.
The temperature should have deadtime and lag applied to it before entering the characterization. In addition, the tray analyzer is typically a gas chromatograph that updates the composition at a set cycle. In between updates, the signal is steady. Figure 10 shows the analyzer’s stair-step response to a change in the manipulated variable.
Analyzer Simulation – pH
Figure 11 shows a typical pH control strategy. The influent is treated with either a strong caustic or a strong acid to achieve a setpoint pH for the effluent. The pH can be simulated using the following inputs:
- Influent flow (Fi)
- Caustic flow (Fc) and pH
- Acid flow (Fa) and pH
pH is defined via the following equation:
pH = -log10[H+] (19)
where:
[H+] = concentration of hydrogen ions (kg-ions/m3).
As equation 19 indicates, a linear change in the hydrogen ion concentration results in a logarithmic, or highly nonlinear, change in pH. Therefore, the standard PID algorithm will have great difficulty controlling pH over any sizable range. A previously released SAS functional specification described how to linearize the pH input (MEAS) to a PID controller (AC in Figure 11):
MEAS = SCALE * [10pH-14 – 10-pH] (20)
where:
SCALE = arbitrary scaling factor.
Equation 20 can be used to linearize the pH of each stream. Then, the linearized pH can be blended linearly to obtain the linearized pH of the effluent:
MEASe = (Fi * MEASi + Fc * MEASc + Fa *MEASa) / (Fi + Fc + Fa) (21)
Finally, the effluent linearized pH (MEASe ) can be converted to pH via a characterizer based on equation 20. The calculated pH should have lag and deadtime applied.
Analyzer Simulation – Fired Heater Stack Oxygen
The fired heater excess oxygen rate is basically the difference between the combustion air flow and the fuel combusted:
FO2 = 0.21 * Fair – O2req * Ffuel (22)
where:
FO2 = excess oxygen rate (MSCF/Hr)
Fair = combustion air rate (MSCF/Hr)
O2req = O2 required for complete combustion of the fuel (SCF/SCF)
Ffuel = fuel gas flow (MSCF/Hr)
The percent oxygen is the excess oxygen rate divided by the flue gas rate:
Fflue = Ffuel + Fair (23)
O2% = 100 * FO2 / Fflue (24)
where:
Fflue = flue gas rate (MSCF/Hr)
O2% = stack oxygen (%)
Before entering the calculation, the individual variables should be filtered to simulate a lag.
DCS IMPLEMENTATION – FLOW SIMULATION
Flow Simulation Block
The flow simulation block is a CALCA block that performs the calculation in equation 2. The following connections are required:
RI01 = Valve position (%)
RI02 = Upstream pressure (PSIG)
RI03 = Downstream pressure (PSIG)
RI06 = Feedforward flow input (lock to zero if not used)
RI07 = Feedforward adaptive gain factor (lock to one if not used)
MA = Lock to auto
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available
RI04 = Simulated flow filter factor (set between 0.0 [no filter] and 1.0 [total filter])
RI05 = Flow at 100% output and at pressure differential Pdref (K in equation 2)
RI08 = Feedforward gain factor used to attenuate the feedforward action
TIMINI = 3
M01 = 100
M02 = Reference differential pressure (Pdref in equation 2)
M03 = 0.5
M04 = 1.0
M05 = Minimum flow (usually zero)
M06 = Maximum flow (usually flow transmitter range)
M07 = Simulated transmitter bias (flow units)
M08 = Maximum simulated noise (flow units)
The block generates the following outputs:
RO01 = Simulated flow (filtered and with noise applied)
RO02 = Simulated flow (filtered and without noise applied)
RO03 = Unfiltered flow (without noise applied)
RO04 = Previous value of feedforward input
M11 = Actual differential pressure (Pup – Pdn in equation 2)
M12 = Simulated flow without feedforward action
M13 = Feedforward action
Flow Simulation Block Steps
STEP01 = DIV RI01 M01 ;PCT TO FRACT
STEP02 = SUB RI02 RI03 ;DELTA P
STEP03 = IN 0
STEP04 = MAX 2
STEP05 = OUT M11 ;DELTA P
STEP06 = DIV M02 ;REF DP
STEP07 = SQRT
STEP08 = MUL 2
STEP09 = MUL RI05 ;SCALE FACTOR
STEP10 = ADD M07 ;BIAS
STEP11 = OUT M12 ;FLOW W/O FF
STEP12 = CST
STEP13 = BII 17
STEP14 = SUB RI06 RO04 ;FF CHANGE
STEP15 = MUL RI07 ;ADAPT GAIN
STEP16 = MUL RI08 ;FF GAIN
STEP17 = OUT M13 ;FF ACTION
STEP18 = IN RI06 ;CURR FF INPUT
STEP19 = OUT RO04 ;PREV FF
STEP20 = ADD M12 M13 ;TOT FLOW
STEP21 = IN M05 ;MIN FLOW
STEP22 = MAX 2
STEP23 = IN M06 ;MAX FLOW
STEP24 = MIN 2
STEP25 = OUT RO03 ;UNFILTERED FLOW
STEP26 = BII 32
STEP27 = SUB M04 RI04 ;1 – FILT FACTOR
STEP28 = MUL RO03 ;UNFILT FLOW
STEP29 = MUL RI04 RO02 ;FILT * FILTERED FLOW
STEP30 = ADD 2
STEP31 = GTO 33
STEP32 = IN RO03 ;UNFILT FLOW
STEP33 = OUT RO02 ;FILTERED FLOW
STEP34 = CST
STEP35 = RAND ;RANDOM NO. (0 TO 1)
STEP36 = SUB M03 ;CONSTANT 0.5
STEP37 = MUL M08 ;MAX NOISE
STEP38 = ADD RO02
STEP39 = OUT RO01 ;FLOW W/ NOISE
STEP40 = END
Flow Simulation Block Logic Details
Steps 1-9: Perform calculation shown in equation 2. Limit the pressure drop to a minimum of zero and store to M11.
Steps 10-11: Apply the simulated transmitter bias M07 and store the result to M12.
Steps 13: If this is the block initialization pass (BII), then go to step 17 where the feedforward action M13 is zeroed.
Steps 14-17: Calculate the change in the feedforward input and apply the adaptive gain (RI07) and the feedforward gain (RI08). Store the result to M13.
Steps 18-19: Store the current feedforward input to the previous value (RO04) for the next execution.
Steps 20-25: Add the calculated flow (M12) and the feedforward action (M13), limit the result to the minimum flow (M05) and the maximum flow (M06), and store the result to RO03.
Steps 26: If this is the first time the block is being executed (BII=1), then go to step 32 to bypass the filtering calculation because it uses a value from the previous execution.
Steps 27-33: Perform the filtering calculation. Filtering is done by taking a fraction (RI04) of the previous value (RO02), one minus that fraction times the new value (RO03), and adding the two terms together. The filtered value is stored in RO02.
Steps 35-39: Simulate noise by generating a random number (RAND) between 0 and 1, subtracting 0.5, and multiplying by the maximum noise level (M08). Add the noise to the filtered flow (RO02) and store the result to RO01.
DCS IMPLEMENTATION – COMPRESSOR SIMULATION
Compressor Simulation Blocks
Figure 13 shows the block schematic for a typical compressor simulation. The application contains the following blocks (should be executed in this order):
- CALCA block for calculating pressure ratio (P_RATIO).
- CHARC block for performance curve at lowest speed (PERF_CURV1).
- CHARC block for performance curve at next speed (PERF_CURV2).
- CHARC block for performance curve at next speed (PERF_CURV3).
- CHARC block for performance curve at next speed (PERF_CURV4).
- CHARC block for performance curve at highest speed (PERF_CURV5).
- CALCA block for interpolating the performance curves (PERF_CURVE).
- CALCA block for converting performance curve output to flow (F_SUCT).
Pressure Ratio Block P_RATIO
P_RATIO is a CALCA block that calculates the pressure ratio via equation 3a. The block also applies the performance factor that allows the engineer to vary the compressor performance in the simulation. The following connections are required:
RI01 = Suction pressure
RI02 = Discharge pressure
RI03 = Performance factor (%)
MA = :P_RATIO.MA.1 (lock to auto)
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available
TIMINI = 3
M01 = 0.0 if suction pressure is PSIA or 14.7 if PSIG
M02 = 0.0 if discharge pressure is PSIA or 14.7 if PSIG
M03 = 100.0
M04 = 1.0
The block generates the following outputs:
RO01 = Pressure ratio modified by performance factor
RO02 = Calculated pressure ratio
Pressure Ratio Block Steps
STEP01 = IN RI02 ;DISCH P
STEP02 = ADD M02 ;CONV DISCH TO ABS P
STEP03 = IN RI01 ;SUCT P
STEP04 = ADD M01 ;CONV SUCT TO ABS P
STEP05 = DIV
STEP06 = OUT RO02 ;PRES RATIO
STEP07 = MUL M03 ;CONSTANT 100.0
STEP08 = DIV RI03 ;PERF FACTOR
STEP09 = MAX M04 ;LIMIT TO 1.0 MIN
STEP10 = OUT RO01 ;MOD PRES RATIO
STEP11 = END
Performance Curve Block PERF_CURV1
PERF_CURV1 is a CHARC block that contains the performance curve for one speed on the performance chart (see Figure 2). The points are entered as x-y pairs, where x is the pressure ratio Rc and y is the orifice differential pressure hc.
The following connections are required:
MEAS = :P_RATIO.RO01
MA = :PERF_CURV1.MA.1 (lock to auto)
The following parameters must be set accordingly:
HSCO1 = Highest value of hc allowed
LSCO1 = Lowest value of hc allowed
ENDP = Number of points entered from performance curve
X_1 = 1.0 (minimum pressure ratio)
Y_1 = hc at X_1 pressure ratio
X_2 = Next higher pressure ratio
Y_2 = hc at X_2 pressure ratio
: :
X_n = Highest pressure ratio (n = value in ENDP)
Y_n = hc at X_n pressure ratio
Each speed on the performance chart must have its own CHARC block named PERF_CURV2, …3, etc. up to five. If the compressor is driven by a fixed speed motor, then only one curve is needed.
Performance Curve Interpolation Block PERF_CURVE
PERF_CURVE is a CALCA block that interpolates the value of hc from the performance curve blocks PERF_CURV1, …2, etc. The following connections are required:
RI01 = :PERF_CURV1.OUT
RI02 = :PERF_CURV2.OUT
RI03 = :PERF_CURV3.OUT
RI04 = :PERF_CURV4.OUT
RI05 = :PERF_CURV5.OUT
RI08 = Compressor speed
MA = :PERF_CURVE.MA.1 (lock to auto)
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available
TIMINI = 3
M01 = Speed corresponding to performance curve in PERF_CURV1
M02 = Speed corresponding to performance curve in PERF_CURV2
M03 = Speed corresponding to performance curve in PERF_CURV3
M04 = Speed corresponding to performance curve in PERF_CURV4
M05 = Speed corresponding to performance curve in PERF_CURV5
M08 = 1.0
The block generates the following output:
RO01 = Value of hc interpolated from the performance curves
This block is not required for fixed speed motor-driven compressors because only one performance curve exists.
Performance Curve Interpolation Block Steps
STEP01 = SUB RI08 M02 ;PERF CURVE 2
STEP02 = BIP 12
STEP03 = IN RI01 ;PERF CURVE 1
STEP04 = OUT M11
STEP05 = IN RI02 ;PERF CURVE 2
STEP06 = OUT M12
STEP07 = IN M01 ;SPEED 1
STEP08 = OUT M13
STEP09 = IN M02 ;SPEED 2
STEP10 = OUT M14
STEP11 = GTO 42
STEP12 = SUB RI08 M03 ;PERF CURVE 3
STEP13 = BIP 23
STEP14 = IN RI02 ;PERF CURVE 2
STEP15 = OUT M11
STEP16 = IN RI03 ;PERF CURVE 3
STEP17 = OUT M12
STEP18 = IN M02 ;SPEED 2
STEP19 = OUT M13
STEP20 = IN M03 ;SPEED 3
STEP21 = OUT M14
STEP22 = GTO 42
STEP23 = SUB RI08 M04 ;PERF CURVE 4
STEP24 = BIP 34
STEP25 = IN RI03 ;PERF CURVE 3
STEP26 = OUT M11
STEP27 = IN RI04 ;PERF CURVE 4
STEP28 = OUT M12
STEP29 = IN M03 ;SPEED 3
STEP30 = OUT M13
STEP31 = IN M04 ;SPEED 4
STEP32 = OUT M14
STEP33 = GTO 42
STEP34 = IN RI04 ;PERF CURVE 4
STEP35 = OUT M11
STEP36 = IN RI05 ;PERF CURVE 5
STEP37 = OUT M12
STEP38 = IN M04 ;SPEED 4
STEP39 = OUT M13
STEP40 = IN M05 ;SPEED 5
STEP41 = OUT M14
STEP42 = SUB M12 M11
STEP43 = SUB M14 M13
STEP44 = IN M08 ;CONSTANT 1.0
STEP45 = MAX 2
STEP46 = DIV
STEP47 = SUB RI08 M13
STEP48 = MUL 2
STEP49 = ADD M11
STEP50 = OUT RO01 ;%HC
Performance Curve Interpolation Block Logic Details
Steps 1-11: Determine if current speed (RI08) is between curve 1 speed (M01) and curve 2 speed (M02). If not, then go to step 12. Otherwise, store hc values from curves 1 and 2 into M11 and M12, and speeds into M13 and M14. Go to step 42 to perform interpolation between these two curves.
Steps 12-22: Determine if current speed (RI08) is between curve 2 speed (M02) and curve 3 speed (M03). If not, then go to step 23. Otherwise, store hc values from curves 2 and 3 into M11 and M12, and speeds into M13 and M14. Go to step 42 to perform interpolation between these two curves.
Steps 23-33: Determine if current speed (RI08) is between curve 3 speed (M03) and curve 4 speed (M04). If not, then go to step 34. Otherwise, store hc values from curves 3 and 4 into M11 and M12, and speeds into M13 and M14. Go to step 42 to perform interpolation between these two curves.
Steps 34-41: Current speed (RI08) must be between curve 4 speed (M04) and curve 5 speed (M05). Store hc values from curves 4 and 5 into M11 and M12, and speeds into M13 and M14.
Steps 42-50: Perform the interpolation between the speeds in M13 and M14 and store the result to RO01.
Suction Flow Calculation Block F_SUCT
F_SUCT is a CALCA block that calculates the compressor suction flow via equations 3c, 4, and 5. The following connections are required:
RI01 = hc from performance curves (either PERF_CURVE.RO01 if variable speed compressor or PERF_CURV1.OUT if fixed speed)
RI02 = hc calculation factor from anti-surge controls (FLOW_SP.RO03)
RI04 = Flowing density factor at suction conditions from anti-surge controls (FLOW_SP.RI04)
RI05 = Maximum flow from anti-surge controls (FLOW_SP.RI05)
RI06 = Flowing density factor at orifice conditions from anti-surge controls (FLOW_SP.RI06)
BI01 = Compressor run indication
MA = :F_SUCT.MA.1 (lock to auto)
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available
TIMINI = 3
M02 = 100.0
The block generates the following outputs:
RO01 = Pressure ratio modified by performance factor
RO02 = Calculated pressure ratio
Note: If flow orifice is in the suction, then RI04 and RI06 are equal and cancel each other out.
Suction Flow Calculation Block Steps
STEP01 = IN RI01 ;PERF CURVE %HC
STEP02 = IN 0
STEP03 = MAX 2
STEP04 = DIV RI02 ;HC CALC FACTOR
STEP05 = OUT M18 ;PERF CURVE %HS
STEP06 = DIV M02 ;MAX H
STEP07 = SQRT
STEP08 = DIV RI04 RI06 ;SUCT / ORIF COMP
STEP09 = MUL RI05 ;MAX FLOW
STEP10 = IN BI01 ;COMP RUN
STEP11 = MUL 3
STEP12 = OUT RO01 ;COMP FT INPUT
STEP13 = END
DCS IMPLEMENTATION – PRESSURE SIMULATION
Pressure Simulation Block
The pressure simulation block is a CALCA block that performs the calculation in equation 7. The following connections are required:
RI01 = Total flow into pressure node
RI03 = Total flow out of pressure node
MA = Lock to auto
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available
RI02 = Lag factor for flow into node (must be between 0 and 1)
RI04 = Lag factor for flow out of node (must be between 0 and 1)
RI07 = Maximum simulated noise (pressure units)
RI08 = Accumulation factor (Ka in equation 7)
BI01 = Initialization command (pressure is set to value in M12)
TIMINI = 3
M08 = 0.5
M09 = 1.0
M10 = Minimum pressure
M11 = Maximum pressure
M12 = Initialization pressure
The block generates the following outputs:
RO01 = Simulated pressure (with noise applied)
RO02 = Simulated pressure (without noise applied)
RO04 = Imbalance between flow in and flow out
BO01 = Initialization flag
M01 = Previous value of flow into node
M02 = Previous value of flow out of node
Pressure Simulation Block Steps
STEP01 = RCL BI01 ;INIT COMMAND
STEP02 = BII 5
STEP03 = OUT BO01 ;INIT FLAG
STEP04 = GTO 6
STEP05 = SET BO01 ;INIT FLAG
STEP06 = CST
STEP07 = IN BO01 ;INIT FLAG
STEP08 = BIT 14
STEP09 = SUB M09 RI02 ;1 – LAG FACTOR
STEP10 = MUL RI01 ;CURR INPUT
STEP11 = MUL RI02 M01 ;LAG * PREV INPUT
STEP12 = ADD 2
STEP13 = GTO 15
STEP14 = IN RI01 ;CURR INPUT
STEP15 = OUT M01 ;PREV INPUT
STEP16 = CST
STEP17 = IN BO01 ;INIT FLAG
STEP18 = BIT 24
STEP19 = SUB M09 RI04 ;1 – LAG FACTOR
STEP20 = MUL RI03 ;CURR INPUT
STEP21 = MUL RI04 M02 ;LAG * PREV INPUT
STEP22 = ADD 2
STEP23 = GTO 25
STEP24 = IN RI03 ;CURR INPUT
STEP25 = OUT M02 ;PREV INPUT
STEP26 = CST
STEP27 = SUB M01 M02
STEP28 = OUT RO04 ;FLOW IMBALANCE
STEP29 = CST
STEP30 = IN BO01 ;INIT FLAG
STEP31 = BIT 35
STEP32 = MUL RI08 RO04 ;ACCUM FACTOR
STEP33 = ADD RO02 ;PREV ACCUM
STEP34 = GTO 36
STEP35 = IN M12 ;INIT VALUE
STEP36 = IN M10 ;MIN ACCUM
STEP37 = MAX 2
STEP38 = IN M11 ;MAX ACCUM
STEP39 = MIN 2
STEP40 = OUT RO02 ;CURR ACCUM
STEP41 = CST
STEP42 = RAND ;RANDOM NO. (0 TO 1)
STEP43 = SUB M08 ;CONSTANT 0.5
STEP44 = MUL RI07 ;MAX NOISE
STEP45 = ADD RO02
STEP46 = OUT RO01 ;ACCUM W/ NOISE
STEP47 = END
Pressure Simulation Block Logic Details
Steps 1: Read and clear the block initialization command BI01. The value of BI01 is stored into the initialization flag BO01 in step 3.
Steps 2-5: If this is the block initialization pass (BII), then go to step 5 where the initialization flag BO01 is set.
Steps 7-15: If the initialization flag BO01 is on, then bypass the filtering calculation by going to step 14. Otherwise, perform the filtering calculation for the flow into the node. Filtering is done by taking a fraction (RI02) of the previous value (M01), one minus that fraction times the new value (RI01), and adding the two terms together. The filtered value is stored in M01.
Steps 17-25: If the initialization flag BO01 is on, then bypass the filtering calculation by going to step 24. Otherwise, perform the filtering calculation for the flow out of the node. Filtering is done by taking a fraction (RI04) of the previous value (M02), one minus that fraction times the new value (RI03), and adding the two terms together. The filtered value is stored in M02.
Steps 27-28: Calculate the flow imbalance and store the result to RO04.
Steps 30-31: If the initialization flag BO01 is on, then go to step 35 to set the pressure to the initialization value.
Steps 32-40: Multiply the accumulation factor (RI08) by the flow imbalance (RO04) and add the previous pressure (RO02). Limit the result to the minimum pressure (M10) and the maximum pressure (M11), and store the result to RO02.
Steps 42-46: Simulate noise by generating a random number (RAND) between 0 and 1, subtracting 0.5, and multiplying by the maximum noise level (RI07). Add the noise to the filtered flow (RO02) and store the result to RO01.
DCS IMPLEMENTATION – LEVEL SIMULATION
Level Simulation Block
The level simulation block is a CALCA block that performs the calculation in equation 8. It is identical to the pressure simulation block discussed previously. The following connections are required:
RI01 = Total flow into level
RI03 = Total flow out of level
MA = Lock to auto
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available
RI02 = Lag factor for flow into level (must be between 0 and 1)
RI04 = Lag factor for flow out of level (must be between 0 and 1)
RI07 = Maximum simulated noise (level units)
RI08 = Accumulation factor (Ka in equation 8)
BI01 = Initialization command (level is set to value in M12)
TIMINI = 3
M08 = 0.5
M09 = 1.0
M10 = Minimum level
M11 = Maximum level
M12 = Initialization level
The block generates the following outputs:
RO01 = Simulated level (with noise applied)
RO02 = Simulated level (without noise applied)
RO04 = Imbalance between flow in and flow out
BO01 = Initialization flag
M01 = Previous value of flow into level
M02 = Previous value of flow out of level
Level Simulation Block Steps
The steps for the level simulation block are identical to those for the pressure simulation block.
DCS IMPLEMENTATION – HEATER OUTLET TEMPERATURES SIMULATION
Heater Outlet Temperatures Simulation Blocks
Figure 14 shows the block schematic for a typical heater outlet temperature simulation. The simulation includes the combined outlet temperature plus the individual pass outlet temperatures (up to eight passes). The application contains the following blocks (should be executed in this order):
- CALCA block for calculating total feed flow from the pass flows (F_FEED).
- CALCA block for calculating combined outlet temperature (T_OUT).
- CALCA block for calculating outlet temperatures for passes 1-4 (T_PASS14).
- CALCA block for calculating outlet temperatures for passes 5-8 (T_PASS58).
Total Feed Flow Block F_FEED
F_FEED is a CALCA block that calculates the total heater feed rate by summing the pass flows. This block can accommodate up to eight passes. The following connections are required:
RI01 = Pass 1 flow
RI02 = Pass 2 flow (lock to zero if only one pass)
RI03 = Pass 3 flow (lock to zero if less than 3 passes)
RI04 = Pass 4 flow (lock to zero if less than 4 passes)
RI05 = Pass 5 flow (lock to zero if less than 5 passes)
RI06 = Pass 6 flow (lock to zero if less than 6 passes)
RI07 = Pass 7 flow (lock to zero if less than 7 passes)
RI08 = Pass 3 flow (lock to zero if less than 8 passes)
MA = :F_FEED.MA.1 (lock to auto)
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available.
TIMINI = 3
The block generates the following output:
RO01 = Total heater feed rate
Total Feed Flow Block Steps
STEP01 = ADD RI01 RI02 ;PASS1 + PASS2
STEP02 = ADD RI03 RI04 ;PASS3 + PASS4
STEP03 = ADD RI05 RI06 ;PASS5 + PASS6
STEP04 = ADD RI07 RI08 ;PASS7 + PASS8
STEP05 = ADD 4
STEP06 = OUT RO01 ;TOTAL FEED
STEP07 = END
Outlet Temperature Calculation Block T_OUT
T_OUT is a CALCA block that calculates the heater outlet temperature. The following connections are required:
RI01 = :F_FEED.RO01 (Total heater feed rate)
RI02 = Fuel gas flow
RI03 = Heater inlet temperature
MA = :T_OUT.MA.1 (lock to auto)
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available
RI06 = Fuel gas heating value (BTU/SCF)
RI07 = Feed heat capacity (BTU/B/DegF)
RI08 = Heater efficiency (%)
TIMINI = 3
M01 = Feed flow conversion factor (feed flow units to MB/D)
M02 = Fuel gas flow conversion factor (fuel gas flow units to MSCF/D)
M03 = 0.0
M04 = 100.0
M05 = Minimum denominator to prevent divide by zero (e.g., 0.001)
The block generates the following outputs:
RO01 = Heater outlet temperature
RO02 = Converted feed flow
RO03 = Converted fuel gas flow
RO04 = Temperature increase in heater
M20 = Heater efficiency converted from % to fraction
Outlet Temperature Calculation Block Steps
STEP01 = DIV RI08 M04 ;EFF / 100
STEP02 = OUT M20
STEP03 = MUL RI01 M01 ;FEED FLOW CONVERSION
STEP04 = MAX M03 ;LIMIT TO MIN ZERO
STEP05 = OUT RO02 ;CONVERTED FEED FLOW
STEP06 = MUL RI02 M02 ;FG FLOW CONVERSION
STEP07 = MAX M03 ;LIMIT TO MIN ZERO
STEP08 = OUT RO03 ;CONVERTED FG FLOW
STEP09 = CST
STEP10 = MUL RI06 M20 ;HT VAL * EFF
STEP11 = MUL RO03 ;FG FLOW
STEP12 = MUL RI07 RO02 ;HT CAPY * FEED FLOW
STEP13 = MAX M05 ;MIN DENOM
STEP14 = DIV
STEP15 = OUT RO04 ;TEMP INCREASE
STEP16 = ADD RI03 ;HTR INLET TEMP
STEP17 = OUT RO01 ;HTR OUTLET TEMP
STEP18 = END
Pass 1-4 Outlet Temperature Calculation Block T_PASS14
T_PASS14 is a CALCA block that calculates the heater pass outlet temperatures for passes 1-4. The following connections are required:
RI01 = Pass 1 flow
RI02 = Pass 2 flow
RI03 = Pass 3 flow (lock to zero if less than 3 passes)
RI04 = Pass 4 flow (lock to zero if less than 4 passes)
RI05 = Heater inlet temperature
RI06 = :T_OUT.RO01 (Heater outlet temperature)
RI07 = :F_FEED.RO01 (Total heater feed rate)
MA = :T_PASS14.MA.1 (lock to auto)
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available
TIMINI = 3
M01 = Pass 1 flow ratio at which pass outlet temperature will be equal to combined outlet temperature
M02 = Pass 2 flow ratio at which pass outlet temperature will be equal to combined outlet temperature
M03 = Pass 3 flow ratio at which pass outlet temperature will be equal to combined outlet temperature (set to 0.0 if sess than 3 passes)
M04 = Pass 4 flow ratio at which pass outlet temperature will be equal to combined outlet temperature (set to 0.0 if less than 4 passes)
M05 = Temperature conversion factor (1.8 if inputs are DegF and outlets are DegC; 1.0 if all are DegF)
M06 = Temperature conversion factor (32 if inputs are DegF and outlets are DegC; 0.0 if all are DegF)
M07 = Minimum pass flow to prevent divide by zero (e.g., 0.001)
The block generates the following outputs:
RO01 = Pass 1 outlet temperature
RO02 = Pass 2 outlet temperature
RO03 = Pass 3 outlet temperature
RO04 = Pass 4 outlet temperature
M11 = Pass 1 deviation from combined outlet
M12 = Pass 2 deviation from combined outlet
M13 = Pass 3 deviation from combined outlet
M14 = Pass 4 deviation from combined outlet
M15 = Converted heater inlet temperature
M16 = Converted heater combined outlet temperature
M17 = Overall heater delta temperature
Note: Heat balance among passes is altered by changing M01 – M04. Sum of all M01 – M04 (including passes > 4) must equal 1.0.
Pass 1-4 Outlet Temperature Calculation Block Steps
STEP01 = SUB RI05 M06 ;CONVERT DEGF->C
STEP02 = DIV M05
STEP03 = OUT M15 ;CONVERTED INLET
STEP04 = CST
STEP05 = SUB RI06 M06 ;CONVERT DEGF->C
STEP06 = DIV M05
STEP07 = OUT M16 ;CONVERTED OUTLET
STEP08 = CST
STEP09 = SUB M16 M15 ;OUTLET – INLET
STEP10 = OUT M17 ;HTR DELTA TEMP
STEP11 = CST ;PASS 1
STEP12 = MUL RI07 M01 ;TGT PASS FLOW
STEP13 = SUB RI01 ;PASS1 FLOW
STEP14 = MAX RI01 M07 ;PREVENT DIV BY 0
STEP15 = DIV
STEP16 = MUL M17 ;HTR DELTA TEMP
STEP17 = OUT M11 ;PASS DEV FM COMB
STEP18 = ADD M16 ;OUTLET
STEP19 = OUT RO01 ;PASS1 OUTLET
STEP20 = CST ;PASS 2
STEP21 = MUL RI07 M02 ;TGT PASS FLOW
STEP22 = SUB RI02 ;PASS2 FLOW
STEP23 = MAX RI02 M07 ;PREVENT DIV BY 0
STEP24 = DIV
STEP25 = MUL M17 ;HTR DELTA TEMP
STEP26 = OUT M12 ;PASS DEV FM COMB
STEP27 = ADD M16 ;OUTLET
STEP28 = OUT RO02 ;PASS2 OUTLET
STEP29 = CST ;PASS 3
STEP30 = MUL RI07 M03 ;TGT PASS FLOW
STEP31 = SUB RI03 ;PASS3 FLOW
STEP32 = MAX RI03 M07 ;PREVENT DIV BY 0
STEP33 = DIV
STEP34 = MUL M17 ;HTR DELTA TEMP
STEP35 = OUT M13 ;PASS DEV FM COMB
STEP36 = ADD M16 ;OUTLET
STEP37 = OUT RO03 ;PASS3 OUTLET
STEP38 = CST ;PASS 4
STEP39 = MUL RI07 M04 ;TGT PASS FLOW
STEP40 = SUB RI04 ;PASS4 FLOW
STEP41 = MAX RI04 M07 ;PREVENT DIV BY 0
STEP42 = DIV
STEP43 = MUL M17 ;HTR DELTA TEMP
STEP44 = OUT M14 ;PASS DEV FM COMB
STEP45 = ADD M16 ;OUTLET
STEP46 = OUT RO04 ;PASS4 OUTLET
STEP47 = END
Pass 1-4 Outlet Temperature Calculation Logic Details
Steps 1-3: Convert inlet temperature (RI05) from DegF to DegC if pass outlet temperatures must be in DegC and inlet is in DegF. The converted temperature is stored into M15.
Steps 5-7: Convert combined outlet temperature (RI06) from DegF to DegC if pass outlet temperatures must be in DegC and combined outlet is in DegF. The converted temperature is stored into M16.
Steps 9-10: Calculate the overall change in temperature across the heater (i.e., combined outlet – inlet) and store into M17.
Steps 12-19: Perform the calculations in equations 14 and 15 for pass 1. The pass flow (RI01) is limited to a minimum (M07) to prevent dividing by zero. The pass outlet temperature is stored in RO01.
Steps 21-28: Perform the calculations in equations 14 and 15 for pass 2. The pass flow (RI02) is limited to a minimum (M07) to prevent dividing by zero. The pass outlet temperature is stored in RO02.
Steps 30-37: Perform the calculations in equations 14 and 15 for pass 3. The pass flow (RI03) is limited to a minimum (M07) to prevent dividing by zero. The pass outlet temperature is stored in RO03.
Steps 39-46: Perform the calculations in equations 14 and 15 for pass 4. The pass flow (RI04) is limited to a minimum (M07) to prevent dividing by zero. The pass outlet temperature is stored in RO04.
Pass 5-8 Outlet Temperature Calculation Block T_PASS58
T_PASS58 is a CALCA block that calculates the heater pass outlet temperatures for passes 5-8. This block is not needed if the heater has less than 5 passes. The following connections are required:
RI01 = Pass 5 flow
RI02 = Pass 6 flow (lock to zero if less than 6 passes)
RI03 = Pass 7 flow (lock to zero if less than 7 passes)
RI04 = Pass 8 flow (lock to zero if less than 8 passes)
RI05 = Heater inlet temperature
RI06 = :T_OUT.RO01 (Heater outlet temperature)
RI07 = :F_FEED.RO01 (Total heater feed rate)
MA = :T_PASS14.MA.1 (lock to auto)
The block parameters must be set as follows:
PERIOD = Fastest execution frequency available
TIMINI = 3
M01 = Pass 5 flow ratio at which pass outlet temperature will be equal to combined outlet temperature
M02 = Pass 6 flow ratio at which pass outlet temperature will be equal to combined outlet temperature (set to 0.0 if less than 6 passes)
M03 = Pass 3 flow ratio at which pass outlet temperature will be equal to combined outlet temperature (set to 0.0 if less than 7 passes)
M04 = Pass 4 flow ratio at which pass outlet temperature will be equal to combined outlet temperature (set to 0.0 if less than 8 passes)
M05 = Temperature conversion factor (1.8 if inputs are DegF and outlets are DegC; 1.0 if all are DegF)
M06 = Temperature conversion factor (32 if inputs are DegF and outlets are DegC; 0.0 if all are DegF)
M07 = Minimum pass flow to prevent divide by zero (e.g., 0.001)
The block generates the following outputs:
RO01 = Pass 5 outlet temperature
RO02 = Pass 6 outlet temperature
RO03 = Pass 7 outlet temperature
RO04 = Pass 8 outlet temperature
M11 = Pass 5 deviation from combined outlet
M12 = Pass 6 deviation from combined outlet
M13 = Pass 7 deviation from combined outlet
M14 = Pass 8 deviation from combined outlet
M15 = Converted heater inlet temperature
M16 = Converted heater combined outlet temperature
M17 = Overall heater delta temperature
Note: Heat balance among passes is altered by changing M01 – M04. Sum of all M01 – M04 (including passes > 4) must equal 1.0.
Pass 5-8 Outlet Temperature Calculation Block Steps
The steps for block T_PASS58 are identical to those for T_PASS14.
DCS IMPLEMENTATION – HEAT EXCHANGER OUTLET TEMPERATURE SIMULATION
Exchanger Outlet Temperature Calculation Block T_EXCH
T_EXCH is a CALCA block that calculates the heat exchanger outlet temperature for the example in Figure 8. The following connections are required:
RI01 = Stream1 flow rate
RI02 = Stream1 inlet temperature (set to 1.0 if condensing steam)
RI03 = Stream1 outlet temperature (set to 0.0 if condensing steam)
RI05 = Stream2 flow rate
RI06 = Stream2 inlet temperature
MA = :T_EXCH.MA.1 (lock to auto)
The block parameters must be set as follows:
RI04 = Stream1 heat capacity (latent heat if steam)
RI07 = Stream2 heat capacity
TIMINI = 3
M01 = Stream1 flow conversion factor (e.g., 0.04167 for B/D to B/H)
M02 = Stream2 flow conversion factor
M03 = 0.0
M04 = Minimum denominator to prevent divide by zero (e.g., 0.001)
The block generates the following outputs:
RO01 = Stream2 outlet temperature
RO02 = BTU transferred
RO03 = Stream1 temperature decrease
RO04 = Stream2 temperature increase
M11 = Stream1 flow converted
M12 = Stream2 flow converted
Exchanger Outlet Temperature Calculation Block Steps
STEP01 = SUB RI02 RI03 ;STREAM1 INLET – OUTLET
STEP02 = MAX M03 ;LIMIT TO ZERO
STEP03 = OUT RO03 ;STREAM1 TEMP DECR
STEP04 = MUL RI01 M01 ;CONVERT FLOW
STEP05 = OUT M11 ;CONVERTED STREAM1 FLOW
STEP06 = MUL RI04 ;STREAM1 HT CAPY
STEP07 = MUL RO03 ;STREAM1 TEMP DECR
STEP08 = OUT RO02 ;BTU TRANSFERED
STEP09 = MUL RI05 M02 ;CONVERT FLOW
STEP10 = OUT M12 ;CONVERTED STREAM2 FLOW
STEP11 = MUL RI07 ;STREAM2 HT CAPY
STEP12 = MAX M04 ;LIMIT TO MIN DENOM
STEP13 = DIV
STEP14 = OUT RO04 ;STREAM2 TEMP INCR
STEP15 = ADD RI06 ;STREAM2 INLET
STEP16 = OUT RO01 ;STREAM2 OUTLET TEMP
STEP17 = END
DCS IMPLEMENTATION – GC ANALYZER SIMULATION
GC Analyzer Simulation Block A_GCSIM
A_GCSIM is a CALCA block that simulates a GC analyzer as shown in Figure 10. The analyzer samples a process stream and reports its composition at a set frequency, such as every three minutes. A_GCSIM acquires the simulated composition and updates its output at the analyzer cycle frequency to mimic an actual GC analyzer.
The following connections are required:
RI01 = Simulated composition
MA = :A_GCSIM.MA.1 (lock to auto)
The block parameters must be set as follows:
RI08 = GC analyzer cycle frequency (sec)
TIMINI = 3
The block generates the following outputs:
RO01 = Simulated composition updated at GC analyzer cycle frequency
M01 = GC analyzer cycle frequency (RI08 minus one)
GC Analyzer Simulation Block Steps
STEP01 = IN RI08 ;GC CYCLE TIME
STEP02 = SUB M02 ;CONSTANT 1.0
STEP03 = OUT M01
STEP04 = CST
STEP05 = BII 7 ;INIT LOGIC
STEP06 = GTO 10
STEP07 = CLR BO01 ;TIMER RESET
STEP08 = IN RI01 ;SIM COMPOSITION
STEP09 = OUT RO01 ;SIM GC SIGNAL
STEP10 = CST
STEP11 = IN BO01 ;TIMER RESET
STEP12 = OSP M01
STEP13 = OUT BO02 ;TIMER RUNNING
STEP14 = OR BO01 BO02 ;TIMER EXPIRED?
STEP15 = SSF BO01 ;TIMER RESET
STEP16 = CLR BO01
STEP17 = CST
STEP18 = IN BO02 ;TIMER RUNNING?
STEP19 = BIT 22
STEP20 = IN RI01 ;SIM COMPOSITION
STEP21 = OUT RO01 ;SIM GC SIGNAL
STEP22 = END
DCS IMPLEMENTATION – pH ANALYZER SIMULATION
pH Analyzer Simulation Blocks
Figure 15 shows the block schematic for a typical pH simulation. The application contains the following blocks (should be executed in this order):
- CALCA block that linearizes the pH inputs using equation 20 and then blends them using equation 21 (A_PH_SIM).
- CHARC block that characterizes the pH versus the blended linearized pH (A_PH_SIM2).
- LLAG block that applies a lag to the calculated pH (A_PH_LAG).
pH Linearization Block A_PH_SIM
A_PH_SIM is a CALCA block that linearizes the pH inputs using equation 20 and then blends them using equation 21. The following connections are required:
RI01 = Acid valve position or flow
RI02 = Caustic valve position or flow
RI03 = Influent flow
MA = :A_PH_SIM.MA.1 (lock to auto)
The block parameters must be set as follows:
RI04 = Acid pH.
RI05 = Caustic pH.
RI06 = Influent pH.
TIMINI = 3
M01 = Acid flow factor for converting valve position to flow (1.0 if input is flow)
M02 = Caustic flow factor for converting valve position to flow (1.0 if input is flow)
M03 = Influent flow conversion factor (1.0 if conversion not necessary)
M04 = 10.0
M05 = -1.0
M06 = Minimum total flow (prevent divide by zero)
M07 = Value of SCALE in equation 20
M08 = 14.0
The block generates the following outputs:
RO01 = Effluent linearized pH
RO02 = Acid flow (calculated)
RO03 = Caustic flow (calculated)
RO04 = Influent flow (converted)
M10 = Total flow
M11 = Acid pH (linearized)
M12 = Caustic pH (linearized)
M13 = Influent pH (linearized)
pH Linearization Block Steps
STEP01 = MUL RI01 M01 ;ACID VLV * FLOW FAC
STEP02 = OUT RO02 ;ACID FLOW
STEP03 = MUL RI02 M02 ;CAUSTIC VLV * FLOW FAC
STEP04 = OUT RO03 ;CAUSTIC FLOW
STEP05 = MUL RI03 M03 ;INFLUENT FLOW * CONV FACT
STEP06 = OUT RO04 ;INFLUENT FLOW
STEP07 = ADD 3
STEP08 = OUT M10 ;TOTAL FLOW IN
STEP09 = CST
STEP10 = IN M04 ;CONSTANT 10
STEP11 = SUB RI04 M08 ;ACID PH -14
STEP12 = EXP
STEP13 = IN M04 ;CONSTANT 10
STEP14 = MUL RI04 M05 ;-PH
STEP15 = EXP
STEP16 = SUB
STEP17 = OUT M11 ;LIN PH ACID
STEP18 = CST
STEP19 = IN M04 ;CONSTANT 10
STEP20 = SUB RI05 M08 ;BASE PH -14
STEP21 = EXP
STEP22 = IN M04 ;CONSTANT 10
STEP23 = MUL RI05 M05 ;-PH
STEP24 = EXP
STEP25 = SUB
STEP26 = OUT M12 ;LIN PH BASE
STEP27 = CST
STEP28 = IN M04 ;CONSTANT 10
STEP29 = SUB RI06 M08 ;INF PH -14
STEP30 = EXP
STEP31 = IN M04 ;CONSTANT 10
STEP32 = MUL RI06 M05 ;-PH
STEP33 = EXP
STEP34 = SUB
STEP35 = OUT M13 ;LIN PH INF
STEP36 = CST
STEP37 = MUL RO02 M11 ;ACID FLOW * LIN PH
STEP38 = MUL RO03 M12 ;CAUSTIC FLOW * LIN PH
STEP39 = MUL RO04 M13 ;INFLUENT FLOW * LIN PH
STEP40 = ADD 3
STEP41 = IN M10 ;TOTAL FLOW IN
STEP42 = MAX M06 ;MIN FLOW
STEP43 = DIV
STEP44 = MUL M07 ;SCALE
STEP45 = OUT RO01 ;LIN PH EFF
STEP46 = END
pH Linearization Logic Details
Steps 1-2: Convert acid valve position into flow and store into RO02.
Steps 3-4: Convert caustic valve position into flow and store into RO03.
Steps 5-6: Convert influent flow to be compatible with acid and caustic flows and store into RO04.
Steps 7-8: Sum the three flows calculated above and store the total into M10.
Steps 10-17: Linearize the acid pH using equation 20 and store the result into M11.
Steps 19-26: Linearize the base (caustic) pH using equation 20 and store the result into M12.
Steps 28-35: Linearize the influent pH using equation 20 and store the result into M13.
Steps 37-45: Perform the calculation in equation 21. The total flow (M10) is limited to a minimum (M06) to prevent dividing by zero. The result is stored in RO01.
pH Characterizer Block A_PH_SIM2
A_PH_SIM2 is a CHARC block that characterizes the effluent pH versus the blended linearized pH from block A_PH_SIM. The following connections are required:
MEAS = :A_PH_SIM.RO01
MA = :A_PH_SIM2.MA.1 (lock to auto)
The following parameters must be set accordingly:
HSCI1 = 1
LSCI1 = -1
HSCO1 = 14.0
LSCO1 = 0.0
ENDP = 21
X_1 = -0.9999
Y_1 = 5.0
X_2 = -0.6308
Y_2 = 5.2
X_3 = -0.3979
Y_3 = 5.4
X_4 = -0.2508
Y_4 = 5.6
X_5 = -0.1579
Y_5 = 5.8
X_6 = -0.0990
Y_6 = 6.0
X_7 = -0.06151
Y_7 = 6.2
X_8 = -0.0373
Y_8 = 6.4
X_9 = -0.02114
Y_9 = 6.6
X_10 = -0.00954
Y_10 = 6.8
X_11 = 0.0
Y_11 = 7.0
X_12 = 0.00954
Y_12 = 7.2
X_13 = 0.02114
Y_13 = 7.4
X_14 = 0.0373
Y_14 = 7.6
X_15 = 0.06151
Y_15 = 7.8
X_16 = 0.0990
Y_16 = 8.0
X_17 = 0.1579
Y_17 = 8.2
X_18 = 0.2508
Y_18 = 8.4
X_19 = 0.3979
Y_19 = 8.6
X_20 = 0.6308
Y_20 = 8.8
X_21 = 0.9999
Y_21 = 9.0
Note: The characterizer values above correspond to a pH range of 5 to 9.
pH Lag Block A_PH_LAG
A_PH_LAG is a LLAG block that applies a lag to the pH from block A_PH_SIM2. The following connections are required:
MEAS = :A_PH_SIM2.OUT
MA = :A_PH_LAG.MA.1 (lock to auto)
The following parameters must be set accordingly:
HSCI1 = 14.0
LSCI1 = 0.0
HSCO1 = 14.0
LSCO1 = 0.0
LAGTIM = First order lag in pH response (minutes)
DCS IMPLEMENTATION – FIRED HEATER O2 ANALYZER SIMULATION
O2 Analyzer Simulation Block A_O2_SIM
A_O2_SIM is a CALCA block that calculates the oxygen % in the flue gas from a fired heater using equations 22-24. The following connections are required:
RI01 = Combustion air rate
RI02 = Fuel gas rate
MA = :A_O2_SIM.MA.1 (lock to auto)
The block parameters must be set as follows:
RI03 = Fuel gas O2 requirement for combustion
TIMINI = 3
M01 = 0.21
M02 = Air flow units conversion factor (1.0 if conversion not necessary)
M03 = Fuel gas flow units conversion factor (1.0 if conversion not necessary)
M04 = 100.0
M05 = 0.0
M06 = Minimum flue gas rate (prevent divide by zero)
The block generates the following outputs:
RO01 = Simulated flue gas oxygen %
RO02 = Net oxygen rate
RO03 = Oxygen supply rate from air
RO04 = Oxygen combustion rate
M11 = Flue gas rate
O2 Analyzer Simulation Block Steps
STEP01 = MUL RI01 M01 ;COMB AIR * 0.21
STEP02 = MUL M02 ;UNITS CONVERSION
STEP03 = OUT RO03 ;O2 FLOW
STEP04 = CST
STEP05 = MUL RI02 RI03 ;FUEL * O2REQ
STEP06 = MUL M03 ;UNITS CONVERSION
STEP07 = OUT RO04 ;O2 CONSUMED BY FUEL
STEP08 = CST
STEP09 = SUB RO03 RO04 ;O2 IN – O2 CONSUMED
STEP10 = MAX M05 ;LIMIT TO ZERO
STEP11 = OUT RO02 ;NET O2 RATE
STEP12 = CST
STEP13 = MUL RI01 M02 ;AIR RATE
STEP14 = MUL RI02 M03 ;FUEL RATE
STEP15 = ADD 2
STEP16 = OUT M11 ;FLUE GAS RATE
STEP17 = CST
STEP18 = MUL RO02 M04 ;NET O2 RATE * 100
STEP19 = IN M11 ;FLUE GAS RATE
STEP20 = MAX M06 ;MIN FLUE GAS
STEP21 = DIV
STEP22 = OUT RO01 ;PERCENT O2
STEP23 = END
O2 Analyzer Simulation Logic Details
Steps 1-11: Perform the calculation in equation 22. The air rate and the fuel gas rate each have factors for converting the flows to compatible units. The net oxygen rate is limited to a minimum of zero (M05) to prevent a negative rate. The result is stored in RO02.
Steps 13-16: Calculate the flue gas rate using equation 23. The result is stored in M11.
Steps 18-22: Calculate the percent O2 using equation 24. The flue gas rate in M11 is limited to a minimum (M06) to prevent dividing by zero. The result is stored in RO01.