Contenido principal

Virtual Reference Feedback Tuning

Virtual reference feedback tuning (VRFT) is a direct data-driven control technique that allows you to tune linearly parameterized controllers based on the plant input and output data. The high level idea of VRFT is to obtain a controller such that the closed-loop system always follows a defined reference model.

VRFT involves designing a controller C(z,θ) such that the closed-loop system has the same transfer function as a desired reference model M(z). Typically, for standard model reference design methods, you select a reference signal and adjust the controller such that the system output tracks the reference signal. However, this is challenging without a plant model. The virtual reference approach simplifies this by choosing virtual r¯(t) such that M(z)r¯(t)=y(t). Therefore, a virtual reference signal when fed to a desired reference model produces the measured plant output y(t). The approach then involves calculating the tracking error e(t)=r¯(t)y(t) and designing a controller that, when fed by e(t), generates the known input signal u(t). This reduces the controller design task to identifying the dynamic relationship between e(t) and u(t).

For a set of given input-output data (u(t), y(t)), the VRFT algorithm [1] is summarized as follows:

  1. Compute a virtual reference such that y(t)=M(z)r¯(t) and the corresponding tracking error e(t)=r¯(t)y(t), assuming M ≠ 1.

  2. Filter the signals e(t) and u(t) with a suitable filter L(z).

    eL(t)=L(z)e(t),uL(t)=L(z)u(t)

  3. Select the controller parameters θ that minimizes the following criteria

    JVRFTN=1Nt=1N(uL(t)C(z,θ)eL(t))2

    When the controller is a linear combination with parameter θ, that is, C(z,θ) = βT(z)θ, you can then write the criteria as:

    JVRN=1Nt=1N(uL(t)φLT(t)θ)2,φL(t)=β(z)eL(t)

  4. Compute the solution parameter vector given by:

    θ^=[t=1NφL(t)φLT(t)]1t=1NφL(t)uL(t)

For more details about the algorithm, see the reference [1].

VRFT in Simulink and MATLAB

Virtual Reference Feedback Tuning Block

To tune controllers using VRFT in Simulink®, you can use the Virtual Reference Feedback Tuning block. The major benefits of this block include the ability to perform one-shot tuning, requiring only a single experiment; suitability for tuning linear combinations of linear control laws, including PID and FIR; and support for both online and offline workflows.

To use the block:

  1. Connect the plant output and input to the block. You can use VRFT to tune controllers for plant data obtained from either open-loop or closed-loop configurations. In the closed-loop configuration, this block provides the advantage of tuning your nominal controller without breaking the existing feedback loop or injecting any perturbations into it. Additionally, the block allows you to tune controllers with the data from the plant model collected during simulation or logged beforehand.

  2. Specify the Reference Model M(z) value to describe the desired closed-loop response of the model from reference r(t) to output y(t). Optionally, you can also specify Weighting Function to emphasize particular frequencies where matching the r(t)-to-y(t) transfer function with the reference model is most important.

  3. Specify the Controller Structure you want to tune. If you are tuning a baseline controller, the controller structures must match. Using this block, you can tune the following types of controllers:

    • PID Controller — Parallel-form PID controllers.

      C(z,θ)=P+Iα(z)+D1Tsz1zθ1=Pθ2=Iθ3=D

      Here, α(z) is the discrete-time integrator formula and the block allows you to specify the formula as either Forward Euler, Backward Euler, or Trapezoidal.

    • FIR Filter — FIR filter type controller.

      C(z,θ)=b0+b1z++bnznθ1=b0,θ2=b1,...θn+1=bn

    • Generic Form — Generic-from controller. This can represent a combination of linearly parameterized controllers.

      C(z,θ)=θ1C1(z)+θ2C2(z)++θnCn(z)

  4. Run the simulation for a sufficient duration using the start/stop port (see Start-Stop Generator) to ensure that the values of the controller parameters θ converge. You can then update your controller to use these parameter values.

vrfttune Function

Since R2026a

To tune controllers using VRFT in MATLAB®, you can use the vrfttune function. The major benefits of this function include the ability to perform one-shot offline tuning using logged input-output data. Using vrfttune, you can tune linear controllers, including PID, FIR filters, linear combinations of linear controllers, and tunable LTI objects.

  1. Prepare the logged input-output data and store it in a timetable created using the timetable function. A valid timetable includes columns of input and output with multiple rows of sampled data. The data must be uniformly sampled with respect to time.

    tt = timetable(seconds(t),u,y);
  2. Specify the reference model M(z) value to describe the desired closed-loop response of the model from reference r(t) to output y(t). Optionally, you can also specify weighting function to emphasize particular frequencies where matching the r(t)-to-y(t) transfer function with the reference model is most important.

  3. Create an option set for the controller structure you want to tune using the vrfttuneOptions object. If you are tuning a baseline controller, the controller structures must match. Using this function, you can tune the following types of controllers:

    • Parallel-form PID

    • FIR filter

    • Generic form LTI combination

    • Tunable LTI controller (requires Optimization Toolbox™)

    For example:

    opt = vrfttuneOptions("parallel-pid");
    opt.PIDType = "PID";
  4. Run the simulation to obtain the controller parameters. The function also returns a controller object parameterized with the tuned parameters.

    [theta,cTuned,info] = vrfttune(tt,mref,VRFTOptions=opt)

For tunable LTI models, the function uses fmincon to compute the solution parameter vector. This requires Optimization Toolbox software.

Examples

For examples that show how to retune and improve the performance of a nominal PID controller for a plant model operating in a closed-loop configuration, see Tune PID Controller for Mass-Spring-Damper System Using Virtual Reference Feedback Tuning Block and Tune PID Controller for Vehicle Lateral Control System Using Virtual Reference Feedback Tuning Block. For an example that shows how to tune an FIR filter type controller for a plant in open-loop configuration, see Tune FIR Filter Type Controller for Flexible Transmission System Using Virtual Reference Feedback Tuning Block.

For examples that show how to tune controllers at the command line, see Tune PID Controller for Mass-Spring-Damper System Using VRFT at Command Line and vrfttune reference page.

References

[1] Campi, M. C., A. Lecchini, and S. M. Savaresi. “Virtual Reference Feedback Tuning: A Direct Method for the Design of Feedback Controllers.” Automatica 38, no. 8 (August 1, 2002): 1337–46. https://doi.org/10.1016/S0005-1098(02)00032-8.

See Also

Topics