# Department of Chemical Engineering McMaster University 1280 Main Street West Hamilton, Ontario L8S 4L7 Canada

DISTILLATION DYNAMICS AND CONTROL WORKBOOK
By Francios Beaudreau Athanasis Kassidas Paul Nomikos Laura Ronholm San Yip Thomas Marlin

Section 1. 2. 3. 4. 5. 6. Appendix A B

Topic Introduction Exercise 1. Process and Equipment Principles Exercise 2. Open-loop Process Dynamics Exercise 3. Closed-loop PID Control Exercise 4. Student-defined Project References User’s Manual For Distillation Simulation MATLAB Controller Subroutine

Page 2 4 4 5 7 9 11 16

1

1. Introduction Most engineers learn best by solving problems and by learning from prior experience; this is often termed “experiential learning”. This workbook contains a set of experiential learning exercises covering dynamics and control of distillation. You will be presented a set of problems to solve, and you will use a combination of inquiry skills and simulation experiments in preparing your answers. The problems begin with a new perspective on topics that you have seen in other courses, and they conclude with you defining the final question and solving it. The simulation has been programmed in MATLAB. (The programming was performed by Mr. Francios Beaudreau, Dr. Athanasis Kassidas, Dr. Paul Nomikos, Ms. Laura Ronholm, and Dr. San Yip while they were teaching assistants.) The simulation is designed to be menu-driven, so that you can consider this close to an experimental system, without programming the process simulation. Guidance on the use of the program is provided in Appendix A. The distillation tower in this exercise is shown in Figure 1 and associated data is given in Table 1. This is a two-product, binary distillation tower, and all compositions are reported as fraction light key (L.K.). The model conforms to the following assumptions; these assumptions and the resulting models follow the development in the textbook (Marlin, 2000; Section 5.6). 1) 2) 3) 4) 5) 6) 7) 8) 9) 10) equal molal overflow equilibrium trays with constant relative volatility liquid inventory is determined by a weir equation (liquid always above the weir) accumulation in the vapor phase is negligible the analyzers can have dead time an updated analyzer measurement is available periodically (initialized at 2 minutes) and the analyzer controllers are executed when updated measurement is available the level in the distillate drum can be controlled by adjusting the reflux or distillate flow the level in the bottoms can be controlled by adjusting the bottoms flow or reboiled vapor (Level controllers in 7 and 8 above are initially configured as shown in Figure 1, are essentially continuous, and are initially provided with reasonable tuning.) Sufficient liquid is always available in the overhead and bottoms accumulators to provide liquid to the pumps The pressure is maintained constant by the controller shown in Figure 1.

The simulation is designed to accurately model responses for small and medium input changes. The simulation will not model extreme input changes, examples of which are given in the following. - start up and shutdown - loss of adequate liquid inventory in overhead or bottoms accumulators - excessive overhead vapor rate which could not be condensed with the available heat exchanger - internal liquid or vapor rates that exceed the hydraulic limits of the trays, leading to weeping, entrainment, downcomer filling, or other poor performance. Before beginning to consider the dynamic operation of any process, the engineer should thoroughly understand the process and equipment principles. Some questions to help you review and extend your knowledge are presented in the next section.

2

Table 1. Base base data for the binary distillation tower Variable Value Feed rate 8.00 kmole/min Feed composition 0.45 mole fraction L.K. Feed liquid 1.00 fraction Feed tray 10 counted from bottom Total trays 21 (+ reboiler) Relative volatility 2.20 Distillate composition 0.975 mole fraction L.K. Distillate product flow rate 3.625 kmole/min Reflux flow rate 7.487 kmole/min Bottoms product composition 0.015 mole fraction L.K. Bottoms product flow rate 4.375 kmole/min Vapor leaving the reboiler 11.11 kmole/min Reflux drum holdup 7.2 min (Volume/flow) Bottoms holdup after weir 5.3 min (Volume/flow)
* enter mole/min (not kmole/min) in the program

