6Problem Solutions – Estimation of Variables and Model Parameters from Plant Data
S_6.1 6.1.1
MATLAB® Program code for Solution 6.1
% Cross-correlations and autocorrelations for Problem 6.1
% Tank & Pipeline
clear all;
close all
Tend=7200;
dt=10;
Nstep=Tend/dt;
V=1; % m3 (tank)
Vp=1; % m3 (pipe)
F=5/3600; % m3/s
CA1=50; % ppm (initialised at mid-range)
pointer_SHIFT=round(Vp/(F*dt));
Nstack=pointer_SHIFT+1;
CA1stack=CA1*ones(Nstack,1);
pointer_NOW=Nstack;
CA0plot=zeros(Nstep,1);
CA1plot=zeros(Nstep,1);
CA2plot=zeros(Nstep,1);
tplot=zeros(Nstep,1);
N=200; % max no. of steps in correlation functions
for i=1:Nstep
CA0=100*rand();
CA1=CA1+(dt/V)*F*(CA0-CA1); % simple Euler integration)
pointer_NOW=pointer_NOW+1; % cyclical file
if (pointer_NOW>Nstack)
pointer_NOW=pointer_NOW-Nstack; ...
Get Applied Process Control now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.