function D = checkDelay(D)
% Checks validity and consistency of delay data.
% RE: Performs only size checks. Type checking is performed by top-level 
% functions for optimal performance in model array case.

% Copyright 1986-2014 The MathWorks, Inc.
[Ny,Nu] = iosize(D);
Ts = D.Ts;
Delay = D.Delay;
Delay.Input = ltipack.util.checkInputDelay(Delay.Input,Nu,Ts);
Delay.Output = ltipack.util.checkOutputDelay(Delay.Output,Ny,Ts);
Delay.IO = ltipack.util.checkIODelay(Delay.IO,Ny,Nu,Ts);
D.Delay = Delay;