PC

LC

F Z q

R D
A

V

XD

LC

B
A
XB

Figure 1. Binary distillation tower.

3

2. 3. 4. 5. 6. 7. 8. 9.

10. 11. 12.

13.

3. Exercise 2. Open-loop dynamics This question is to be answered using programs provided in MATLAB to simulate a two-product distillation column. Directions for the use of the programs are provided in Appendix A. In this problem, you will evaluate the dynamic responses for the cases defined below and analyze the results based on your chemical engineering training. Later, you will use the results of your openloop tests in designing and tuning feedback digital PID controllers for this system.

4

4. Exercise 3: Closed-loop PID control This question is to be answered using programs provided in MATLAB to simulate a two-product distillation column; refer to Appendix A for directions on using the program. This assignment follows Distillation Exercise 2. Be sure that the parameters in submenu 1 are the same as used in the Distillation Exercise 2, and before running dynamic cases, calculate the steady-state conditions using submenu 1, item 13! You will investigate the multiloop feedback control of the two-product distillation column in this problem.

5

Before performing the following exercises, you must program the PID controllers for XD and XB; recall that the pressure controller is functioning properly, and the level controllers are defined and tuned already. Submenu 4 is provided for the composition controllers and will function if you use the variables defined for the tuning constants, initialization, etc. Directions and hints for programming are provided in this handout. Perform the following exercises and prepare a solution documenting programming, intermediate calculations, and discussion of results. Provide a copy of your subroutine with your assignment. a. Based on the open-loop dynamic experiments performed previously, calculate the tuning for the two single-loop composition controllers (XD by manipulating reflux and XB by manipulating reboil). Recall that the controllers are executed with a period of 2 minutes. Enter the tuning for both controllers via main submenu 4. (Remember to clear all step changes in main menu item 2.) b. Set the bottoms product composition controller in manual or "OFF", i.e., not in service so that the reboiler vapor flow is constant, and the distillate composition controller "ON". In two separate runs, determine the dynamic responses for 1) A set point change in XD of -0.01 mole fraction (from 0.975 to 0.965) and 2) A feed composition disturbance of -0.05 mole fraction (from 0.45 to 0.40 light key). Use the tuning determined in (a) with any fine tuning you deem necessary. c. With both composition controllers in automatic or "ON", determine the response of the system to a set point change in the XD controller of -0.01 mole fraction. Begin with the tuning determined in (b); you may further fine tune the controllers as needed. With both composition controllers in automatic or "ON", determine the response of the system to a feed composition change of -0.05 mole fraction. Begin with the tuning determined in (c); you may further fine tune the controllers as needed. Compare the control performances in XD achieved in response (b1) with (c) and in (b2) with (d). Is the single-loop or multiloop always better for XD? For each case, explain the differences in performance.

d.

e.

Hints for programming your controllers are given in the following, because you need to prepare before programming! • • • • • First, read the attached subroutine so that you understand the variables and options within the program. Second, review the digital forms of the PID controller. Third, prepare a flowchart of the code that you plan to write. Fourth, prepare hand calculations of the controller that can be used to check the program. Fifth, plan your solution, specifically, which variables are (i) communicated in or from the subroutine, (2) local and must be stored between subroutine executions, and (3) local and need not be stored

6

Sixth, include displays of intermediate results in your code so that you can confirm your excellent results (or find and correct a bug). Values of variables can be displayed in digital form in the MATLAB window using the display function. A sample of a statement is given in “disp(MVXBt) ;”, which prints values of the variable MVXBt (or values if the variable is a vector or matrix) in the MATLAB window. These can be removed when your results are satisfactory. Retain a copy of your subroutine: you will need it for the next exercise.

