24
Essentials of process modeling, dynamic, and control Flavio Manenti CMIC Giulio NattaDept.

Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

  • Upload
    buidan

  • View
    221

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Essentials of process modeling, dynamic, and control

Flavio Manenti

CMIC “Giulio Natta” Dept.

Page 2: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Course progress

Outlier DetectionRobust methodsLinear/nonlinear RegressionsPerformance MonitoringYield AccountingSoft sensing

DataReconciliation

MathematicalModeling

DynamicSimulation

ModelPredictive

Control

Optimization

ModelReduction

DCS, OTS, Plantwide control, Soft sensing, process transients,

grade/load changes

Solvers

PlanningScheduling

Dynamic optimizationDistributed predictive control

Nonlinear SystemsOptimizers

Differential systemsStiff systems

ODE,DAE,PDE,PDAEEfficiency

DecisionsRaw Data

ParallelComputing

UncertaintiesOptimal production

Optimal grade changesMulti-objective

Real-time optimizationHigh accuracy

Reliable process controlProduction improvement

EconomyJust in time

Market-drivenLogistics

CorporateSupply Chain

2

Page 3: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Steps for process modeling

• “All models are wrong, but some are very useful”G.E.P. Box [1]

• Process modeling Basic

• Chemical and physical laws• Conservation of mass, energy, momentum

Assumptions• Extremely rigorous models including every phenomenon down to microscopic

details would be so complex that it would take a long time to develop and might be impractical to solve

• Reasonable compromise

Mathematical model consistency• Number of variables, degrees of freedom, unit of measures

Solution of the model equations Model validation

[1] Box, G.E.P., Robustness in the strategy of scientific model building, in Robustness in Statistics, R.L. Launer and G.N. Wilkinson, Editors. 1979, Academic Press: New York

3

Page 4: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – continuity equation• Total continuity equation (mass balance):

• Example: perfectly mixed tank Ordinary differential equation

Check of units of measure

It results in:

mass flow mass flow time rate of change

into system out system of mass inside system

0 0,t tF

,t tV ,t tF

0 0 time rate of change of F F V

3 33 3

3 3

/

min min min

m kg mm kg m kg

m m

0 0

d VF F

dt

4

Page 5: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – continuity equation• Example: pipeline

Constant-diameter cylindrical, turbulent flow (plug flow conditions), no radial gradient

Density and velocity can change with respect to z and t

Time rate of change of the mass inside the slice:

Mass flowing in the volume:

0z z z dz z L

dz

,t zv ,t z

min

V A dzm kg

t t t

23

min min

m kg kgvA m

m

5

Page 6: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – continuity equation

Mass flowing out the volume:

Taylor expansion of a function f(z) around z:

If dz is small, the continuity equation becomes:

Assuming A and dz are constant:

vAvA

z

22

2...

2!z z

dzf ff z dz f z dz

z z

A dz vAvA vA dz

t z

0

v

t z

6

Page 7: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – continuity equation• Component continuity equation (component balances):

For the j-th component:

Take care of the matrix nonsingularity of the resulting system (NC-1 component balances and the total mass balance)

• Example: tank with reaction Atmospheric tank, first-order irreversible reaction AB with taking place

in the liquid phase with reaction rate k Component A:

• Flow of A into system:• Flow of A out of system:• Rate of formation of A from the reaction:

flow of moles of j-th flow of moles of j-th

component into system component out of system

rate of formation of moles of j-th time rate o

component from chemical reactions

f changes of moles of j-th

component inside system

0 0 ,0 ,0, , ,A BF c c

, , ,A BF c c, , ,A BV c c

0 ,0AF c

AFc

AVkc

7

Page 8: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – continuity equation

• Time rate of change of A inside tank:

Components balances:

It is also possible to use the total continuity equation since:

• Example: tank with consecutive reactions: Same assumptions of the previous example, reaction ABC, with k1

and k2 as reaction rates, respectively Component continuity equations:

Ad Vc

dt

0 ,0

0 ,0

AA A A

BB B A

d VcF c Fc Vkc

dtd Vc

F c Fc Vkcdt

A A B BM c M c

0 ,0 1

0 ,0 1 2

0 ,0 2

AA A A

BB B A B

CC C B

d VcF c Fc Vk c

dtd Vc

F c Fc Vk c Vk cdt

d VcF c Fc Vk c

dt

8

Page 9: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – continuity equation

Density relation:

• Example: tubular reactor Same assumptions of “Example: pipeline” (plug flow conditions, no

radiant gradients) Reaction AB with reaction rate k

Denote: Terms of the general component continuity equation

• Inflow terms are split in bulk flow and diffusion. The diffusive flux NA [moles of A/time/area] is given by Fick’s law type relationship:

C

j jj A

M c

0z z z dz z L

dz

,t zv , ,,t z A t zc ,0A tc ,A L tc

,0 ,0 , , A t A t A t L A L tc c c c

AA A

cN D

z

9

Page 10: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – continuity equation

• The “Eddy diffusivity” DA [length/time] is due to both diffusivity and turbulence• Molar flow of A into boundary at z (both bulk and diffusion):

