Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
Daniel E. Rivera, Associate Professor
Department of Chemical, Bio and Materials Engineeringand
Control Systems Engineering LaboratoryArizona State UniversityTempe AZ 85287-6006
[email protected], (602) 965-9476© Copyright, 1997,1998
System Identification for Process Control:A Short Course: Module Two
Principal Sources of Error in System Identification
• BIAS. Systematic errors caused by
- input signal characteristics (i.e., excitation) - choice of model structure
- mode of operation (i.e., closed-loop instead of open-loop)
• VARIANCE. Random errors introduced by the presence of noise in the data, which do not allow the model to exactly reproduce the plant output. It is affected by the following factors:
- number of model parameters
- duration of the identification test
- signal-to-noise ratio
ERROR = BIAS + VARIANCE
System Identification Structure, Revisited
white noise signal
Input Signal (Random orDeterministic)
Output Signal (random, autocorrelated)
u
yP(z)
a
++
H(z)
υDisturbance Signal (random, autocorrelated)
• persistently exciting with as much power as possible;• uncorrelated with the disturbance (desirable from a practical
standpoint)• as long as possible
How to Lower Variance
Var ∝ n
N
Φν(ω)Φu(ω)
Φu ≡ input power spectrumΦν ≡ disturbance power spectrumn ≡ number of model parametersN ≡ number of data points
Reducing the number of estimated model parameters,increasing the length of the data set , and increasing the power of the input signal all contribute to variance reduction in system identification
1
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
"Plant Friendly" Input Signal Design
• be as short as possible
• not take actuators to limits, or exceed move size restrictions
• cause minimum disruption to the controlled variables (i.e., low variance, small deviations from setpoint)
A plant friendly input signal should:
Note that theoretical requirements may strongly conflict with "plant-friendly" operation!
Inputs to Consider• Single Step
• Single Pulse ("Nonzero Mean" Pulse)
• Double Pulse ("Zero Mean" Pulse)
• Gaussian White Noise
• Random Binary Signal (RBS)
• Pseudo-Random Binary Signal (PRBS)
• Schroeder-phased Multisinusoidal Inputs
Single Stepu(s) =
a
su(z) =
a
1− z−1
The step input emphasizes low frequencies (steady-state/final time behavior)
0 10 20 30 40 50 60 70 80 90 100
0
0.2
0.4
0.6
0.8
1
Time [Min]
Step Input - Time Domain
10-2
10-1
100
101
10-1
100
101
102
103
Radians/Min
AR
Step Input - Power Spectral Density
Single Pulse Inputu(s) =
a(1− e−∆ts)s
u(z) =a(1− z−N)
1− z−1 N = ∆t/T
Narrowing the pulse makes the signal resemble an impulse input; widening the pulse makes the input resemble a step.
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0
0.2
0.4
0.6
0.8
1
Time [Min]
Nonzero Mean Pulse Input - Time Domain
10-1
100
101
102
10-2
10-1
100
101
102
Radians/Min
AR
Power Spectral Density for the PULSE input
We will also call this "the nonzero mean pulse"
2
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
Double Pulse Inputu(s) =
a(1− 2e−∆ts + e−2∆ts)s
u(z) =a(1− 2z−N + z−2N)
1− z−1 N = ∆t/T
The double pulse attenuates low frequencies, which may lead to problems if the pulse width is not made long enough.
We will also call this "the zero mean pulse"
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-1
-0.5
0
0.5
1
Time [Min]
Zero Mean Pulse Input - Time Domain
10-1
100
101
102
10-4
10-2
100
102
Radians/Min
AR
Power Spectral Density for the PULSE input
White Noise, Revisited
tx = ta ta = N(0, a2σ )
1txta
0
0.5
1
1.5
0 1 2 3
Frequency [Radians]
phi
POWER SPECTRUM OF WHITE NOISE
0
0.5
1
1.5
0 2 4
Lag
rhok
AUTOCORRELATION OF WHITE NOISE
kρ = kγa2σ a
2σ = 1Φ(ω )
ω
the white noise input , by definition, meets persistent excitation requirements
Gaussian White Noise vs. Random Binary Sequences
A Gaussian white noise signal fails to meet the requirements of "plant-friendliness"; the random binary
sequence represents a reasonable alternative
-3
-2
-1
0
1
2
3
0 0.05 0.1 0.15 0.2
NORMAL DISTRIBUTION [mean=0;Var=1]
x
pdf p(x)
-3
-2
-1
0
1
2
3
20 40 60 80 100
Samples
x
SAMPLES OF RANDOM NORMAL DATA +3σ
+σ
−3σ
+2σ
−σ−2σ
} }}Probability
%
68.3
95.5
99.9
Pseudo-Random Binary Sequence
1 0 1 1 0 1 1 0 1
1 nr
Exclusive OR(Modulo 2 Adder)
Test Signal
Shift Registers
The PRBS is a periodic, deterministic input which can be generated using shift registers and Boolean algebra
The main design variables are switching time (Tsw), number of shift registers (nr), and signal amplitude
3
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
PRBS, continued
PRBS design for Tsampl = 1, Tsw = 3, n (registers) = 4, and signal magnitude = +/- 1.0. One cycle duration is 45 minutes long.
0 5 10 15 20 25 30 35 40 45-1
-0.5
0
0.5
1
One cycle of the PRBS time input signal
Time[Min]
100
10-3
10-2
10-1
100
Radians/Min
AR
Power Spectrum of the PRBS input
PRBS Generation Info
0 1 = 10 0 = 01 1 = 01 0 = 1
XOR
Stages Feedback Registers
2 1,2 3 2,3 4 3,4 5 3,5 6 5,6 7 4,7 8 4,5,6,8 9 5,9
Note: using feeback registers other than those indicated may not result in a sequence of "maximum length"
PRBS Autocovariance Function
-Tsw +Tsw −a2 / N
+a2 +a2
0 NTsw
Ruu (kTsw)
Delay
The autocovariance function for the PRBS is periodic and "resembles" that of white noise
100
101
102
103
104
10-3 10-2 10-1 100 101
Frequency [Radians/time]
|u|
ω∗ ω∗
PRBS Design Variables
The power spectrum of a PRBS signal is given by
Φu(ω) =a2(N + 1)Tsw
N
sin(ωTsw2 )ωTsw
2
2
where a is the amplitude of the PRBS signal, Tsw is the switching time, andN = 2nr − 1, nr is the number of shift registers. The frequency range of a PRBSsignal “useful” for system excitation is
ω∗ =2πNTsw
≤ ω ≤ 2.8Tsw
= ω∗
4
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
100
101
102
103
104
10-3 10-2 10-1 100 101
Frequency [Radians/time]
|u|
ω∗ ω∗
PRBS Design GuidelinesPRBS Design Guidelines
ω∗ ≤1
βsτHdom≤ ω ≤ αs
τLdom≤ ω∗
τLdom ≡ low estimate of dominant time constantτHdom ≡ high estimate of dominant time constantβs ≡ factor representing settling time of processαs ≡ factor representing closed-loop speed
as a multiple of the open-loop response time
Tsw ≤2.8τLdom
αsNs = 2nr − 1 ≥ 2πβsτHdom
Tsw
• nr and Ns must be integer values;
• Tsw must be an integer multiple of the sampling time T .
Random Binary Signals/SequencesThe discrete-interval random binary sequence (RBS) is a two levelsignal which switches between the levels −a and a at regularly spacedintervals of time with probability p.function [signal] = randbin(len,p)%% RANDBIN: binary (-1 1) random signal% of length ’len’ and transition probability ’p’%state = -1; % initial statesignal = zeros(len,1);rand(’uniform’);
for i = 1:lenx = rand(1,1);if x<p
state = -state;end;signal(i,1) = state;
end;
When the transition probability is p = 0.5, the asymptotic expressionof the theoretical PSD is:
Φu(ω) = a2Tswsin2(ωTsw/2)
(ωTsw/2)2
RBS Power Spectrum - Asymptotic
100
101
102
103
104
10-3
10-2
10-1 10
0 10
1
Frequency [Radians/time]
ω∗ ω∗
RBS Example
0 50 100 150 200 250 300-1
-0.5
0
0.5
1
Realization of the Random-Binary time input signal
Time[Min]
10-3
10-2
10-1
100
10-3
10-2
10-1
100
101
Power Spectrum of the Random-Binary Input
Frequency [Radians/Min]
sampling time = 1, switching time = 3 min, 300 samples, probability of switching = 0.5, signal magnitude = +/- 1.0, window size for smoothing PSD = 32
5
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
Schroeder-Phased Input Signals
us(k) = λns∑i=1
√2αi cos(ωikT + φi)
T ≡ sampling timeNs ≡ sequence lengthns ≡ no. of sinusoids, ns ≤ Ns/2
αi ≡ relative power ns∑i=1αi = 1
ωi = 2πi/NsT
φi = 2πi∑
j=1jαj
λ ≡ scaling factor to insure signal meets ± usat
The Schroeder input is a periodic, deterministic signal composed of a sum of sinusoids according to:
"Low-Pass" Schroeder-Phased Input Design
u 2
2πNsT
πT
α i nonzero between ω* and ω*
α i = 0 from ω* to πT
ω*
ω*
ω∗ ≤1
βsτdom≤ ω ≤ αs
τdom≤ ω∗
τdom ≡ dominant plant time constantβs ≡ factor representing settling time of processαs ≡ factor representing closed-loop speed
as a multiple of the open-loop response time
Ns ≥2πβsτdom
T
ns ≥NsTαs2πτdom
PowerSpectrum
Input Comparison Example
Example. Consider the plant with delay
p(s) =e−s
s + 1
T = 0.3 min, τdom=1.5 min αs = 2 (i.e., 2 times the open-loop bandwidth)and βs = 3 (the 95% settling time)
Schroeder-phased Input
Ns = 96 ns = 7 One Cycle Period: 28.8 min
PRBS Input
Tsw = 2.1 Ns = 15 nr = 4 shift registers
One Cycle Period: 31.5 min
0 5 10 15 20 25 30-1
-0.5
0
0.5
1
One cycle of the PRBS time input signal
Time[Min]
100 101
10-2
100
Radians/Min
AR
Power Spectrum of the PRBS input
PRBS Design Guideline Results
6
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
Power Spectrum ComparisonSchroeder-phased signal with usat = 1.75 ; PRBS input
with usat = 1.0
10-2
10-1
100
101
10-1 100 101
Power spectra of Schroeder-phased and PRBS Signals
Frequency (rad/min)
Time-Domain Input Realization(1 Period)
-2
-1
0
1
2
0 5 10 15 20 25 30 35
Sample Time (min)
PRBS input signal
-2
-1
0
1
2
0 5 10 15 20 25 30 35
Schroeder-phased input signal
Sample Time (min)
PRBS has lower overall span but requires larger move sizes, in comparison to the Schroeder-phased signal
Time-Domain Output Response
-1
0
1
0 5 10 15 20 25 30 35
PRBS output signal
Sample time (min)
-1
0
1
0 5 10 15 20 25 30 35
Schroeder-phased output signal
Sample time (min)
Output variable deviations are comparable for both signals
Pulse Test ComparisonWe select the width of the "nonzero mean" pulse such that its spectrum resembles that of the Schroeder and PRBS inputs
10-2
10-1
100
101
10-1 100 101
Power Spectra of Schroeder-phased and PRBS and PULSE signals
Frequency (rad/min)
Pulse width is 2.1 minutes, height is 1.5 units
7
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
Nonzero-Mean Pulse: Input Comparison
-1
0
1
0 5 10 15 20 25 30 35
Pulse Input, width = dT
Time[min]
-1
0
1
0 5 10 15 20 25 30 35
PRBS input signal
Time[min]
Pulse width is 2.1 minutes, height is 1.5 units
Nonzero Mean Pulse:Output Signal Comparison
-1
0
1
0 5 10 15 20 25 30 35
PRBS output time signal
Time [min]
-1
0
1
0 5 10 15 20 25 30 35
PULSE output time signal
Time[min]
Nonzero-Mean Pulse, Revisited
-1
0
1
0 5 10 15 20 25 30 35
Pulse Input, width = dT
Time[min]
-1
0
1
0 5 10 15 20 25 30 35
PRBS input signal
Time[min]
-1
0
1
0 5 10 15 20 25 30 35
PRBS output time signal
Time [min]
-1
0
1
0 5 10 15 20 25 30 35
PULSE output time signal
Time[min]
Increase nonzero mean pulse duration to 6 min, decrease pulse height to 1.0 units.
Power Spectra Comparison
10-2
10-1
100
101
10-1 100 101
Power Spectra of Schroeder-phased and PRBS and PULSE signals
Frequency (rad/min)
Nonzero Mean Pulse Spectrum
8
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
Repeated "Zero-Mean" Pulse
-1
-0.5
0
0.5
1
0 5 10 15 20 25 30 35
Pulse Input, width = 2.1 min
Time[min]
-1
-0.5
0
0.5
1
0 5 10 15 20 25 30 35
PULSE output time signal
Time[min]
Power Spectra Comparison
10-2
10-1
100
101
10-1 100 101
Power Spectra of Schroeder-phased and PRBS and PULSE signals
Frequency (rad/min)
Zero mean Pulse Spectrum
Zero-Mean Pulse, Longer Width
-1
-0.5
0
0.5
1
0 5 10 15 20 25 30 35
Pulse Input, width = 6 min
Time[min]
-1
-0.5
0
0.5
1
0 5 10 15 20 25 30 35
PULSE output time signal
Time[min]
Increase zero mean pulse duration to 6 min, decrease overall pulse span to 1.0 units.
Power Spectra Comparison, Zero-Mean Pulse
10-2
10-1
100
101
10-1 100 101
Power Spectra of Schroeder-phased and PRBS and PULSE signals
Frequency (rad/min)
Zero mean Pulse Spectrum
9
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
Nonparametric Estimation Via Correlation Analysis
Benefits of Correlation Analysis:
1. "Structure-free" estimation is a useful precursor to parametric identification (plots of the impulse and step responses obtained from correlation analysis can be used to set delays and model orders in parametric estimation techniques).
2. Can be used to confirm or deny the presence of a transfer function relationship between variables.
3. Feedback relationships in the data can be predicted as well.
Correlation AnalysisCorrelation analysis can be used to estimate the FiniteImpulse Response (FIR) coefficients between u, a candi-date input, and y, a desired output
y(t) = (b0 + b1z−1 + b2z
−2 + . . .+ bnz−n)u(t) + ν(t)
ν is an unmeasured noise term. The main assumptionsbehind correlation analysis are
• stationarity of the time series ut and yt (if nonsta-tionary, one solution is to use differenced data ∇xt =xt − xt−1; differencing can be applied consecutivelyto both ut and yt until a stationary time series is ob-tained).
• independence between ut and the noise νt.
• impulse response coefficients past n are zero (i.e.,horizon for correlation analysis sufficiently long.
Correlation Analysisγuy = Γub
b = [ b0 b1 b2 . . . bn ]T
Γu =
γu(0) γu(1) . . . γu(n)
γu(1) γu(0) . . . γu(n− 1)... ... ...
γu(n) γu(n− 1) . . . γu(0)
γuy =
γuy(0)
γuy(1)...
γuy(n)
b = Γ−1u γuy
The numerical solution to correlation analysis consists of a square (n x n) linear system of equations
Persistence of Excitation Requirements for Correlation Analysis Estimates
γuy = Γub
b = [ b0 b1 b2 . . . bn ]T
Γu =
γu(0) γu(1) . . . γu(n)γu(1) γu(0) . . . γu(n− 1)
... ... ...γu(n) γu(n− 1) . . . γu(0)
γuy =
γuy(0)γuy(1)
...γuy(n)
b = Γ−1u γuy
An input signal with persistent excitation of order n is requiredsuch that Γu is nonsingular / invertible (i.e., Γ−1
u exists).
10
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
Input PrewhiteningThe previous result can be considerably simplified if theinput time series ut is white noise. An autocorrelated in-put signal can be “transformed” into a white noise inputthrough the process of prewhitening,
αt = φ(z−1)θ−1(z−1)utβt = φ(z−1)θ−1(z−1)yt
leading to the result
bk =γαβ(k)σ2α
or in terms of crosscorrelations
bk =ραβ(k)σβ
σαk = 0, 1, 2, . . .
Following prewhitening, the crosscorrelation function be-tween the prewhitened input and the transformed outputis directly proportional to the impulse response function.
ARMA modeling of u provides the prewhitening filter
Feedback's Process Trainer PT326
• "Hairdryer" process; input (MV) is the voltage over the heating device; output (CV) is outlet temperature
3
4
5
6
7
16 17 18 19 20 21 22 23 24
OUTPUT #1
4
6
16 17 18 19 20 21 22 23 24
INPUT #1
Described in Ljung's system identification book, pg. 440; data records included in MATLAB's System Identification toolbox demonstration M-file.
"Hairdryer" Process Example
load dryer2
% Select the 300 first values for building a model:zu = u2(1:300) - mean(u2(1:300));zy = y2(1:300) - mean(y2(1:300));z2 = [zy zu];
% Plot the interval from sample 200 to 300: (0.08 sec is the sampling interval)idplot(z2,200:300,0.08)
"Hairdryer" Data Correlation Analysis - MATLAB commands
% If you wish to remove nonstationarity in the data, use the following command:%% zuf = filter([1 -1],[1],zu);% zyf = filter([1 -1],[1],zy);% z2 = [zyf zuf];%% Let us now estimate the impulse response of the system% via correlation analysis (CRA) to get some idea of time constants% and the like; the dash-dot lines on the impulse response coefficient plot% indicates standard error bounds corresponding to 99% significance level%% Command format: ir = cra(z2,M,NA)
M = 20; % 20 lags (default value)NA = 10; % Order for AR prewhitening filter (default value)
ir = cra(z2,M,NA,2);
11
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
Correlation Analysis Results, Hairdryer Data
0
0.05
0.1
0.15
-20 -10 0 10 20
Covf for filtered y
-0.5
0
0.5
1
1.5
-20 -10 0 10 20
Covf for prewhitened u
-0.2
0
0.2
0.4
0.6
-20 -10 0 10 20
Correlation from u to y (prewh)
-0.05
0
0.05
0.1
0.15
-20 -10 0 10 20
Impulse response estimate
Step Response, Hairdryer Data
-0.1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
Time (seconds)
Out
put
Step Response from Correlation Analysis
% We can form the corresponding step response by integrating% the impulse response:
stepr = cumsum(ir);slen = 0.08*[0:size(stepr)-1];plot(slen,stepr)
Spectral analysis consists of taking the Fourier trans-forms of the “smoothed” sample estimators for covari-ance and crosscovariance. The smoothing process re-duces variability at the expense of adding bias to theestimate. The resulting estimate is
p̃(eiω) =Φ̂yu(ω)Φ̂u(ω)
where Φ̂yu and Φ̂u denote the “smoothed” cross- andauto-spectra between u and y, described by the formulas
Φ̂yu(ω) =M∑
k=−Mcyu(k)w(k)e−iωk Φ̂u(ω) =
M∑k=−M
cu(k)w(k)e−iωk
w(k) is the lag “window” that accomplishes smoothing.A common window choice is the Tukey (“Hamming”) lagwindow
w(k) =
12(1 + cos(πkM )) |k| ≤M
0 |k| > M
where M is the truncation parameter for the window.
Spectral AnalysisSpectral Analysis Spectral Analysis, continued
One useful byproduct of spectral analysis is an estimateof the noise power spectrum,
Φ̂ν(ω) = Φ̂y(ω)− |Φ̂yu(ω)|2
Φ̂u(ω)
The estimated noise spectrum can in turn be relatedto uncertainty in the frequency response estimate (fromJenkins and Watts):
|p(eiω)− p̃(eiω|2 ≤ 2$ − 2
Φ̂ν(ω)Φ̂u(ω)
f2,$−2
f2,$−2 is the two-way Fisher statistic for a user-specifiedconfidence level. Other measures for obtaining uncer-tainty (based on deterministic, as opposed to statisticalarguments) are found on pages 155-156 of Ljung.
12
ChE 494/598, EEE 598 Intro to System Identification: Input Signals, Correlation and Spectral Analysis, March 5, 1998
© Copyright 1997, 1998 by D.E. Rivera, All Rights Reserved
% We now obtain the frequency response via spectral analysis; % the arguments to SPA are% [g phiv] = spa(z2,M2,w);% The default frequency vector w is% w = [1:128]/128*pi;% M2 is the truncation parameter for the Hamming lag window with % default value M2 = min(30,length(z2)/10);
w = [1:128]/128*pi;M2 = min(30,length(z2)/10);
[gs phiv] = spa(z2,M2,w);% setting the sampling interval
gs = sett(gs,0.08); % We get a Bode Plot representation and 99.7 % confidence intervals/three standard deviations via% bodeplot([gs phiv],3)bodeplot([gs phiv],3), pause
Spectral Analysis Using MATLABSpectral Analysis Using MATLAB Spectral Analysis Results - Hairdryer Data
10-2
10-1
100
10-1 100 101 102
frequency (rad/sec)
AMPLITUDE PLOT, input # 1 output # 1
-600
-400
-200
0
10-1 100 101 102
PHASE PLOT, input # 1 output # 1
frequency (rad/sec)
phas
e
dashed-dotted lines indicate 99% confidence bounds on the estimates
M2 = 30
13