You should be sure that your code is calculating the correct values before you send values back to the distillation process simulation. This rule is especially true when working with the real process! i) ii) iii) iv) Appropriate initialization for the PID algorithm should be included; a variable (COMPCONT_INIT) is provided to designate the first time the calculations are executed. Anti-reset-windup protection must be provided. The control calculations should function when TI=0, even though TI appears in the denominator; prepare your program so that setting TI=0 turns off the integral mode. Remember that values of intermediate local variables, i.e., those not appearing in the function call or GLOBAL statements are not retained for subsequent executions. Thus, variables like the previous error or previous CV must be stored by you. Some extra GLOBAL variables STORE? are provided for this purpose. They can be used as scalars or vectors.

5. Exercise 4. Control Case Study In this assignment, you will modify the process design and/or control system. You may select one of the proposed exercises, or you may propose an exercise of your own design. The modified control design must be described, programmed, tuned (based on new process reaction curves, as needed), and the performance of the new design evaluated by dynamic simulation of the nonlinear process. Only one group can perform each exercise, and the instructor will make the allocation based on your completed project selection forms. The group members will present the group's results in a brief (10 minute) oral presentation. The group may prepare up to 5 power point slides for use as visual aids. (Students missing the class and not presenting an acceptable reason in writing will receive zero for the assignment.) The written report should be concise (not more than four pages of typed text, not including the cover, subroutine listing, presentation hardcopy, and plots) and provide the following, in addition to a statement of the study goals. a. b. c. d. An explanation of the algorithms used for control. Discussion of additional modelling required, e.g., process reaction curve experiments and calculations. A discussion of the control performance obtained. Compare with the previous results, as appropriate. A hard copy of the presentation visual aids.
7

e.

A summary of what you learned. How did the system perform, why, conclusions, unsolved mysteries. What principles have you reinforced and what generalizations can you support based on these results?

SOME HINTS 1) 2) Start early! (Have you heard this before?) You can arrange to see the instructor with a plan before beginning the detailed work. - The plan will not be graded. - Use outline or bullet format, hand-written in preparation for discussion with instructor. - Prepare a plan for changes in menu-entered data. - Prepare a plan documenting the new control equations and where they will be programmed, empirical modelling cases, and tuning procedures. - Explain what you will look for in your simulations, i.e., what are the expected results. - Refer to the programming hints in Section 4. Do NOT copy long sections of the text into your written report. Be concise! CANDIDATE DISTILLATION STUDIES For all distillation control studies, the base process is the same as for the previous studies. Dual composition control should be evaluated via simulation for three input changes: a) b) c) - 0.05 mole fraction step in feed light key (.45 to .40), +10% step change in feed rate (100 to 110), -1% step change in the bottoms composition controller set point (2% to 1%)

3)

Note that all simulations (1) to (3) should have the same controller tuning. A. Level Loop Pairing - In the original design, the distillate drum level is controlled by manipulating the distillate flow rate, and the distillate product composition is controlled by adjusting the reflux. In the modified design, the manipulated variables are switched, level is controlled by adjusting reflux flow rate and distillate composition is controlled by adjusting distillate flow rate. (Note that the controller pairings can be changed through main menu item 3.) Decoupling compensation - One type of feedforward control uses the measures of the manipulated variables to compensate for the process interaction. Decoupling achieves this goal while retaining the PID feedback controllers. In this exercise, a two-way decoupler is implemented and evaluated. See Section 21.5 on Explicit Decoupling in the textbook (Marlin, 2000). IMC predictive control - Two single-loop model predictive controllers are used in place the two PID composition controllers. These can be either IMC or Smith Predictor algorithms. Equipment holdup changes - The liquid holdups on the trays and in the drums could be changed by equipment redesign. The following situations will be evaluated. 1) 2) All holdups on trays and drums are increased by factors of 2, and 5. Only the two drum holdups are increased by 5. (with base case tray holdups)

B.

C.

D.

8

3) E.

The smallest practical holdup in the drums. (with base case tray holdups)