• Moles of A leaving the system at boundary z+dz:

• Rate of formation inside system:

• Time rate of change inside system:

• Thus, it results in:

moles of A/sA AvAc AN

A A

A A

vAc ANvAc AN dz

z

Akc Adz

AAdzc

t

A A AA A A A A

Adzc vAc ANvAc AN vAc AN dz kc Adz

t z

0A AA

A

vc Nckc

t z

10

Page 11: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – energy equation• Energy balance

• Example: CSTR with heat removal Same assumptions of “Example: perfectly mixed tank” with exothermic

reaction (heat of reaction )

flow of internal, kinetic, and flow of internal, kinetic, and

potential energy into system potential energy out of system

by convection or diffusion by convection or diffusion

heat added to system by work done by system on

conduction, radiation, and surrounding (shaft work

reaction and PV work)

time rate of change of internal, kinetic,

and potenti

al energy inside system

0 0 ,0 0, , ,AF c T

, , ,AF c T, , ,AV c TQ

0

11

Page 12: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – energy equation

Rate of heat generation: The energy balance is:

With:• U = internal energy [energy/mass]• K = kinetic energy [energy/mass]• FI = potential energy [energy/mass]• W = shaft work done by system [energy/time]• P = pressure of system• P0 = pressure of feed stream

No shafts are working in the system: W = 0 Not relevant inlet and outlet velocities: K = 0 Also, their relative elevations are negligible: FI = 0 The energy balance results in:

G AQ Vkc

0 0 0 0 0

0 0

G

F U K F U K

Q Q W FP F P

d U K V

dt

00 0 0 0 0

0

0 0 0 0 0

=

=

G

G

d VU PPF U F U Q Q F F

dtd VU

F U PV F U PV Q Qdt

12

Page 13: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – energy equation

With Vtilde as specific volume, the enthalpy (h for liquid, H for gas):

For liquids PVtilde is negligible with respect to U:

Enthalpies are functions of composition, temperature, and pressure, but primarily temperature; the heat capacities at constant pressure and volume are:

h U PV

, p v pp v

H Uc c h c T

T T

0 0 0= A

d VUF h F h Q Vkc

dt

0 0 0= A

d VhF h F h Q Vkc

dt

0 0=p p A

d VTc c F T FT Q Vkc

dt

13

Page 14: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – energy equation• Example: two-phase CSTR with heat removal:

If the phases are in thermal equilibrium, the vapor and liquid temperatures are equal (T = Tv).

If the phases are in phase equilibrium, the liquid and vapor compositions are related by a vapor-liquid equilibrium relationship (i.e. Raoult’s law)

H = f(y,Tv,P), FI = K = W = 0 The energy equation is:

0 0 0=v v l

v v l A

d V H V hF h F h F H Q V kc

dt

, , , ,v v vV P T y

, , ,AF c T

, , ,v v vF T y

Q

0 ,0 0 0, , ,AF c T, , ,l AV c T

14

Page 15: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – energy equation

with h = cpT and H = cpT+lambdav, (lambdav is the average heat of vaporization of the mixture):

• Example: jacketed tubular reactor

No radial gradients, cooling jacket, heat transferred from reactants and products (T) to the metal wall (TM) and, next, to the cooling water

Negligible potential and kinetic energy (FI=K=0), simplified forms for Uand h, diffusive flow negligible with respect to the bulk flow

Conversely, it is relevant the heat conduction along the reactor

0 0 0=v v p v l p

p p v v p v l A

d V c T Vc TF c T F c T F c T Q V kc

dt

,M t zT

waterdz

,t zv , , ,, ,t z A t z t zc T ,0 0,A t tc T , ,A L t L tc T

15

Page 16: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – energy equation

Terms:• Flow of energy (h) into the boundary z:

• Flow of energy out of z+dz:

• Heat generated by chemical reaction:• Heat transferred to metal wall:

– with hT as heat transfer film coefficient• Heat conduction into boundary z:• The heat flux for conduction (Fourier):

– with kT as effective thermal conductivity• Heat of conduction out of z+dz:• Rate of change of U (h) of the system:

Thus:

23

pm kg cal cal

vA c T m Ks kg K sm

T Mh Ddz T T

pp

vA c TvA c T dz

z

zq A

z TT

q kz

zz

q Aq A dz

z

AAdzkc

pAdzc T

t

4 T

p p TA M

Tk

c T v c T h zkc T T

t z D z

16

Page 17: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – equation of motion• Newton’s second law of motion is the foundation for modeling the

conservation of momentum:

(a conversion factor gc for units of measure could be present)

• The general form is:

with Fji is the jth force acting in the ith direction

• In real application there are three directions x, y, z: Each system has three equations of motions, besides the overal mass and

energy balances and the NC-1 component balances Vectorial form to represent the conservation of momentum

• Example: gravity flow tank (LAB) The flow in the pipe is described

by a force balance

F Ma

1

Ni

jij

d MvF

dt

F0

hF F, v

Ap

L

A

17

Page 18: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – equation of motion

Mass in the pipeline: Velocity of the mass of liquid

