The code in this project underlies the numerical experiments from the article
"Optimal Instrumental Variable Selection for Closed-loop Data-Driven Predictive Control" by
Rogier Dinkla1, Tom Oomen1,2, Sebastiaan P. Mulders1, and Jan-Willem van Wingerden1.
Affiliations:
1 Delft Center for Systems and Control, Faculty of Mechanical Engineering, Delft University of Technology, The Netherlands
2 Control Systems Technology Group, Department of Mechanical Engineering, Eindhoven University of Technology, The Netherlands
The above work derives an optimal instrumental variable (IV) for closed-loop Data-Driven Predictive Control (DDPC) that minimizes the asymptotic variance of employed system estimates that are asymptotically unbiased. Furthermore, approximations of optimal IVs are provided that either do or do not rely on controller knowledge.
The primary intent of the code is to facilitate reproduction of results presented in the paper, which stem from a batch of Monte Carlo simulations that perform a parameteric sweep over a range of innovation noise variances (Re). The code can furthermore be used to generate results from a wider variety of systems and initial controllers, and perform batches of Monte Carlo simulations that sweep over the past window length (p) or number of Hankel data matrix columns (N). Since the analysis of results that were not presented in the paper is not the primary purpose of this repository, manual adjustments may be needed to visualize other data.
-
main_MC.m— Orchestrates a full Monte Carlo run: generates data, computes IVs, builds predictors, runs closed-loop simulation -
CaseDefinitions.m— Defines 17 controllers (14 types of IV-DDPC + 3 benchmarks) -
IV_4_DDPC.m— class to efficiently store the similarly structured IVs -
get_Z.m— Creates IV matrices for all 14 IV-DDPC controllers. -
get_Lf_Cz.m— Generates (estimates of) the matrix$L_f$ , and uses this to generate an SPC-type of controller by means ofLf_2_SPC.m. -
get_solver.m— function to find how the optimal input from unconstrained SPC depends on$L_f$ , past IO data, and future reference signals. -
approx_IV_no_controller_info.m,approx_IV_controller_info.m— Respectively Algorithms 1 and 2 from the paper. Used to approximate optimal IVs.
main.m— Single Monte Carlo simulation with configurable parameters (Re, N, p, f, seed, sys, ...).main_dRe.m— Batch experiments sweeping innovation noise variance (Re). Single MC runs performed byrun_Re.m.main_dp.m— Batch experiments sweeping past horizon length (p). Single MC runs performed byrun_p.m.main_dN.m— Batch experiments sweeping number of Hankel matrix columns (N). Single MC runs performed byrun_N.m.
-
get_sys_info.m— Route to the selected plant model & initial controller based onsysparameter -
init_sims.m— Initialize simulation: select plant model and initial controller usingget_sys_info.mand construct initial closed-loop system. -
tune_Cz0.m— Tune initial controllerCz0via H-infinity mixed-sensitivity design - Details of the system configurations are available in directories that are named after the used plant model:
sys Plant/Directory Initial Controller ( Cz0)Notes 1 Landau1995 [24,25] Cz0_Landau1995_D0.matResults presented in paper.
4th-order system with input-output delay,
5th orderCz0without direct feedthrough2 Landau1995 [24,25] Cz0_Landau1995_D0_n50.mat50th order Cz0without direct feedthrough3 Landau1995 [24,25] Cz0_Landau1995.mat5th order Cz0with direct feedthrough ($D_c$ ≠ 0)4 Bemporad2002 [30] Cz0_Bemporad2002.mat2nd-order unstable system, 4th order Cz05 Favoreel1999 [31] Cz0_Favoreel1999.matMarginally stable 5th-order system, 7th order Cz06 Wang2023 [6] Cz0_Wang2023.matUnstable 3rd-order plant, 5th order Cz07 Wang2023 [6] Cz0_Wang2023_provided.matUnstable 3rd-order plant, Cz0of 2nd order provided by authors and.matfile generated frommodel_Wang2023.m
main_processing.m— Aggregates raw Monte Carlo batch results into summary statistics, saves these toprocessed_data.matfiles.process_dX.m— Batch aggregation logic (computes m1, mLf, m4 metrics across seeds)util_fun/— Helper functions for processing
plot_figs_paper.m— Generates the figures from the paper.Fig_IV_approx.m,Fig_Lf_estimates.m,Fig_prediction_quality.m,Fig_sim_example.m— Functions to help plot individual figures.
blk_toeplitz_mean.m— Performs averaging over block-diagonals corresponding to a block-Toeplitz structure.make_Hankel.m— Hankel matrix construction from data.get_subdir1.m— Helps navigation to the right data directory. Called bymain_processing.m.make_blk_tril.m— Block-lower-triangularize provided matrix.make_blk_tril_toeplitz.m— Block Toeplitz/triangular matrix operations.make_ext_ctrb.m,make_ext_obsv.m— Extended controllability/observability matrices.make_reference.m— Replicates reference from [25]plant2ABCDK.m— Gets A, B, C, D, and K matrices from the specified plant.ss2lag.m— Computes the lag of a state-space system.
| ID | Type | Description |
|---|---|---|
iv1 |
Baseline | Open-loop IV |
iv2a, iv2b, iv2c |
Optimal (exact) | Optimal IV with 0, 1, 2 refinement iterations |
iv3a, iv3c |
LCF-IV [6] | IV based on the left coprime factorization |
iv4a, iv4b, iv4c |
Approx. (no Cz0 info) |
Approximated optimal IV without controller knowledge |
iv5a, iv5b, iv5c |
Approx. (with Cz0 info) |
Approximated optimal IV with controller knowledge |
iv6a, iv6c |
Reference-based | Future reference as IV |
CLSPC |
Benchmark | Standard closed-loop SPC |
actLf |
Oracle | True transfer matrix (upper bound) |
TrPred |
Transient | Transient predictor |
IVs with "b" suffix incorporate (approximations of) future denoised outputs
IVs with "c" suffix are variants that apply 2SLS (two-stage least squares) to the IV preceding it in the table.
This code is released under the MIT License (see LICENSE.md).
[6] Y. Wang, Y. Qiu, M. Sader, D. Huang, and C. Shang, "Data-Driven Predictive Control Using Closed-Loop Data: An Instrumental Variable Approach," IEEE Control Systems Letters, vol. 7, pp. 3639–3644, 2023, doi: 10.1109/LCSYS.2023.3340444.
[24] I. D. Landau, D. Rey, A. Karimi, A. Voda, and A. Franco, "A Flexible Transmission System as a Benchmark for Robust Digital Control," European Journal of Control, vol. 1, no. 2, pp. 77–96, Jan. 1995, doi: 10.1016/S0947-3580(95)70011-5.
[25] A. Chiuso, M. Fabris, V. Breschi, and S. Formentin, "Harnessing uncertainty for a separation principle in direct data-driven predictive control," Automatica, vol. 173, p. 112070, Mar. 2025, doi: 10.1016/j.automatica.2024.112070.
[30] A. Bemporad, M. Morari, V. Dua, and E. N. Pistikopoulos, "The explicit linear quadratic regulator for constrained systems," Automatica, vol. 38, no. 1, pp. 3–20, Jan. 2002, doi: 10.1016/S0005-1098(01)00174-1.
[31] W. Favoreel, B. De Moor, M. Gevers, and P. Van Overschee, "Closed-Loop Model-Free Subspace-Based LQG-Design," in Proceedings of the Mediterranean Conference on Control and Automation, Jan. 1999.