tutorial - tu chemnitz · 2018. 8. 22. · eif – – ial 2 pcet overview what’s pcet? •...
TRANSCRIPT
-
TutorialPCET – Polynomial Chaos Expansion Toolbox
Stefan Streif Felix Petzke Ali Mesbah
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
2
PCET Overview
What’s PCET?• MATLAB™ based toolbox for uncertainty quantification using the
polynomial chaos expansion (PCE)• simple syntax for definition of models, uncertainties, …• general purpose code and mid-level functions• free for academic purposes:
www.TU-Chemnitz.de/etit/control/research/PCET
Possible applications and problem setup• systems: continuous- or discrete-time systems with uncertain initial
conditions, parameters and inputs and outputs
• problems and applications: stochastic MPC, stochastic active FDI, experiment-design, parameter and state estimation, uncertainty quantification, …
Aims of this tutorial?explain main concepts and typical work flow at simple example
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
3
Outline
1. Quick guide
2. Typical workflow illustrated at a simple example
3. Examples overview
4. References
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
4
Quick guide – installation, files, folders, documentation
InstallationUnpack ZIP-file into current MATLAB™ folder and run
installPCET
generates documentation, sets paths, checks dependencies, …
Help and documentationFor short introduction to syntax etc. type
help PCET
For further and more detailed information on different functions, extended functionality, please see examples, help browser or type e.g.:
help PCETcompose
doc PCETcompose
Please contact [email protected] if you need further help.
Files and folders• main files (starting with PCET…) in main folder• auxiliary files in subfolders (shouldn’t be used directly)• examples in folders ./PCET/examples/ex…
mailto:[email protected]
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
5
Typical workflow
7. Modify inputs, uncertaintiesof parameters and initial cond.
init
ializ
atio
np
rob
lem
sp
eci
fic
6. Visualize or analyze results
5. Simulate PCE-system or perform MC simulations
4. Set options for simulation, integration, …
3. Write files for simulation
2. Compose the PCE-system
1. Define dynamical system and uncertainties, inputs, …
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
6
Define system, inputs, uncertainties, …
1. Define dynamical system and uncertainties, inputs, …
states(1).name = 'x';
states(1).dist = 'uniform';
states(1).data = [0.9 1.3];
states(1).rhs = 'a*x + u';
parameters(1).name = 'a';
parameters(1).dist = 'normal';
parameters(1).data = [-5 0.1];
outputs(1).name = 'y';
outputs(1).rhs = '3*x^2';
inputs(1).name = 'u';
inputs(1).rhs = 'piecewise(ut,uv,t)';
inputs(1).ut = 1; % time of step
inputs(1).uv = 1; % height of step
Example ODE:
Implementation:
state
parameter
output
input(here piecewise constant)
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
7
Compose and export problem
2. Compose the PCE-systemPCE is performed for the specified system, uncertainties, …
may take a long time depending on the number of uncertainties and PCE order• returns: structure sys that will be used by subsequent functions
3. Write files for simulationr.h.s. of continuous or discrete-time dynamics (PCE-system or Monte-Carlo) andof output equations have to written to files (used later by simulation functions etc.)
sys = PCETcompose(states,parameters, ...
inputs,outputs,pce_order)
PCETwriteFiles(sys,'ex1_ODE.m','ex1_OUT.m', ...
'ex1_MCODE.m','ex1_MCOUT.m')
r.h.s. of PCE system(for simulation)
r.h.s of PCE output equations
r.h.s. of MC system(for simulation)
r.h.s of MC output equations
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
8
Set options and update of uncertainties
4. Set options for simulation, integration, …
simoptions.tspan = [0 3];
simoptions.dt = 0.05;
Continuous-time:simoptions.setup = odeset;
simoptions.solver = ‘ode15s';
Discrete-time:simoptions.solver = ‘discrete-time';
7. Update/modify uncertainties of initial conditions or parameter
set simulation interval
set time step-size for (simulation and/orevaluation
set integrator options
choose integrator
choose discrete-timesimulation
sys = PCETupdate(sys,‘x',[1.1 1.4],‘a',[-6 0.1]);
update ‘data’ (see step 1) of variables ‘x’ and ‘a’
Optional and possibly at a later time-point:
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
9
Simulation
5a. Simulate PCE system (and output equations) using Galerkin projectionPCEresults = ...
PCETsimGalerkin(sys,'ex1_ODE','ex1_OUT',simoptions)
PCEresults/MCresults contain all simulation data which can be processed and analyzed further
5b.Simulate PCE system (and output equations) using collocation
and/or:
samples_col = PCETsample(sys,'basis',col_samples)
PCEresults = ...
PCETsimCollocation(sys,'ex1_MCODE', ...
'ex1_MCOUT',samples_col,simoptions)
5c. Monte-Carlo simulation (states and output equations)
and/or:
samples = PCETsample(sys,'variables',mc_samples)
MCresults = ...
PCETsimMonteCarlo(sys,'ex1_MCODE','ex1_MCOUT', ...
samples,simoptions)
draws col_samples samples, evaluates basis polyn. and uses collocation
draws mc_samples samples, evaluates uncert. and simulates system
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
10
Visualize and analyze results
6a. MomentsMomMats = PCETmomentMatrices(sys,4)
compute moment matrices (up to 4th order)need not to recomputed (can be stored for repeated use)
6b.Histogram
and/or:
samples_basis = PCETsample(sys,'basis',n_samples)
samples_y = samples_basis' * PCEresults.y.pcvals
draws n_samples samples and evaluates basis polynomials
use MATLAB™ functions for histogram plots (e.g. histc)
PCEresults.y.moments = ...
PCETcalcMoments(sys,MomMats,results.y.pcvals)
use MATLAB™ function plot to display moments stored in PCEresults.y.moments
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
11
Quick guide – examples
ex1_continuous_simulation
• uncertainty quantification for a nonlinear system• plotting of moments, histograms, …
ex2_lti_systems
• uncertainty quantification for a linear system• specification of system dynamics in matrix form
ex3_discrete_simulation
• uncertainty quantification for a discrete-time nonlinear system
ex4_fault_detection
• input design for active fault detection for a two-tank-system• distribution dissimilarity measure• embedding uncertainty quantification into an nonlinear optimization scheme
ex5_model_discrimination
• input design for model discrimination for biochemical reaction networks
[Mesbah et al. (2014)]
[Streif et al. (2014)]
ex6_SNMPC
• stochastic nonlinear model predictive control for a crystallization process• chance constraints
[Mesbah et al. (2014)]
-
Stef
an S
trei
f–
TU C
hem
nit
z –
PC
ET T
uto
rial
12
Selected PCE applications/publications
• J. A. Paulson, S. Streif, and A. Mesbah. Stability for receding-horizon stochastic model predictive control. In Proc. American Control Conference (ACC), Chicago, IL, July 2015.
• J. A. Paulson, A. Mesbah, S. Streif, R. Findeisen, and R. D. Braatz. Fast stochastic model predictive control of high-dimensional systems. In Proc. 53rd IEEE Conference on Decision and Control (CDC), Los Angeles, CA, December 2014.
• A. Mesbah, S. Streif, R. Findeisen, and R. D. Braatz. Stochastic nonlinear model predictive control with probabilistic constraints. In Proc. American Control Conference (ACC), Portland, Oregon, June 2014.
• A. Mesbah, S. Streif, R. Findeisen, and R. D. Braatz. Active fault diagnosis for nonlinear systems with probabilistic uncertainties. In Proc. 19th IFAC World Congress, Cape Town, South Africa, 2014.
• S. Streif, F. Petzke, A. Mesbah, R. Findeisen, and R. D. Braatz. Optimal experimental design for probabilistic model discrimination using polynomial chaos. In Proc. 19th IFAC World Congress, Cape Town, South Africa, 2014.
• S. Streif, M. Karl, and A. Mesbah. Stochastic nonlinear model predictive control with efficient sample approximation of chance constraints. arXiv: 1410.4535.
• A. Mesbah and S. Streif. A probabilistic approach to robust optimal experiment design with chance constraints. In. Proc. International Symposium on Advanced Control of Chemical Processes (ADCHEM), Whistler, Canada, 2015.
source codes available, see examples!