function [A,B,C,D] = lkablock_utilGetDiscreteModelForMPC(Ts,Vx,Ag,Bg,Cg,lag,hasLag)
%#codegen
%
% Get discrete state-space model for Adaptive MPC. Called by the "Lane
% Keeping Assist System" Block.

% Inputs:
%   Ts:                mask variable for sample time
%   Vx:                mask inport for longitudinal velocity
%   Ag,Bg,Cg:          continuous or discrete vehicle model with sample time Ts    
%   lag:               lumped lag in the model
%   hasLag:            indicating if lag>0 (true or false)

% Outputs:
%   A,B,C,D:           discrete time model for MPC

%   Author: Meng Xia, Rong Chen
%   Copyright 2017-2018 The MathWorks, Inc.

% Add lag dynamics when vehicle model specied by parameters
if hasLag
    [A,B,C,D] = lkablock_utilGetDTModelHasLagForMPC(Ts,Vx,Ag,Bg,Cg,lag);
else
    [A,B,C,D] = lkablock_utilGetDTModelNoLagForMPC(Ts,Vx,Ag,Bg,Cg);
end