• Under the assumption of plug flow conditions and incompressible fluid: the fluid in the pipe is like a solid rod, the amount of liquid within the pipe is constant

Hydraulic force exerted by the fluid in the tank pushes the fluid within the pipeline:

• Static pressure is the same at both the sides of the pipe

Frictional force due to the fluid viscosity works against the hydraulic force:

Thus:

pM A L

p

Fv

A

pHydraulic Force A hg

2 FFrictional Force K Lv

2pp F

d A L vA hg K Lv

dt

2F

p

Kdv hg v

dt L A

18

Page 19: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

• Transport equation at molecular scale and macroscale:

Quantity Heat Mass Momentum Flux q NA taurz

_____________________ Molecular transport _______________________ Driving force de_T/de_z de_cA/de_z de_vz/de_r Law Fourier Fick Newton Property Thermal Diffusivity Viscosity

conductivity (kT) (DA) (mu)

______________________ Overall transport ________________________ Driving force DeltaT DeltacA DeltaP Relationships q=hTDeltaT NA=kLDeltacA Various

Fundamental laws – transport equation

19

Page 20: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – equations of state• Since physical properties vary, the equations of state correlate them

with temperature, pressure, and compositions: Liquid density: Vapor density: Liquid enthalpy: Vapor enthalpy: If we wish a cp=f(T):

• From to• Using the polynomial:

• With mixtures with negligible mixing effects, the total enthalpy is:

Liquid densities are often assumed constant• Unless large variations in T and xi

Vapor densities need PVT relationships such as:• Perfect-gas law:

, ,L if P T x

, ,V if P T y

, , ih f P T x

, , iH f P T y

ph c T p vH c T 0

T

pTh c T dT

1 2pc T A AT

0

22 2 2

1 2 1 0 02 2

T

T

ATh AT A A T T T T

1

1

NC

j j jj

NC

j jj

x h M

h

x M

nM MP

PV nRTV RT

20

Page 21: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – equilibrium

• Chemical equilibrium:

nuj is stoichiometric coefficient• Products have positive coefficient• Reactants have negative coefficients

muj is the chemical potential

• Example: reversible gas-phase reaction

When the equilibrium takes place: Chemical potential for a perfect-gas mixture:

• muj0 is the standard chemical potential (Gibbs free energy per mole)• Pj is the partial pressure

Thus:

the equilibrium constant is:

1

0NC

j jj

1

2

k

a bk

A B

0b B a A 0 lnj j jRT P

0 0ln ln 0b B B a A ART P RT P

0 0ln lnB A

B A a A b BRT P RT P

0 0

lnB

A

B a A b B

A

P

RTP

B

A

BP

A

PK

P

21

Page 22: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – equilibrium

• Phase equilibrium: When the chemical potential of the components is the same in the phases

I and II:

Basically, it is interesting to calculate the vapor composition once it is known the liquid composition or viceversa

Common examples: bubble- and dew-points General assumptions (in our course):

• Ideal vapor-phase behavior (Dalton’s law) until pressure is low-medium:

• Where Pj is the partial pressure

Liquid-phase relationships:• Ideal liquids (Raoult laws):

– Where PjS is the vapor pressure of the jth component– PjS(T):

I IIj j

j jP Py

1

, SNC

j jSj j j

j

x PP x P y

P

ln jSj j

AP B

T

22

Page 23: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – equilibrium

• Relative volatility of i with respect to j is fairly constant for several systems:

– In a binary system:

• Equilibrium vaporization (K values), especially in petroleum industry [1]:

• Activity coefficients (for nonideal liquids):

– Where gamma_j is the activity coefficient (fudge factor) for the jth component (gamma_j = 1 for ideal components)

/

/i i

ijj j

y x

y x

/

1 / 1 1 1ijy x x

yy x x

[1] Lima, Zuñiga Liñan, Manenti, Maciel Filho, Wolf Maciel, Embiruçu, Medina, Fuzzy cognitive approach of a molecular distillation process, CHEMICAL ENGINEERING RESEARCH AND DESIGN, 89(4), 471-479, 2011

jj

j

yK

x

1

NCS

j j jj

P x P

23

Page 24: Essentials of process modeling, dynamic, and controlsuper.chem.polimi.it/wp-content/uploads/2014/02/04-D-LECTURE-P… · Essentials of process modeling, dynamic, and control Flavio

Flavio Manenti – Dipartimento CMIC “Giulio Natta”

Fundamental laws – equilibrium

• Chemical kinetics [1-2]: Arrhenius law (temperature dependence):

• k is the specific reaction rate• alpha is the preexponential factor• E is the activation energy

Law of mass action:

Overall reaction rate (AB):• p is the order of reaction AB (e.g. for the second order it reads as follows):

• With more reactants, A+BC:

[1] Levenspiel (1999); [2] Fogler (1992)

E

RTk e

pAr kc

A Br kc c

2Ar kc

1 j

j

dnr

V dt

k

a b c dA B C D

1 1 1 1A B C D

a b c d

dn dn dn dnr

A dt B dt C dt D dt

24