Feedforward control - Control performance can be improved when key disturbances are measured and compensated before the controlled variable is upset. Assume that the feed composition is measured and implement feedforward control. The simulation cases below replace those given above. 1) 2) 3) Feedback control of XD only, disturbance of -.05 in feed composition. Feedback and feedforward control of XD only, disturbance of -.05 in feed composition. Feedback and feedforward control of XB and XD, disturbance of -.05 in feed composition.

F.

Feedforward control - Control performance can be improved when key disturbances are measured and compensated before the controlled variable is upset. Assume that the feed flow rate is measured and implement feedforward control. The simulation cases below replace those given above. 1) 2) 3) Feedback control of XD only, disturbance of +10% in feed rate. Feedback and feedforward control of XD only, disturbance of +10% in feed rate. Feedback and feedforward control of XB and XD, disturbance of +10% in feed rate.

G.

Dynamic matrix control - Implement a 2x2 Dynamic matrix controller for composition feedback control. You can use results from the program TWOBYTWO in the design of the controller, i.e., calculating the KDMC matrix. You will have to program the DMC controller. Effects of operating conditions - You are to determine the effects of operationing conditions on distillation dynamics, controller tuning, and controller performance. One case you should start with is XD=0.999, XB=0.002, alpha=1.9, z=0.40, NT=50, and NF=20.

H.

I.

Alternative Analyzer Loop Pairing – You will change the analyzer controllers so that XD is controlled by adjusting the reboiler vaporization and XB is controlled by the reflux flow. Exercise defined by group - Any group may propose an exercise, which must be accepted by the instructor.

J.

6. Distillation References Distillation fundamentals
King, C., Separation Processes, 2nd Ed., McGraw-Hill, New York, 1980.

Distillation equipment design and operation
Chin, T., Guide to Distillation Pressure Control Methods, Hydrocarbon Proc., 145-153 (Oct. 1979).

9

Kister, H., Distillation Design, McGraw Hill, New York, 1992. Kister, H., Distillation Process Operations and Applications, McGraw Hill, New York, 1990. Lieberman, N. and E. Lieberman, A Working Guide to Process Equipment, McGraw Hill, New York, 1997. Ludwig, E., Applied Process Design for Chemical and Petrochemical Plants (2nd Edition), Gulf Publishing, Houston, 1979.

Distillation tray hydraulics
Barnicki, S. and J. Davis, Designing Sieve Trays – Part 1, Chemical Engineering, October 1989, 140 (1989). Barnicki, S. and J. Davis, Designing Sieve Trays – Part 2, Chemical Engineering, November 1989, 202 (1989). Lockett, M., Distillation Tray Fundamentals, Cambridge University Press, London, 1986.

Distillation dynamic simulation
Aspen, Aspen Dynamics™ and Aspen Custom Modeller™, Aspen Technology, 10 Canal Park, Cambridge, MA, 1999. Holland, C., Unsteady State Processes with Applications to Multicomponent Distillation, Prentice-Hall, Englewood Cliffs, 1966. Hyprotech, HYSYS.PLANT v2.0 Documentation, Dynamic Modelling Manual, Hyprotech Ltd., Calgary, 1998. Marlin, T., The Software Laboratory, Version 3.0, McMaster University, Hamilton, 1999. Tyreus, B., W. Luyben, and W. Schiesser, Stiffness in Distillation Models and the Use of an Implicit Integration Method to Reduce Computation Times, Ind. Eng. Chem. PDD, 14, 427-433 (1975).

Distillation control
Luyben, W. (Ed.), Practical Distillation Control, Van Nostrand Reinhold, New York, 1992. Shinskey, F., Distillation Control, McGraw Hill, New York, 1984.

Industrial Instrumentation
Andrew, W. and H. Williams, Applied Instrumentation in the Process Industries, Volume I, A Survey (2nd Ed.), Gulf Publishing, Houston, 1979. Andrew, W. and H. Williams, Applied Instrumentation in the Process Industries Volume II, Practical Guidelines (2nd Ed.), Gulf Publishing, Houston, 1980. Driskell, L., Control Valve Selection and Sizing, ISA Publishing, Research Triangle Park, 1983. Marlin, T., et. al., PC_Education WEB site, www.PC-Education.mcmaster.ca , 2006

