Skip to content

Time‐Varying Tube MPC design

Michaela32 edited this page Apr 20, 2026 · 3 revisions

MPT+ Wiki: Time-Varying Tube MPC Design

Overview

The time-varying tube MPC formulation extends classical TMPC by allowing the tube cross-section to evolve along the prediction horizon. In classical tube MPC, the tube cross-section is fixed along the prediction horizon, which can lead to conservative behavior, especially in the early stages where the effect of disturbances is still limited. The time-arying tube MPC results in less conservative constraint tightening and improved feasibility. MPTplus enables the implementation of time-varying tube MPC design according to recent developments in the literature (see Tube MPC with Time-Varying Cross-Sections . The time-varying formulation:

  • reduces conservatism
  • improves feasibility
  • is beneficial in constrained scenarios

MPTplus enables this via the TMPCController class, providing automatic synthesis of robust controllers with stage-dependent constraint tightening.


TMPCController Class

The TMPCController class constructs a robust MPC controller using tube-based formulations.

When configured with:

'TubeType','timevarying'

it implements time-varying tube MPC, where disturbance effects are propagated along the prediction horizon.

TMPC = TMPCController(model, N, options)

Parameters

  • model – instance of ULTISystem (uncertain LTI system)
  • N – prediction horizon
  • options – controller configuration

Key Options

Option Values (Default) Description
TubeType 'timevarying' / 'fixed' Tube MPC formulation type
LQRstability 0 / 1 (1) Enables terminal set and penalty from LQR
solType 0 / 1 (1) Output format:
1 – control input
0 – nominal trajectories

Properties

  • TMPCparams
    Stores computed parameters such as feedback gain, tightening terms, and internal sets

  • model
    Contains system dynamics, constraints, and penalties


Demo

Basic System and MPC Setup

model = ULTISystem('A', [1, 1; 0, 1], ...
                   'B', [0.5; 1], ...
                   'E', [1, 0; 0, 1]);

model.u.min = -1;
model.u.max =  1;

model.x.min = [-100; -100];
model.x.max = [ 100;  100];

model.d.min = [-0.1; -0.1];
model.d.max = [ 0.1;  0.1];

model.x.penalty = QuadFunction(diag([1, 1]));
model.u.penalty = QuadFunction(0.01);

N = 10;

Time-Varying Tube MPC (Default)

option = {'TubeType','timevarying','LQRstability',1};
TMPC = TMPCController(model, N, option);

Simulation

x0 = [-5; -2];
Nsim = 31;

data = TMPC.simulate(x0, Nsim);

Visualization

figure
subplot(2,1,1)
hold on, box on, grid on
title('State trajectories')
ylabel('x')
stairs([0:Nsim],data.X(1,:),'b','LineWidth',2)
stairs([0:Nsim],data.X(2,:),'r','LineWidth',2)
legend('x1','x2')

subplot(2,1,2)
hold on, box on, grid on
title('Input trajectory')
ylabel('u')
stairs([0:Nsim-1],data.U,'LineWidth',2)
f1

The controller ensures robust constraint satisfaction under disturbances while maintaining stability via LQR terminal ingredients.


Nominal Trajectories (solType = 0)

In this case, the controller is configured to return the nominal predicted trajectories instead of directly applying the receding-horizon control law.

option = {'TubeType','timevarying','LQRstability',1,'solType',0};
TMPC = TMPCController(model, N, option);

data = TMPC.simulate(x0, Nsim);

Available Data

  • data.X – actual (robust) state trajectory
  • data.U – applied control input
  • data.Xnominal – nominal predicted states
  • data.Unominal – nominal inputs

This separation highlights the tube structure:
the real trajectory remains bounded around the nominal one.

Visualization

figure
subplot(2,1,1)
hold on, box on, grid on
title('State trajectories')
ylabel('x')
stairs([0:Nsim],data.Xnominal(1,:),'b','LineWidth',2)
stairs([0:Nsim],data.Xnominal(2,:),'r','LineWidth',2)
legend('x1','x2')

subplot(2,1,2)
hold on, box on, grid on
title('Input trajectory')
ylabel('u')
stairs([0:Nsim-1],data.Unominal,'LineWidth',2)
f2

Visualization of Tube Evolution

The figure shows the open-loop trajectory (blue) together with the time-varying disturbance sets (red) the feasible (tightened) set (gray), illustrating how uncertainty grows and is accounted for at each prediction step. The tube cross-section grows along the horizon due to accumulated disturbances.

x0 = [48.5; -8.4];
Nsim = 30;

data = TMPC.simulate(x0, Nsim);

TMPC.PlotStateTrajectory(data.X(:,5))
f3

The following figure shows the closed-loop nominal trajectory (blue) and the actual disturbed trajectory (black) evolving along control steps inside the the feasible (tightened) set (gray), illustrating how the controller keeps the real system within robust bounds around the nominal path.

TMPC.PlotStateTrajectory(x0, Nsim)
f4

Explicit Controller

The explicit controller partitions the state space into regions and assigns a precomputed affine control law to each region, enabling fast real-time evaluation without solving an optimization problem online.

eTMPC = TMPC.toExplicit();
eTMPC.PlotStateTrajectory(x0, Nsim)

Time-Varying Tube Mechanism

The method is based on error dynamics:

  • deterministic propagation of initial error
  • accumulation of disturbance effects
  • early steps → small uncertainty (less conservative)
  • later steps → larger uncertainty (more conservative)
  • instead of a fixed invariant set, stage-dependent set is considered
  • improved feasibility
  • reduced conservatism

Notes

  • Use 'TubeType','timevarying' to enable the method
  • Use solType = 0 for debugging and analysis
  • The controller internally computes:
    • feedback gain ( K )
    • constraint tightening
    • tube evolution along the horizon

Clone this wiki locally