Chemical Engineering Department Master of Science Course Advanced Process Control Course Description This course is designed to improve the ability of master candidates' chemical students to design and analysis of more advanced complex control systems in order to achieve a high degree of automatic control system. Emphasis will be on generating alternative control configuration. Students will learn process control using digital computer and will use computer software such as MATLab. Objectives At the end of this course, students are expected to: Be able to apply the theory of the advanced process control system to engineering applications, especially the chemical engineering processes involving the digital controller. Be able to derive the process models using conservation equations such as mass, energy and momentum balance for different models such as lumped and distributed. Be able to use computer in solving control problems. 1. Course Detail Introduction to Control Engineering System Modeling Mathematical Models Time Domain Analysis Classical Design in The s-Plane Classical Design in The Frequency Domain 1 Analysis of State Space Models The State-Space Approach Matrix Transfer function Eigenvalues and Eigenvectors Multivariable Control System Multiple Loops Control System Controllability and Observability Interaction analysis Relative Gain Array Decoupling Method Advanced Control System Ratio controller Override controller Feedforward controller Cascade controller Intelligent Control System Fuzzy Control System Neural Network Control System Model Predictive Control system Digital Control System Design The z-Transform Digital Control Systems References Roland S. Burns, "Advanced Control Engineering", 2001 Coughanowr, D. R., "Process systems analysis and control", McGraw-Hill, 1991. Wayne, B., "Process Dynamics", Prentice-Hall, 1998. systems analysis and control", 1997. 2 Introduction of Control Engineering Why Advanced Process Control Multivariable System Performance Cost Constraints Environmental Constraints Computer and modern control theory Modern Control Theory These theories are dealing with the following equations: Linear, variable coefficient differential equations. Nonlinear differential equations. Differential –difference equations. Partial differential and integral equations. Types of the Modern Control Theory Optimal Control Theory Process Identification State Estimation Classical Control Theory (SISO) The development of a control strategy consists of formulating or identifying the following. 1. Control objective(s). 2. Input variables—classify these as (a) manipulated or (b) disturbance variables; inputs may change continuously, or at discrete intervals of time. 3. Output variables—classify these as (a) measured or (b) unmeasured variables; measurements may be made continuously or at discrete intervals of time. 4. Constraints—classify these as (a) hard or (b) soft. 5. Operating characteristics—classify these as (a) continuous, (b) batch, or (c) semicontinuous (or semibatch). 6. Safety, environmental, and economic considerations. 7. Control structure—the controllers can be feedback or feed forward in nature. Here we discuss each of the steps in formulating a control problem in more detail. 1. The first step of developing a control strategy is to formulate the control objectives. Chemical-process operating unit often consists of several unit operations. The control of an operating unit is generally reduced to considering the control of each unit operation separately. Even so, each unit operation may have multiple, sometimes conflicting objectives, so the development of control objectives is not a trivial problem. 3 Figure.1 Conceptual process input/output block diagram. 2. Input variables can be classified as manipulated or disturbance variables. A manipulated input is one that can be adjusted by the control system (or process operator). A disturbance input is a variable that affects the process outputs but that cannot be adjusted by the control system. Inputs may change continuously or at discrete intervals of time. 3. Output variables can be classified as measured or unmeasured variables. Measurements may be made continuously or at discrete intervals of time. 4. Any process has certain operating constraints, which are classified as hard or soft. An example of a hard constraint is a minimum or maximum flow rate—a valve operates between the extremes of fully closed or fully open. An example of a soft constraint is a product composition—it may be desirable to specify a composition between certain values to sell a product, but it is possible to violate this specification without posing a safety or environmental hazard. 5. Operating characteristics are usually classified as continuous, batch, or semicontinuous (semibatch). Continuous processes operate for long periods of time under relatively constant operating conditions before being ―shut down‖ for cleaning, catalyst regeneration, and so forth. For example, some processes in the oil-refining industry operate for 18 months between shutdowns. Batch processes are dynamic in nature—that is, they generally operate for a short period of time and the operating conditions may vary quite a bit during that period of time. Example batch processes include beer or wine fermentation, as well as many specialty chemical processes. For a batch reactor, an initial charge is made to the reactor, and conditions (temperature, pressure) are varied to produce a desired product at the end of the batch time. A typical semibatch process may have an initial charge to the reactor, but feed components may be added to the reactor during the course of the batch run. Another 4 important consideration is the dominant timescale of a process. For continuous processes this is very often related to the residence time of the vessel. 6. Safety, environmental, and economic considerations are all very important. In a sense, economics is the ultimate driving force—an unsafe or environmentally hazardous process will ultimately cost more to operate, through fines paid, insurance costs, and so forth. In many industries (petroleum refining, for example), it is important to minimize energy costs while producing products that meet certain specifications. Better process automation and control allows processes to operate closer to ―optimum‖ conditions and to produce products where variability specifications are satisfied. The concept of ―fail-safe‖ is always important in the selection of instrumentation. For example, a control valve needs an energy source to move the valve stem and change the flow; most often this is a pneumatic signal (usually 3–15 psig). If the signal is lost, then the valve stem will go to the 3-psig limit. If the valve is air-to-open, then the loss of instrument air will cause the valve to close; this is known as a fail-closed valve. If, on the other hand, a valve is air to- close, when instrument air is lost the valve will go to its fully open state; this is known as a fail-open valve. 7. The two standard control types are feed forward and feedback. A feed-forward controller measures the disturbance variable and sends this value to a controller, which adjusts the manipulated variable. A feedback control system measures the output variable, compares that value to the desired output value, and uses this information to adjust the manipulated variable. For the first part of this textbook, we emphasize feedback control of single-input (manipulated) and single-output (measured) systems. Determining the feedback control structure for these systems consists of deciding which manipulated variable will be adjusted to control which measured variable. The desired value of the measured process output is called the setpoint. Feedback Control System The control and instrumentation diagram for a feedback control strategy for scenario 1 is shown in Figure (2). Notice that the level transmitter (LT) sends the measured height of liquid in the tank (hm) to the level controller (LC). The LC compares the measured level with the desired level (hsp, the height setpoint) and sends a pressure signal (Pv) to the valve. This valve top pressure moves the valve stem up and down, changing the flow rate through the valve (F1). If the controller is designed properly, the flow rate changes to bring the tank height close to the desired setpoint. In this process and instrumentation diagram we use dashed lines to indicate signals between different pieces of instrumentation. A simplified block diagram representing this system is shown in Figure (3). Each signal and device (or process) is shown on the block diagram. We use a slightly different form for block diagrams when we use transfer function notation for control system analysis. Note that each block represents a dynamic element. We expect that the valve and LT dynamics will be much faster than the process dynamics. We also see clearly from the block diagram why this is known as a feedback control ―loop.‖ The controller ―decides‖ on the valve position, which affects the inlet flow rate (the manipulated input), which affects the level; the outlet flow rate (the disturbance input) also affects the level. The level is measured, and that value is fed back to the controller [which compares the measured level with the desired level (setpoint)]. Notice that the control valve should be 5 specified as fail-closed or air-to-open, so that the tank will not overflow on loss of instrument air or other valve failure. Figure 2 Feedback control strategy 1. The level is measured and the inlet flow rate (valve position) is manipulated. Figure 3 Feedback control schematic (block diagram) for scenario 1. F1 is manipulated and F2 is a disturbance. Scenario 2 Process 1 regulates flow rate F1. This could happen, for example, if process 1 is producing a chemical compound that must be processed by process 2. Perhaps process 1 is set to produce F1 at a certain rate. F1 is then considered ―wild‖ (a disturbance) by the tank process. In this case we would adjust F2 to maintain the tank height. Notice that the control valve should be specified as fail-open or air-to-close, so that the tank will not overflow on loss of instrument air or other valve failure. The process and instrumentation diagram for this scenario is shown in Figure (4). The only difference between this and the previous instrumentation diagram (Figure 1–3) is that F2 rather than F1 is manipulated. The simplified block diagram shown in Figure (5)differs from the previous case (Figure 3) only because F2 rather than F1 is manipulated. F1 is a disturbance input. 6 Figure 4 Feedback control strategy 2. Outlet flow rate is manipulated. Figure 5 Feedback control schematic (block diagram) for scenario 2. F2 is manipulated and F1 is a disturbance. Instrumentation The example level-control problem had three critical pieces of instrumentation: a sensor (measurement device), actuator (manipulated input device), and controller. The sensor measured the tank level, the actuator changed the flow rate, and the controller determined how much to vary the actuator, based on the sensor signal. There are many common sensors used for chemical processes. These include temperature, level, pressure, flow, composition, and pH. The most common manipulated input is the valve actuator signal (usually pneumatic). Each device in a control loop must supply or receive a signal from another device. When these signals are continuous, such as electrical current or voltage, we use the term analog. If the signals are communicated at discrete intervals of time, we use the term digital. Analog Analog or continuous signals provided the foundation for control theory and design and analysis. A common measurement device might supply either a 4- to 20-mA or 0- to 5-V signal as a function of time. Pneumatic analog controllers (developed primarily in the 1930s, but used in some plants today) would use instrument air, as well as a bellows-andsprings arrangement to ―calculate‖ a controller output based on an input from a measurement device (typically supplied as a 3- to 15-psig pneumatic signal). The controller output of 3–15 psig would be sent to an actuator, typically a control valve where the pneumatic signal would move the valve stem. For large valves, the 3- to 15-psig signal might be ―amplified‖ to supply enough pressure to move the valve stem. Electronic analog controllers typically receive a 4- to 20-mA or 0- to 5-V signal from a measurement device, and use an electronic circuit to determine the controller output, which is usually a 4- to 20-mA or 0- to 5-V signal. Again, the 7 controller output is often sent to a control valve that may require a 3- to 15-psig signal for valve stem actuation. In this case the 4- to 20-mA current signal is converted to the 3- to 15psig signal using an I/P (current-to-pneumatic) converter. Digital Many devices and controllers are now based on digital communication technology. A sensor may send a digital signal to a controller, which then does a discrete computation and sends a digital output to the actuator. Very often, the actuator is a valve, so there is usually a D/A (digital-to-electronic analog) converter involved. Indeed, if the valve stem is moved by a pneumatic actuator rather than electronic, then an I/P converter may also be used. In the past few decades, digital control-system design techniques that explicitly account for the discrete (rather than continuous) nature of the control computations have been developed. If small sample times are used, the tuning and performance of the digital controllers is nearly equal to that of analog controllers. Figure 6 Room temperature control system Figure 7 Block diagram of Room temperature control system 8 Mathematical Model Objectaves 1. 2. 3. 4. Improve understanding of the process Train Plant operating personnel Develop control strategy for new plant Optimize process operating conditions Type of Models 1. 2. Theoretical model Developed using the principles of chemistry, physic and biology. applicable over wide ranges of conditions expensive and time consuming some model parameters such as reaction rate coefficients physical properties, or heat transfer coefficients are unknown Empirical models obtained fitting experimental data range of the data is typically quite small compared to the whole range of process operating conditions do not extrapolate well 9 3. Semi-empirical models combination of 1 and 2 overcome the previously mentioned limitations to many extents widely used in industry A Systematic Approach for Developing Dynamic Models 1. State the modeling objectives and the end use of the model. They determine the required levels of model detail and model accuracy. 2. Draw a schematic diagram of the process and label all process variables. 3. List all of the assumptions that are involved in developing the model. Try for parsimony; the model should be no more complicated than necessary to meet the modeling objectives. 4. Determine whether spatial variations of process variables are important. If so, a partial differential equation model will be required. 5. Write appropriate conservation equations (mass, component, energy, and so forth). 6. Introduce equilibrium relations and other algebraic equations (from thermodynamics, transport phenomena, chemical kinetics, equipment geometry, etc.). 7. Perform a degrees of freedom analysis (Section 2.3) to ensure that the model equations can be solved. 8. Simplify the model. It is often possible to arrange the equations so that the dependent variables (outputs) appear on the left side and the independent variables (inputs) appear on the right side. This model form is convenient for computer simulation and subsequent analysis. 9. Classify inputs as disturbance variables or as manipulated variables. Degrees of Freedom Analysis 1. List all quantities in the model that are known constants (or parameters that can be specified) on the basis of equipment dimensions, known physical properties, etc. 2. Determine the number of equations NE and the number of process variables, NV . Note that time t is not considered to be a process variable because it is neither a process input nor a process output. 3. Calculate the number of degrees of freedom, NF = NV - NE . 4. Identify the NE output variables that will be obtained by solving the process model. 5. Identify the NF input variables that must be specified as either disturbance variables or manipulated variables, in order to utilize the NF degrees of freedom. 11 Concept of the system Figure 8 Concept of the system Modeling and Simulation procedure Translating the description of a physical system into an appropriate mathematical form. •Selecting a suitable computational technique. •Implementing the computational technique in the form of a computer program. General Process Unit Analysis 1.Define system variables. 2.Write simulation equations. 3.Check degrees of freedom. 4.Choose design variables. 5.Choose appropriate math solver. APPLICATIONS OF DYNAMIC SIMULATION Dynamic simulation is useful throughout the entire lifetime of a plant: from conception to decommissioning. Plant design: a) A priori assessment of intrinsic operability and controllability of a plant - especially for highly integrated plants. b) Design and testing of regulatory control systems - selection of control structures, control algorithms, and initial tuning of loops. c) Design and testing of operating procedures - startup, shut-down, feed stock changeover, etc. d) Hazard/safety studies - answer important questions raised by HAZOP study. e) Design and testing of protective and relief devices - study plant behaviour and performance of protective system during major deviations from steady-state (need good models!) f) Environmental studies - predict emissions generated during plant upsets/failures. g) Analysis of intrinsically dynamic processes: batch/semi-continuous processes, periodic processes (e.g., pressure swing adsorption) 11 APPLICATIONS OF DYNAMIC SIMULATION Plant operation: typically a dynamic simulation is linked to the plant's real time control and monitoring software: (a) computer based operator training: Dynamic simulation runs in real time and mimics behaviour of real plant. • Operator interfaces to control system (not simulator) — more realistic. • Instructor monitors and creates scenarios (e.g.,disturbances, failures) (b) Validation of operating and safety procedures — test control software by dynamic simulation before implementing on the real plant! (c) On-line operator decision support tool (simulation runs in parallel with real plant): Update current state (initial condition) directly from measurements. • Dynamic predictor — run simulation faster than real time to predict hazards or problems (so that early corrective or preventative action can be taken). • Experimental tool — predict consequences of proposed actions. APPLICATIONS OF THE MODEL steady-state simulation: steady-state is just one initial condition for a dynamic model: always get steady-state model for free in dynamic study! optimize plant for different feed concentrations and loads identify which equipment must be revamped to increase capacity plant must be regulated at new optimal operating points - use dynamic model for identification and controllability studies: sensitivity studies to identify necessary process measurements sensitivity studies to define appropriate control structure (matching of sensors to control elements) and tuning of control parameters validation of control system by predicting plant response to a variety of load and setpoint changes. PRELUDE TO MODELLING Because of this fundamental nature of models, before and during any modeling activity it is important to clarify and document the following information: (a) Identify the system for which a model is required 12 Figure (9) system Identify: • Boundaries (function of system) - a system is defined by its boundary • Constraints • Quantities describing system behaviour: inputs, states, outputs • Assume: inputs ≠ ƒ(outputs) Notes: • We are developing a model for the system. Everything else is the environment. • Inputs define the influence of the environment on the system. • While in real life the inputs will be further subdivided into: (a) Controls — those inputs that can be manipulated in order to control the system behaviour. (b) Disturbances — those inputs over which we have no control. . . . from the point of view of modelling: we must define the time variation of all the inputs in order to pose a fully determined simulation problem. • Inputs ≠ ƒ(outputs): — More precisely: we can sufficiently decouple the influence of the outputs on the inputs (feedback via the environment) for the purposes of the current exercise. — Pragmatic view: can only model so much at a given level of detail. (b) What is the intended application of the model? What questions will be asked about the system? Begin to identify: • What phenomena are of interest? • What quantities describe the system behaviour? • How detailed should the model be? • What assumptions can be made? (c) what data concerning the system is available? or can be obtained . . . imposes constraints on the phenomena that can be modeled and the accuracy of the simulation results. Typically relates to parameters and empirical correlations: • What is available? • In what range of process conditions are the predictions valid? • How much uncertainty is there in the predictions? Examples: non-equilibrium distillation tray models, reaction kinetics for novel synthesis. 13 STEP 2 — MODELLING THE COMPONENTS Each component model is itself a system (recursion): (a) Identify the boundaries. • The model may represent a physical artifact — e.g., a plant section, a unit operation, a vessel, or a section of a vessel. • The model may represent some phenomenological abstraction — e.g., the set of equations defining a mixture enthalpy, or a set of reaction rate expressions. (b) Identify the connections of the model to its environment - This will enable us to connect the model to others in a larger structure. Connections will typically represent either: (i) Fluxes of extensive properties, such as: • A diffusive flux - e.g., heat transfer through a vessel wall • A convective flux - e.g., a pipe connecting two vessels (ignoring the holdup of material in the pipe) Note fluxes will have a direction implied. (ii) Information transfer - e.g., pressure and/or voltage signals for control instruments, or intensive properties (e.g., temperature, pressure) to determine driving forces for fluxes structures are defined by establishing equivalence (merging) between the connection of one component model and the connection of another component model (obviously, the two connections must be compatible - e.g., must represent a convective flux) (c) Define the internal behaviour of the component model - what describes the "state" of this system, and how is it related to both the inputs and the outputs. INTERNAL BEHAVIOUR Ultimately internal behaviour is represented by a set of: VARIABLES - e.g. Inputs, States, Outputs ...and these variables are related by a set of: EQUATIONS - e.g. Mass Balances, Energy Balances, Physical Constraints, Thermodynamic Models etc. However, there are several options as to how these two sets can be defined: (a) The model is primitive — e.g., just define a set of variables and a set of equations (b) Decompose the model further — e.g., define a set components and their connections. The set of variables is then the union of the sets of variables in the sub models, and similarly the set of equations is the union of the sets of equations in the sub models and the equations implied by the connections (c) a hybrid of (a) and (b) — e.g., both variables and sub models. DERIVING THE EQUATIONS Once a suitable decomposition has been established, it is necessary to develop all the primitive models - e.g., derive a set of variables and equations that describe the dynamic behaviour of that section of the overall system. Basically, we must utilize our knowledge of chemical engineering science at this point control volume analysis, mass conservation, energy conservation, etc. Experience with teaching this material suggests that it is worthwhile to review the principles frequently used in dynamic modeling - but this discussion is by no means exhaustive (nor is my experience!). The approach is relatively systematic and will allow derivation of component models for a system that are consistent. The following information should be developed at this stage: 1. Define the control volume(s) for balance equations (again. . .identify the boundaries) 2. List the assumptions employed — under what conditions is the model valid? Example: phase transitions 14 3. List the set of variables required to describe the system — e.g., symbol, verbal description, units (always try to use a consistent set of units). 4. Derive the set of equations — always check that the units of each term in an equation are consistent. 5. Perform a degree of freedom analysis: (a) Identify the natural set of input variables to the system. (b) Given values for this subset of the variables it should be possible to calculate values for all the other variables — e.g. it is necessary that the number of equations equal the number of remaining unknown variables (ignore time derivatives of variables in this analysis). We will be applying one or more conservation principles to a macroscopic control volume of definite size and shape containing a fluid. Further, we will assume that the contents of the control volume are well mixed, so intensive properties are uniform throughout the control volume and do not vary with spatial position (or with another independent variables such as polymer chain length). => One or more ordinary differential equations (ODEs) with time as the independent variable. These ODEs will be augmented with algebraic equations (e.g., equations not involving time derivatives) that relate variables or model phenomena that take place on a much faster time scale than that of interest, for example: • A pseudo steady-state assumption • Phase equilibrium models Conservation Laws Theoretical models of chemical processes are based on conservation laws. Conservation of Mass Conservation of Component i 15 Conservation of Energy The general law of energy conservation is also called the First Law of Thermodynamics. It can be expressed as: . . (1) The total energy of a thermodynamic system, Utot , is the sum of its internal energy, kinetic energy, and potential energy:Examples of Models . For the processes and examples considered in this case, it is appropriate to make two assumptions: . 1. Changes in potential energy and kinetic energy can be neglected because they are small in comparison with changes in internal energy. 2. The net rate of work can be neglected because it is small compared to the rates of heat transfer and convection. For these reasonable assumptions, the energy balance in Eq. 1 can be written as . . . . (2) Uint:the internal energy of the system H: enthalpy per unit mass W:mass flow rate Q: rate of heat transfer to the system Δ: denotes the difference between outlet and inlet conditions of the flowing streams; therefore - Δ(WH): rate of enthalpy of the inlet stream(s) - the enthalpy of the outlet stream(s) 16 The analogous equation for molar quantities is, …..(3) where H is the enthalpy per mole and is the molar flow rate. In order to derive dynamic models of processes from the general energy balances in Eqs. 2 and 3, expressions for Uint and H or H are required, which can be derived from thermodynamics. MASS CONSERVATION — EXAMPLE Buffer tank open to the atmosphere: Figure(10): Liquid level system Control volume: liquid in tank — e.g., boundary is not rigid, so size and shape of control volume will change as the level rises and sinks Assumptions: • isothermal system => no need for energy balance • single chemical species => fluid density constant • inlet flow defined as an input (or by an upstream model) — e.g., FIN (t) known. • vessel has uniform cross sectional area • model valid for interval 0 ≤h ≤hmax Variables (what quantities are we interested in?): M* mass of fluid in vessel [kg] density of fluid in vessel [kg m-3] V: volume of fluid in vessel [m3] FIN volumetric flow of inlet stream [m3s-1] FOUT volumetric flow of outlet stream [m3s-1] P0 atmospheric pressure [Nm-2] 17 P1 pressure at bottom of vessel [Nm-2] A cross sectional area of vessel [m2] h* liquid level in vessel [m] Note (*): in steady-state models we do not usually worry about quantities describing the "state" of the control volume — we are only concerned with the quantities crossing the boundary and the fact that they must balance at steady-state. This is a major reason why dynamic models are more complex — we now have to relate how this state changes to the quantities crossing the boundary. Clearly, the whole point of doing dynamic simulation is to determine how this state changes with time. Equations: Mass Conservation Relate volume and mass Relate volume and liquid level (constant cross sectional area) Hydrostatic pressure g: gravitational acceleration (9.81ms-2) Flow pressure relationship — flow out driven by hydrostatic pressure in vessel k: loss coefficient (value known) Degree of freedom analysis: Total number of quantities = 11 Time invariant quantities (model parameters): A, ρk,g (= 4) Natural input set: FIN (t), P0 (t) (= 2) Note: these functions are defined by the "environment" which could be either other models, or the engineer. Remaining variables: M, V, h, P1, FOUT (= 5) Equations = 5 => degrees of freedom are satisfied given specification of input set above. 18 Note: due to the assumptions made above, equation (2) could be substituted into (1) to eliminate M - leading to a "volume balance." This is an error that is frequently made - volume is not a conserved quantity (e.g., consider a non isothermal and/or multicomponent system) whereas mass is. SPECIES BALANCES Unlike mass, chemical species are not conserved: if a reaction takes place inside a control volume, reactants will be consumed and products generated. species balance can be written for each chemical species in the system (note we are now using moles rather than mass): Further, we can sum these NC(NC will be used to denote the number of chemical species in a system) species balances to derive a total mole balance. Therefore, we can derive three different balance equations: (a) NC species balances (b) a total mole balance (c) a mass balance . . . clearly these are not independent — the total number of moles and the mass in the system can be related algebraically to the number of moles of each species, e.g.: 19 In general, it is best to derive a model in terms of the minimal number of independent species balances (usually NC) and derive other quantities via algebraic equations. The rationale behind this statement should become clearer when we discuss numerical solution of dynamic simulation problems. EX. Consider the same tank as before, but the following liquid phase first order irreversible isomerization reaction takes place (i.e. isothermal CSTR): Species A and B are present in dilute solution (i.e. NC = 3; A, B, and the solvent). Assumptions: • Vessel contents well mixed • Isothermal, species A and B present in dilute solution => Fluid density constant (e.g., neglect density changes due to presence of A and B) • Model valid for interval 0 < h ≤ hMAX (note difference) • Otherwise, same as above Variables: V volume of fluid in vessel [m3] ρ density of fluid in vessel [kg m-3] 21 FIN volumetric flow of inlet stream [m3 s-1] FOUT volumetric flow of outlet stream [m3 s-1] P0 atmospheric pressure [N m-2] P1 pressure at bottom of vessel [N m-2] A cross sectional area of vessel [m2] h liquid level in vessel [m] CA concentration of species A in vessel [mol m-3] CB concentration of species B in vessel [mol m-3] CA,IN concentration of species A in inlet stream [mol m-3] CB,IN concentration of species B in inlet stream [mol m-3] g gravitational acceleration [m s-2] k loss coefficient kR reaction rate constant [s-1] r reaction rate [mol m-3 s-1] Equations: Mass Conservation Species balances for A and B Notes: • Use of volume in mass balance is only valid for the assumptions above • Concentrations in outlet stream equal to bulk concentration because vessel contents well mixed • We have derived NC (=3) mass and species balances — This is sufficient to define the state of the system: all other quantities can be related to {V, CA,CB} via algebraic relationships. Note that an alternative would have been to derive a species balance for the solvent instead of the mass balance. Relate volume and liquid level Hydrostatic pressure Flow pressure relationship 21 Reaction rate . . . and additional equations to define NA (= CAV), NB (= CB V), M (= ρV) if desired. Note: if significant density changes occur due to reaction (e.g., not sufficiently dilute) then it is better to derive NC species balances and derive the volume from the molar volumes in solution. Degree of freedom analysis: Total number of quantities = 16 Time invariant parameters: A,ρ,g, k, kR (= 5) Natural input set: FIN (t),CA,IN (t),CB, IN (t ),P0 (t) (=4) Remaining variables: V,FOUT ,P1,h,CA,CB,r (=7) Equations = 7 => degrees of freedom satisfied given specification of input set above ENERGY CONSERVATION According to the First Law of Thermodynamics, energy is a conserved quantity. For an open system, this can be expressed as: Warning: always start from the First Law when deriving energy balances!! Here, energy is the summation of internal energy (e.g., that associated with translation, rotation and vibration of molecules), kinetic energy, and potential energy. In most process simulation applications, it is usually reasonable to neglect kinetic and potential energy (or to perform separate balances for internal energy and these other forms of energy) — but always check this assumption. 22 EX.Given this assumption, the differential form of the First Law of Thermodynamics for the following "general" open system : ...where we have introduced time as the independent variable. Note that the conserved quantity is the internal energy of the control volume contents (not the enthalpy!). The work term is composed of two contributions: ...the summation of the shaft work done on the system (e.g., an impeller to keep the contents well mixed) and the PV work due to changes in volume of the system. Variables: U internal energy of control volume contents [J] Q˙ rate of heat addition to control volume from environment [J s-1] W˙ rate of work done on the control volume by the environment [J s-1] Fi rate of material addition/discharge [kg s-1] or [mol s-1] hi specific enthalpy of material stream [J kg-1] or [J mol-1] The energy balance can therefore be expressed in two equivalent forms: or du/ dt can be eliminated by substitution of the differential form of the definition of enthalpy (H =U + PV): 23 Of course, there are many situations in which neither the volume or the pressure remains constant over the time horizon of interest. In this case, we must be able to express the rate of change of the volume or pressure explicitly, or have this implied by the algebraic equations (which leads to difficulties - see discussion of "high index" problems later). ENERGY BALANCE — CONSTANT PRESSURE EXAMPLE Consider the CSTR again — the reaction is now exothermic and heat is removed by a jacket containing a vaporizing medium, so an energy balance is necessary. 24 Assumptions: • Vessel contents well mixed • Species A and B present in dilute solution • Atmospheric pressure is constant (e.g., P0 ≠f (t)) • Neglect shaft work of impeller • Neglect heat interaction with atmosphere • Otherwise, same as above. Variables: M mass of fluid in vessel [kg] V volume of fluid in vessel [m3] NA number of moles of species A in vessel [mol] NB number of moles of species B in vessel [mol] CA concentration of species A in vessel [mol m-3] CB concentration of species B in vessel [mol m-3] ρ density of fluid in vessel [kg m-3] A cross sectional area of vessel [m2] AJ heat transfer area of jacket [m2] UJ overall heat transfer coefficient for jacket [J m-2 K-1 s-1] H enthalpy of vessel contents [J] CA,IN concentration of species A in inlet stream [mol m-3] CB,IN concentration of species B in inlet stream [mol m-3] FIN volumetric flow of inlet stream [m3 s-1] FOUT volumetric flow of outlet stream [m3 s-1] TIN temperature of inlet stream [K] TOUT temperature of outlet stream [K] P0 atmospheric pressure [Nm-2] P1 pressure at bottom of vessel [Nm-2] g gravitational acceleration [m s-1] k loss co-efficient kR reaction rate constant [s-1] 25 r reaction rate [mol m-3 s-1] ρIN density of inlet stream [kg m-3] ρOUT density of outlet stream [kg m-3] Q˙ heat transfer to fluid in vessel from jacket [J s-1] hIN specific enthalpy of inlet stream [J kg-1] hOUT specific enthalpy of outlet stream [J kg-1] ER activation energy [J mol-1] R universal gas constant [J mol-1 K-1] h liquid level in vessel [m] T temperature of vessel contents [K] TJ temperature of vaporizing medium [K] Equations: Mass conservation ...note we are unable to assume ρ is constant Species balances for A and B Energy balance (constant pressure formulation — e.g., it is most convenient to use enthalpy in the accumulation term) Relate volume and mass Relate volume and liquid level Relate mole numbers and concentration 26 Hydrostatic pressure Flow pressure relationship Contents well mixed Define enthalpy holdup (implies temperature of contents) Physical Properties (abstract functions) Heat transfer A commonly asked question is: how is the temperature in the reactor determined? In fact, the temperature is determined by the simultaneous solution of the complete set of implicit relationships above. One can view equation (4) as determining the extensive enthalpy H of the vessel contents, equation (14) determining the intensive enthalpy hOUT, and equation (18) implicitly determining T given hOUT. 27 Degree of freedom analysis: Note: in many textbooks it is common practice to include a reaction term in the energy balance. The control volume approach (equation (E1) or (E2)) clearly shows that no energy crosses the system boundary due to a reaction taking place, so a reaction term should not appear in the energy balance. If a reaction is taking place in an isolated system, the total energy of the system remains unchanged, but the distribution of energy between "heat of formation" energy and "sensible heat" energy changes as the reaction progresses (e.g., the temperature will rise or drop if the reaction is exothermic or endothermic). To reflect this, the constitutive equation defining the specific enthalpy (18) must include the contribution of both the heat of formation and the sensible heat of each species to the total system energy. So, the zero energy reference state for equation (18) must be defined as the elements making up the chemical species in their standard states at some temperature and pressure. If heats of formation are not included in equation (18), a heat of reaction term must be added to the energy balance, and the heat of reaction must be calculated as a function of temperature. Overall, I consider it clearer and simpler to work with the first law and include heats of formation in species enthalpies (obviously, none of this is necessary if no chemical reactions occur in the system of interest). MOMENTUM BALANCE It is sometimes necessary to model the velocity (or momentum) of the contents of a control volume. As flows can in general be three dimensional, velocity is a vector quantity with components corresponding to the velocity resolved into the coordinate directions of the chosen coordinate system. So, in principle we can formulate a momentum balance for each co-ordinate direction (three balances). Applying Newton's Second Law to a control volume, we obtain: 28 . . . for each direction i in which material is flowing. Note: momentum is defined as the product of mass and velocity. Care should be taken if both the mass and the velocity of the control volume are changing with respect to time. MOMENTUM BALANCE EXAMPLE Consider the buffer tank open to the atmosphere, but now the fluid flows out into a long pipeline: Control volumes: (a) liquid in tank, (b) liquid in pipeline Assumptions: • Same as for original buffer tank example • One dimensional plug flow in pipeline and incompressible liquid => velocity uniform throughout pipeline (macroscopic control volume) 29 Variables: M mass of fluid in vessel [kg] ρdensity of fluid in vessel [kg m-3] FIN volumetric flow of inlet stream [m3s-1] FOUT volumetric flow of inlet stream [m3s-1] AP cross sectional area of pipeline [m2] L length of pipeline [m] v velocity of fluid in pipeline (uniform) [ms-1] FH hydraulic force on fluid [N] FF frictional force resisting flow [N] g gravitational acceleration [ms-2] h level of liquid in vessel [m] V volume of liquid in vessel [m3] kF constant related to Fanning friction factor A cross sectional area of vessel [m2] Equations: Mass conservation in tank . . . mass balance on pipeline unnecessary – incompressible liquid in fixed volume (Flow in = Flow out) Momentum conservation on pipeline - axial direction only 31 Degree of freedom analysis: Total number of quantities = 14 Time invariant parameters: ρ, Ap ,L,g, kF, A (=6) Natural input set: FIN (t) (=1) Remaining variables: M,FOUT,v, FH,FF,h,V (=7) Equations = 7 => degrees of freedom satisfied Non-Isothermal CSTR We reconsider the previous CSTR example, but for non-isothermal conditions. The reaction A B is exothermic and the heat generated in the reactor is removed via a cooling system as shown in figure below. The effluent temperature is different from the inlet temperature due to heat generation by the exothermic reaction. Figure Non-isothermal CSTR Assuming constant density, the macroscopic total mass balance (Eq. 2.6) and mass component balance remain the same as before. However, one more ODE will be produced from the applying the conservation law for total energy balance. The dependence of the rate constant on the temperature: The generation term is zero since the mass is conserved. The balance equation yields: 31 ….(1) Under isothermal conditions we can further assume that the density of the liquid is constant i.e. ρf = ρo=ρ. In this case Eq. 1 is reduced to: …(2) The general energy balance for macroscopic systems applied to the CSTR yields, assuming constant density and average heat capacity: (3) where Qr (J/s) is the heat generated by the reaction, and Qe (J/s) the rate of heat removed by the cooling system. Assuming Tref = 0 for simplicity and using the differentiation principles, equation (3) can be written as follows: Substituting Equation (1) into the last equation and rearranging yields: …(4) The rate of heat exchanged Qr due to reaction is given by: 32 where ΔHr (J/mole) is the heat of reaction (has negative value for exothermic reaction and positive value for endothermic reaction). The non-isothermal CSTR is therefore modeled by three ODE's: where the rate (r) is given by: The system can be solved if the system is exactly specified and if the initial conditions are given: Degrees of freedom analysis Parameter of constant values: ρ, E, R, Cp, ΔHr and ko (Forced variable): Ff , CAf and Tf Remaining variables: V, Fo, T, CA and Qe • Number of equations: 3 (Eq. 1, 2 and 4) The degree of freedom is 5−3 = 2. Following the analysis of this example, the two extra relations are between the effluent stream (Fo) and the volume (V) on one hand and between the rate of heat exchanged (Qe) and temperature (T) on the other hand, in either open loop or closed loop operations. A more elaborate model of the CSTR would include the dynamic of the cooling jacket. Assuming the jacket to be perfectly mixed with constant volume Vj, density ρj and constant average thermal capacity Cpj, the dynamic of the cooling jacket temperature can be modeled by simply applying the macroscopic energy balance on the whole jacket: Since Vj, ρj, Cpj and Tjf are constant or known, the addition of this equation introduces only one variable (Tj). The system is still exactly specified. 33 Jacketed Non-isothermal CSTR Single Stage Heterogeneous Systems: Multi-component flash drum The previous treated examples have discussed processes that occur in one single phase. There are several chemical unit operations that are characterized with more than one phase. These processes are known as heterogeneous systems. In the following we cover some examples of these processes. Under suitable simplifying assumptions, each phase can be modeled individually by a macroscopic balance. A multi-component liquid-vapor separator is shown in figure 12. The feed consists of Nc components with the molar fraction zi (i=1,2… Nc). The feed at high temperature and pressure passes through a throttling valve where its pressure is reduced substantially. As a result, part of the liquid feed vaporizes. The two phases are assumed to be in phase equilibrium. xi and yi represent the mole fraction of component i in the liquid and vapor phase respectively. The formed vapor is drawn off the top of the vessel while the liquid comes off the bottom of the tank. Taking the whole tank as our system of interest, a model of the system would consist in writing separate balances for vapor and liquid phase. However since the vapor volume is generally small we could neglect the dynamics of the vapor phase and concentrate only on the liquid phase. Multicomponent Flash Drum 34 For liquid phase: Total mass balance: Component balance: Energy balance: where h~ and H~ are the specific enthalpies of liquid and vapor phase respectively. In addition to the balance equations, the following supporting thermodynamic relations can be written: Liquid-vapor Equilibrium: Raoult's law can be assumed for the phase equilibrium Together with the consistency relationships: Physical Properties: The densities and enthalpies are related to the mole fractions, temperature and pressure through the following relations: 35 Note that physical properties are not included in the degrees of freedom since they are specified through given relations. The degrees of freedom is therefore (2Nc+5)(2Nc+3)=2. Generally the liquid holdup (VL) is controlled by the liquid outlet flow rate (FL) while the pressure is controlled by FV. In this case, the problem becomes well defined for a solution. Multi-component Distillation Column Distillation columns are important units in petrochemical industries. These units process their feed, which is a mixture of many components, into two valuable fractions namely the top product which rich in the light components and bottom product which is rich in the heavier components. A typical distillation column is shown in Figure 13. The column consists of n trays excluding the re-boiler and the total condenser. The convention is to number the stages from the bottom upward starting with the re-boiler as the 0 stage and the condenser as the n+1 stage. Description of the process The feed containing nc components is fed at specific location known as the feed tray (labeled f) where it mixes with the vapor and liquid in that tray. The vapor produced from the re-boiler flows upward. While flowing up, the vapor gains more fraction of the light component and loses fraction of the heavy components. The vapor leaves the column at the top where it condenses and is split into the product (distillate) and reflux which returned into the column as liquid. The liquid flows down gaining more fraction of the heavy component and loses fraction of the light components. The liquid leaves the column at the bottom where it is evaporated in the re-boiler. Part of the liquid is drawn as bottom product and the rest is 36 recycled to the column. The loss and gain of materials occur at each stage where the two phases are brought into intimate phase equilibrium. Distillation Column Modeling the unit: We are interested in developing the unsteady state model for the unit using the flowing assumptions: 100% tray efficiency Well mixed condenser drum and re-boiler. Liquids are well mixed in each tray. Negligible vapor holdups. liquid-vapor thermal equilibrium Since the vapor-phase has negligible holdups, then conservation laws will only be written for the liquid phase as follows: Stage n+1 (Condenser),: Total mass balance: 37 Stage n Total Mass balance: Component balance: Energy balance: Stage i Total Mass balance: 38 Stage f (Feed stage) Energy balance Stage 1 Total Mass balance: 39 Stage 0 (Re-boiler) Total Mass balance: Additional given relations: 41 Phase equilibrium: yj = f (xj, T,P) Liquid holdup: Mi = f (Li) Enthalpies: Hi = f (Ti, yi,j), hi = f (Ti, xi,j) Vapor rates: Vi = f (P) Degrees of freedom analysis Variables 41 Equations: 42 Constants: P, F, Z Therefore; the degree of freedom is 4 To well define the model for solution we include four relations imported from inclusion of four feedback control loops as follows: • Use B, and D to control the liquid level in the condenser drum and in the re-boiler. Use VB and R to control the end compositions i.e., xB, xD 43