10

Appendix A. User’s Manual For Distillation Simulation
The distillation simulation requires MATLAB version 7.0 or higher and all of the files stored in the McMaster JHE system under the course 3E04 in the "K:\" drive in subdirectory "Distil_2006". If you want to perform the study on your home computer using a student version of MATLAB, copy all files in "Distil_2006" to your home computer. The distillation simulation has been developed to be menu-driven for most parameters you will input during these exercises. (As you will see, later exercises will require some limited programming.) After you have started MATLAB and defined the correct MATLAB folder for the location of the m-files, you can start the program by typing distil and enter. The screen will clear and the main menu will be displayed as shown below.
************************************************************************* * SIMULATION OF A BINARY DISTILLATION COLUMN * * Version 3.0 * ************************************************************************* 1) Define Initial State 2) Define Step Changes 3) Define Loop Pairings 4) Composition Controllers 5) Level Controllers 6) Start Simulation 7) Plot a Previous Simulation 8) Load a Base Case 9) Save a Base Case 10) QUIT TO MATLAB PLEASE ENTER A SELECTION :

The first item allows you to modify the process design and solve for the initial steady-state operating conditions. You should enter the data given in the following copy of submenu 1.

11

************************************************************************* * Define Initial State * ************************************************************************* DEPENDENT VARIABLES FOR CURRENT INITIAL STEADY-STATE: Initial Reflux Rate, R0 (mol/min) : 7487.16 Initial Boilup Rate, VB0 (mol/min) : 11112.2 Initial Distillate Rate, D0 (mol/min): 3625 Initial Bottoms Rate, B0 (mol/min) : 4375 WHICH OF THE FOLLOWING INDEPENDENT VARIABLES WOULD YOU LIKE TO CHANGE? Feed properties Present Values 1) Initial Feed Rate, F0 (mol/min) 8000 2) Initial Feed Composition, Z0 (mol frac) 0.45 3) Initial Liquid Fraction, q0 1 Required separation 4) Initial Distillate Composition, XD0 (mol frac) 0.975 5) Initial Bottoms Composition, XB0 (mol frac) 0.015 Column properties 6) Number of Trays, NT 21 7) Feed Tray Location, NF 10 8) Tray Hydraulics Rating 9) Component Properties and Operating Conditions Inventories 10) Initial Distillate Drum Holdup, MD0 (mol) 80006 11) Initial Column Base Holdup, MB0 (mol) 23188 12) Display Initial Tray Compositions and McCabe-Thiele 13) Calculate New Steady-State 14) Quit to main menu PLEASE ENTER A SELECTION :

The relative volatility is entered using submenu item 9. Do not change any of the other data appearing in this menu. Note that the program has two options for the column sizing, which determines the column diameter and dimensions of the trays. A selection is presented to you when you select item 13, Calculate new steady state: “Maintain hydraulic rating unchanged? (y/n)”. 1. 2. No - Calculate the diameter and tray dimensions before calculating the steady-state tray compositions. This would be appropriate for an initial equipment design. Yes - Retain the original diameter and tray dimensions and calculate new initial steadystate compositions. This is appropriate for simulating various scenarios for an existing distillation tower.

In this exercise, you should select option 1, No, (calculating dimensions) for determining the initial steady state. If you ever run the steady-state program at other input values, you select execute option 2, Yes, because we are considering dynamics from one distillation tower with unchanged physical design but changing operating conditions. By the way, the user can request displays of the tray compositions and McCabe-Thiele Diagram by using menu item 12. These will help you recall the basic principles of distillation learned long ago during the Mass Transfer course. REMEMBER TO SOLVE FOR THE STEADY-STATE OPERATION USING SUBMENU ITEM 13 BEFORE LEAVING THIS SUBMENU!

