Docsity

Solution to dynamic assignment, Assignments of Process Control

Toggle sidebar
bg1
Home Work 2 Advanced Process Dynamics and Control Hilal AlQuabeh 100048067
Problem 2:
%% Adv. process Dyn and Control Homework 2
% Problem 2
close all;clear all;clc;
% Predict the steady state responce of the power cycle
% Pe=x(1);Ge=x(2);Pc=x(3);Gc=x(4);Pm=x(5);
x0=[111 80 101 80 105];
t=0;
Ys=fsolve('PlantS',x0)
%% Please simulate and plot the dynamic response at the above initial
conditions, t ? [0,400] seconds
span=[0:400];
[t,Y]=ode15s('plant',span,x0)
figure
plot(t,Y(:,1),t,Y(:,2),t,Y(:,3),t,Y(:,4),t,Y(:,5))
xlabel('time')
title('Dynamic Response A')
legend('Pe','Ge','Pc','Gc','Pm');
%% Please plot the dynamic response at the initial conditions
X0 = [44.9998;85.996;43.3937;85.996;41.4555];
[t,Y2]=ode15s('plant',span,X0)
figure
plot(t,Y2(:,1),t,Y2(:,2),t,Y2(:,3),t,Y2(:,4),t,Y2(:,5))
xlabel('time')
title('Dynamic Response B')
legend('Pe','Ge','Pc','Gc','Pm');
function f=plant(t,x)
Cs=1.294e-6;w=2000;L=0.8;
Pe=x(1);Ge=x(2);Pc=x(3);Gc=x(4);Pm=x(5);
a=[0.1149 0.8851 1606.8];
xe = x(2)/18.727;
DPe = 0.0019*gevap(xe,a);
b=[0.1166,1606.8];
xc = x(4)/181.5233;
DPc = 0.1806*gcond(xc,b);
f=[Cs*Pe^2*(Gc-Ge);
(Pe-Pc-DPe)/L;
Cs*Pc^2*(Ge-Gc);
(Pc-Pm-DPc)/L;
0.7867*Gc-0.042*w*(1-0.0534*(Pe-Pm));];
function f=plant(x)
Cs=1.294e-6;w=2000;L=0.8;
Pe=x(1);Ge=x(2);Pc=x(3);Gc=x(4);Pm=x(5);
a=[0.1149 0.8851 1606.8];
24-Sep-2019
pf3
pf4

Partial preview of the text

Download Solution to dynamic assignment and more Assignments Process Control in PDF only on Docsity!

Problem 2:

%% Adv. process Dyn and Control Homework 2 % Problem 2 close all;clear all;clc; % Predict the steady state responce of the power cycle % Pe=x(1);Ge=x(2);Pc=x(3);Gc=x(4);Pm=x(5); x0=[111 80 101 80 105]; t=0; Ys=fsolve('PlantS',x0) %% Please simulate and plot the dynamic response at the above initial conditions, t? [0,400] seconds span=[0:400]; [t,Y]=ode15s('plant',span,x0) figure plot(t,Y(:,1),t,Y(:,2),t,Y(:,3),t,Y(:,4),t,Y(:,5)) xlabel('time') title('Dynamic Response A') legend('Pe','Ge','Pc','Gc','Pm'); %% Please plot the dynamic response at the initial conditions X0 = [44.9998;85.996;43.3937;85.996;41.4555]; [t,Y2]=ode15s('plant',span,X0) figure plot(t,Y2(:,1),t,Y2(:,2),t,Y2(:,3),t,Y2(:,4),t,Y2(:,5)) xlabel('time') title('Dynamic Response B') legend('Pe','Ge','Pc','Gc','Pm'); function f=plant(t,x) Cs=1.294e-6;w=2000;L=0.8; Pe=x(1);Ge=x(2);Pc=x(3);Gc=x(4);Pm=x(5); a=[0.1149 0.8851 1606.8]; xe = x(2)/18.727; DPe = 0.0019gevap(xe,a); b=[0.1166,1606.8]; xc = x(4)/181.5233; DPc = 0.1806gcond(xc,b); f=[CsPe^2(Gc-Ge); (Pe-Pc-DPe)/L; CsPc^2(Ge-Gc); (Pc-Pm-DPc)/L; 0.7867Gc-0.042w(1-0.0534(Pe-Pm));]; function f=plant(x) Cs=1.294e-6;w=2000;L=0.8; Pe=x(1);Ge=x(2);Pc=x(3);Gc=x(4);Pm=x(5); a=[0.1149 0.8851 1606.8];

xe = x(2)/18.727; DPe = 0.0019gevap(xe,a); b=[0.1166,1606.8]; xc = x(4)/181.5233; DPc = 0.1806gcond(xc,b); f=[CsPe^2(Gc-Ge); (Pe-Pc-DPe)/L; CsPc^2(Ge-Gc); (Pc-Pm-DPc)/L; 0.7867Gc-0.042w(1-0.0534(Pe-Pm));]; function y=gevap(x,a) % Two-Phase Evaporating Flow % a1 = (hl-hin)/(hv-hin); % a2 = (hv-hl)/(hv-hin); % a3 = rhol/rhov; a1=a(1); a2=a(2); a3=a(3); if x >= (1/a1) y = x^2; % no boiling elseif x >= 1 y=x^2+(1-a1x)^2x(a3-1)/(2a2); % partial boiling elseif x >= 0 y = x^2a3+x^3(a1+a2(a3+1)/2-a3); % complete boiling else y = -x^2a3; %0; disp('Reverse Flow') end function y=gcond(x,b) % Two-Phase Condensing Flow % x = G/Gc; % b1 = (hin-hl)/(hv-hl); % b2 = rhol/rhov; b1=b(1); b2=b(2); if x >= 1 y = x^2((1-1/2/x)b1(b2-1)+1); % partial condensing elseif x >= 0 y = x^2((x/2)b1(b2-1)+1); % complete condensing else y = -x^2; %0; disp('Reverse Flow') end