12

After defining the proper steady-state operation, you can define the regulatory control system that maintains levels and pressure at their desired values using submenu 3. The program provides no options for pressure control but allows for different level control structures. For Exercises 2 and 3, you make no changes to the level control shown in the process sketch and given below.
************************************************************************* * Define Loop Pairings * ************************************************************************* WHICH OF THE FOLLOWING WOULD YOU LIKE TO CHANGE? Present Values 1) MV for overhead level: Distillate Rate 2) MV for reboiler level: Bottoms Rate 3) MV for distillate composition: Reflux Rate MV for bottoms composition: Boilup Rate 4) Quit to main menu PLEASE ENTER A SELECTION :

(3) (4) (1) (2)

You can define step changes to various variables using submenu 2. These changes will be introduced during the dynamic simulation; these changes will define process reaction curves (manipulated variables) or disturbances. For each variable, you define a step size and time for introduction of the step. All steps are introduced, so a zero size should be given for those variables that you want to be unchanged. A sample of the submenu with one step defined is given below; the boilup vapor rate is changed by +88 mol/min at a time of 6 minutes.
************************************************************************* * Define Time and Size of Step Changes * ************************************************************************* CURRENT INITIAL STEADY-STATE: Feed Rate, F0 (mol/min) Feed Composition, Z0 (mol/min) Feed Liquid Fraction, q0 (mol frac) Reflux Rate, R0 (mol/min) Boilup Rate, VB0 (mol/min) Distillate Rate, D0 (mol/min) Bottoms Rate, B0 (mol/min) : : : : : : : 8000 0.45 1 7487.16 11112.2 3625 4375

WHICH OF THE FOLLOWING PARAMETERS WOULD YOU LIKE TO CHANGE? Size of step change in Present Values 1) Feed Rate, OF1 (mol/min) 0 2) Feed Composition, OZ1 (mol frac) 0 3) Feed Liquid Fraction, Oq1 (mol frac) 0 4) Reflux Rate, OR1 (mol/min) 0 5) Boilup Rate, OV1 (mol/min) 88 6) Distillate Rate, OD1 (mol/min) 0 7) Bottoms Rate, OB1 (mol/min) 0 Time of step change in 8) Feed Rate, FSTEP1 (min) 6 9) Feed Composition, ZSTEP1 (min) 6 10) Feed Liquid Fraction, qSTEP1 (min) 6 11) Reflux Rate, RSTEP1 (min) 6 12) Vapour Boilup Rate, VSTEP1 (min) 6 13) Distillate Rate, DSTEP1 (min) 6 14) Bottoms Rate, BSTEP1 (min) 6 15) Quit to main menu PLEASE ENTER A SELECTION :

13

The simulation can be executed by selecting the simulation submenu. The first two entries are the time step used in solving the process simulation and the time between product composition analyses, which is also the time step for the composition plots and controllers. For this exercise, do not change the values of entries 1 and 2. The total time is initialized, but you can change this value, if necessary.
************************************************************************* * Dynamic Simulation Menu * ************************************************************************* WHICH OF THE FOLLOWING PARAMETERS WOULD YOU LIKE TO CHANGE? Present Values 1) Simulation time step, DELTA (min) 0.01 2) Analyser sampling time, WRSTEP (min) 2 3) Total simulation time, TSTOP (min) 60 4) Start simulation 5) Quit to main menu PLEASE ENTER A SELECTION :

When you select submenu item 4, you are asked to provide a case name (without extension), which is used as the file name for saving the results for later retrieval; the extension will be “.MAT”. You should provide a unique name, because the program will overwrite (without a warning) the contents of any existing file with the same name in the default folder that exists in the active MATLAB path directory. Therefore, name each case that you want to save with a unique name, such as “Marauder_Case_2a”. When the simulation is being executed, numerical values are displayed on the screen to give you an update on the case. This enables you to recognize and stop any case that is clearly wrong due to incorrect data input. The variables displayed are summarized below.
TIME with XDM XBM R D V B = = = = = = XDM XBM V R D B

fraction light key in distillate as measured by sensor fraction light key in bottoms as measured by sensor reflux flow rate distillate flow rate vapor flow rate from reboiler bottoms liquid product flow rate

At the completion of each simulation case, the results are plotted automatically and also stored in the file named at the beginning of the case. A sample of the plots is given in Figure 2. You can repeat the plot of any saved simulation by selecting main menu item 7 and entering the name of the appropriate stored case. The plot provides the following three graphs: - the feed variables (flow, composition, and vaporization) - the product compositions (XD and XB) and the product flows (D and B) - the product compositions (XD and XB) and the “recycle flows” (V and R) When the plot is displayed, you can copy it and paste it in a MS WORD document where you can add descriptions of the cases. The word processor document can be printed so that you can perform the process reaction curve calculations. You can save the word processor and the data MATLAB case files as described previously for each case. This will allow you to recover from

14

computer restarts, printing errors, check for errors (unlikely that you will make any!), and transport the results to your home computer. Better safe than sorry.

8001

1.5 1 Z (mol frac) 0 20 40 60 Time (min) 80 100 0.5 0 -0.5 -1 0

8000.5 F (mol/min)

8000 7999.5

7999

20

40 60 Time (min)

80

100

2 1.5 q (mol ratio) 1 0.5

0

0

20

40 60 Time (min)

80

100

0.98 0.975 XD (mol frac) 0.97 0.965 0.96 0.955

IAE = 0.92963 ISE = 0.011913

0.016 0.015 XB (mol frac) 0.014 0.013 0.012 0.011

IAE = 0.37213 ISE = 0.0015946

0

20

40 60 Time (min)

80

100

0.01

0

20

40 60 Time (min)

80

100

3740 3720 D (mol/min) B (mol/min) 0 20 40 60 Time (min) 80 100 3700 3680 3660 3640 3620

4380 4360 4340 4320 4300 4280 4260 0 20 40 60 Time (min) 80 100

0.98 0.975 XD (mol frac) 0.97 0.965 0.96 0.955

IAE = 0.92963 ISE = 0.011913

0.016 0.015 XB (mol frac) 0.014 0.013 0.012 0.011

IAE = 0.37213 ISE = 0.0015946

0

20

40 60 Time (min)

80

100

0.01

0
4

20

40 60 Time (min)

80

100

7488.5 7488 R (mol/min) 7487.5 7487 7486.5 7486 V (mol/min)

1.122 1.12 1.118 1.116 1.114 1.112 0 20 40 60 Time (min) 80 100 1.11

x 10

0

20

40 60 Time (min)

80

100

Figure 2. Sample plots of results for a 88 mol/min step in reboiled vapor.

15

Appendix B. MATLAB Controller Subroutine
This is the subroutine stored in file compcont.m. You should store the original (compcont.bak) and modify the m-file. Only the file with the extension “.m” will be executed.
function [MVXDt,MVXBt] = compcont(Kc,TI,TD,dT,MVXD,MVXDmin,MVXDmax,MVXB, ... MVXBmin,MVXBmax,XD,XB,XDSP,XBSP,COMPCONT_INIT,R,VB,D,B,F,Z,q); % % % ******************************************************************** % File: COMPCONT.M % COPYRIGHT C BOUDREAU & MARLIN, 1997 % VERSION: 2.0 % DATE: NOVEMBER 1997 % % ******************************************************************** % Usage: % This function m-file is a subroutine which can be called % using the following statement. % % function [MVXDt,MVXBt] = compcont(Kc,TI,TD,dT,MVXD,MVXDmin,MVXDmax,MVXB, ... % MVXBmin,MVXBmax,XD,XB,XDSP,XBSP,COMPCONT_INIT,R,VB,D,B); % % Decription: % This function returns the values of the manipulated % variables used to control the distillate and bottoms % compositions. % % % ******************************************************************** % Inputs: % These variables and parameters are available for use % in the controller calculation. The values are provided % from the menu entries and the plant measurements. These % values should NOT be changed as part of the controller % calculations. % % Kc(i), % TI(i), % TD(i) are the PID parameters for CVi (i=1,2). % % i=1 for XD and i=2 for XB % % dT is the execution period of the composition controllers. % % MVXD is the current value of the manipulated variable used to % control the distillate composition, i.e. the value implemented % at time t-dT (where "t" stands for present time) % % MVXB is the current value of the manipulated variable used to % control the bottoms composition, i.e. the value implemented % at time t-dT (where "t" stands for present time). % % MVXDmin and MVXDmax are the lower and upper bounds for the manipulated % variable used to control the distillate composition. % % MVXBmin and MVXBmax are the lower and upper bounds for the manipulated % variable used to control the bottoms composition. % % NOTE: These values are applied to the controller % outputs. The plant variables to which they % apply depends on the loop pairing decisions % entered via the menu. % % XD and XB are the current values of the distillate and % bottoms composition.

16

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

XDSP and XBSP

are the current set points of the distillate and bottoms composition.

COMPCONT_INIT is a flag that indicates if this function is being called for the first time in the simulation, in which case the controllers have to be initialized. The value reported to this function is given below, and you may use this information to decide when to initialize you controller calculations. COMPCONT_INIT = 1, = 0, I if is this is the first call otherwise.

This is an array of dimension 2, i.e., I(2), in which you can store the results of initialization calculations, if necessary, and have them stored for all future calculations. NOTE: The convention is: I(1) for controller 1, I(2) for controller 2. NOTE: This is an output from the first execution and an input thereafter

R, VB, D, B are the current values of the reflux rate, vapour boilup rate, distillate rate, and bottoms rate. F, Z, q are the current values of feed properties: feed rate, feed composition, liquid fraction ********************************************************************* Output: These are the variables and parameters which can be changed through the controller calculations and will be transmitted to the plant. MVXDt and MVXBt are the calculated values of the manipulated variables used to control the distillate and bottoms compositions; these values will be implemented at the current time.

********************************************************************** Calculations: Some suggestions and hints are given below. 1. The convention is that the integral mode of a controller is turned off by setting the integral time constant to zero in the menu for editing controllers. If at some point you will want to turn off the integral mode of a composition controller this way, make sure that your code treats the case TI=0 as a special case; if not, a division by zero will occur (recall: Integral Mode = (Error integral)/TI ). The controller can be turned off two ways via the menu. i) select "off" in the menu. ii) give the controller gain a value of zero. Any special calculations for initialization must be included. When a controller is "OFF", this subroutine is executed but the values of MVt are ignored. When the controller is "ON", this subroutine is executed and the values of MVt are implemented.

2. 3. 4.

*********************************************************************** ------------------------------------Do not remove this 'global' statement. This ensures that the value of variables I, STORE1, ..., STORE10 are retained for subsequent controller executions

global I STORE1 STORE2 STORE3 STORE4 STORE5 STORE6 STORE7 STORE8 STORE9 STORE10 % % ------------------------------------

17

% Comment ththe following line when programming % the composition controllers MVXDt = MVXD; MVXBt=MVXB; % -----------------------------------% ****************************************************************** % *************** CONTROLLER CALCULATIONS GO HERE **************** % % % % % % INITIALIZATION ---------------------------END INITIALIZATION -----------------------------------------------------------------UPDATE RECENT PAST VALUES AT EACH EXECUTION END UPDATE OF PAST VALUES CONTROLLER CALCULATIONS -----------------------------------

% END OF CONTROLLER CALCULATIONS % ------------------------------------% % ********************** CONTROLLER CALCULATIONS END ******************* ************************************************************************

return;

18