function [ret,x0,str,ts,xts]=absbrake(t,x,u,flag);
%ABSBRAKE	is the M-file description of the SIMULINK system named ABSBRAKE.
%	The block-diagram can be displayed by typing: ABSBRAKE.
%
%	SYS=ABSBRAKE(T,X,U,FLAG) returns depending on FLAG certain
%	system values given time point, T, current state vector, X,
%	and input vector, U.
%	FLAG is used to indicate the type of output to be returned in SYS.
%
%	Setting FLAG=1 causes ABSBRAKE to return state derivatives, FLAG=2
%	discrete states, FLAG=3 system outputs and FLAG=4 next sample
%	time. For more information and other options see SFUNC.
%
%	Calling ABSBRAKE with a FLAG of zero:
%	[SIZES]=ABSBRAKE([],[],[],0),  returns a vector, SIZES, which
%	contains the sizes of the state vector and other parameters.
%		SIZES(1) number of states
%		SIZES(2) number of discrete states
%		SIZES(3) number of outputs
%		SIZES(4) number of inputs
%		SIZES(5) number of roots (currently unsupported)
%		SIZES(6) direct feedthrough flag
%		SIZES(7) number of sample times
%
%	For the definition of other parameters in SIZES, see SFUNC.
%	See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.

% Note: This M-file is only used for saving graphical information;
%       after the model is loaded into memory an internal model
%       representation is used.

% the system will take on the name of this mfile:
sys = mfilename;
new_system(sys)
simver(1.3)
if (0 == (nargin + nargout))
     set_param(sys,'Location',[197,60,828,532])
     open_system(sys)
end;
set_param(sys,'algorithm',     'Euler')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '25')
set_param(sys,'Min step size', '0.0001')
set_param(sys,'Max step size', '.01')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')
set_param(sys,'Load callback','absdata');
set_param(sys,'AssignWideVectorLines','on');

add_block('built-in/Note',[sys,'/','ABS Braking Model'])
set_param([sys,'/','ABS Braking Model'],...
		'Font Name','helvetica',...
		'Font Weight','bold',...
		'Font Angle','oblique',...
		'Font Size',18,...
		'position',[295,10,300,15])

add_block('built-in/Gain',[sys,'/','W'])
set_param([sys,'/','W'],...
		'Gain','m*g/4',...
		'position',[190,183,235,217])

add_block('built-in/Gain',[sys,'/','Rr'])
set_param([sys,'/','Rr'],...
		'orientation',3,...
		'Gain','Rr',...
		'position',[235,125,275,160])

add_block('built-in/Mux',[sys,'/','Mux1'])
set_param([sys,'/','Mux1'],...
		'hide name',0,...
		'inputs','2',...
		'position',[505,120,540,155])

add_block('built-in/Scope',[sys,'/',['Vehicle and ',13,'wheel speed']])
set_param([sys,'/',['Vehicle and ',13,'wheel speed']],...
		'Vgain','100.000000',...
		'Hgain','20.000000',...
		'Vmax','200.000000',...
		'Hmax','40.000000',...
		'Window',[650,1,1023,436],...
		'position',[560,125,590,155])

add_block('built-in/Scope',[sys,'/','slip'])
set_param([sys,'/','slip'],...
		'orientation',2,...
		'Vgain','1.000000',...
		'Hgain','20.000000',...
		'Vmax','2.000000',...
		'Hmax','40.000000',...
		'Window',[650,359,1023,766],...
		'position',[75,360,105,390])

add_block('built-in/Stop Simulation',[sys,'/','Stop Simulation'])
set_param([sys,'/','Stop Simulation'],...
		'orientation',2,...
		'hide name',0,...
		'position',[370,350,410,380])

add_block('built-in/Fcn',[sys,'/','Vehicle speed <=0'])
set_param([sys,'/','Vehicle speed <=0'],...
		'orientation',2,...
		'Expr','u(1)<=0',...
		'position',[455,352,505,378])


%     Subsystem  ['Bang-bang',13,'controller'].

new_system([sys,'/',['Bang-bang',13,'controller']])
set_param([sys,'/',['Bang-bang',13,'controller']],'Location',[159,417,467,586])

add_block('built-in/Outport',[sys,'/',['Bang-bang',13,'controller/out_1']])
set_param([sys,'/',['Bang-bang',13,'controller/out_1']],...
		'position',[265,70,285,90])

add_block('built-in/Inport',[sys,'/',['Bang-bang',13,'controller/in_1']])
set_param([sys,'/',['Bang-bang',13,'controller/in_1']],...
		'position',[35,30,55,50])

add_block('built-in/Relational Operator',[sys,'/',['Bang-bang',13,'controller/Relational',13,'Operator']])
set_param([sys,'/',['Bang-bang',13,'controller/Relational',13,'Operator']],...
		'Operator','>',...
		'position',[140,32,170,63])

add_block('built-in/Sum',[sys,'/',['Bang-bang',13,'controller/Sum']])
set_param([sys,'/',['Bang-bang',13,'controller/Sum']],...
		'inputs','+-',...
		'position',[215,64,235,91])

add_block('built-in/Relational Operator',[sys,'/',['Bang-bang',13,'controller/Relational',13,'Operator1']])
set_param([sys,'/',['Bang-bang',13,'controller/Relational',13,'Operator1']],...
		'Operator','<',...
		'position',[140,92,170,123])

add_block('built-in/Constant',[sys,'/',['Bang-bang',13,'controller/Constant']])
set_param([sys,'/',['Bang-bang',13,'controller/Constant']],...
		'Value','0',...
		'position',[65,105,85,125])
add_line([sys,'/',['Bang-bang',13,'controller']],[60,40;135,40])
add_line([sys,'/',['Bang-bang',13,'controller']],[95,40;95,100;135,100])
add_line([sys,'/',['Bang-bang',13,'controller']],[90,115;135,115])
add_line([sys,'/',['Bang-bang',13,'controller']],[110,115;110,55;135,55])
add_line([sys,'/',['Bang-bang',13,'controller']],[175,110;185,110;185,85;210,85])
add_line([sys,'/',['Bang-bang',13,'controller']],[175,50;185,50;185,70;210,70])
add_line([sys,'/',['Bang-bang',13,'controller']],[240,80;260,80])
set_param([sys,'/',['Bang-bang',13,'controller']],...
		'Mask Display','plot(-50,-50,50,50,[-50,50],[0,0],[0,0],[-50,50],[-40,0],[-30,-30],[0,40],[30,30])',...
		'Mask Type','Sign',...
		'Mask Dialogue','y = sign(x)')
set_param([sys,'/',['Bang-bang',13,'controller']],...
		'Mask Help','Sign Function:\n\t\t\ty = 1 if x > 0\n\t\t\ty = 0 if x = 0\n\t\t\ty = -1 if x < 0')


%     Finished composite block ['Bang-bang',13,'controller'].

set_param([sys,'/',['Bang-bang',13,'controller']],...
		'orientation',3,...
		'position',[20,175,50,205])

add_block('built-in/To Workspace',[sys,'/','To Workspace3'])
set_param([sys,'/','To Workspace3'],...
		'hide name',0,...
		'mat-name','time',...
		'buffer','10000',...
		'position',[540,45,590,65])

add_block('built-in/Clock',[sys,'/','Clock'])
set_param([sys,'/','Clock'],...
		'hide name',0,...
		'position',[490,45,510,65])

add_block('built-in/To Workspace',[sys,'/','To Workspace2'])
set_param([sys,'/','To Workspace2'],...
		'orientation',1,...
		'hide name',0,...
		'mat-name','slp',...
		'buffer','10000',...
		'position',[150,355,200,375])

add_block('built-in/Gain',[sys,'/','Ctrl'])
set_param([sys,'/','Ctrl'],...
		'orientation',2,...
		'Gain','ctrl',...
		'position',[50,275,80,305])

add_block('built-in/Constant',[sys,'/','Desired slip'])
set_param([sys,'/','Desired slip'],...
		'orientation',3,...
		'Value','.2',...
		'position',[12,320,38,345])

add_block('built-in/Gain',[sys,'/','1//Rr'])
set_param([sys,'/','1//Rr'],...
		'Gain','1/Rr',...
		'position',[425,182,465,218])

add_block('built-in/Gain',[sys,'/','1//I'])
set_param([sys,'/','1//I'],...
		'Gain','1/I',...
		'position',[345,68,375,102])

add_block('built-in/Gain',[sys,'/','PBrate'])
set_param([sys,'/','PBrate'],...
		'orientation',3,...
		'Gain','100',...
		'position',[17,120,53,150])

add_block('built-in/Look Up Table',[sys,'/',['mu-slip',13,'friction curve']])
set_param([sys,'/',['mu-slip',13,'friction curve']],...
		'Input_Values','slip',...
		'Output_Values','mu',...
		'position',[135,185,165,215])

add_block('built-in/Sum',[sys,'/','Sum1'])
set_param([sys,'/','Sum1'],...
		'orientation',3,...
		'hide name',0,...
		'inputs','+-',...
		'position',[19,235,46,260])

add_block('built-in/Integrator',[sys,'/','Distance'])
set_param([sys,'/','Distance'],...
		'position',[495,225,520,255])

add_block('built-in/Fcn',[sys,'/','Slip'])
set_param([sys,'/','Slip'],...
		'orientation',2,...
		'Expr','1.0 - u(2)/u(1)',...
		'position',[210,274,260,306])

add_block('built-in/Note',[sys,'/','Ww'])
set_param([sys,'/','Ww'],...
		'position',[455,295,460,300])

add_block('built-in/Note',[sys,'/','Wv'])
set_param([sys,'/','Wv'],...
		'position',[455,255,460,260])

add_block('built-in/Mux',[sys,'/','Mux'])
set_param([sys,'/','Mux'],...
		'orientation',2,...
		'hide name',0,...
		'inputs','2',...
		'position',[330,270,365,305])

add_block('built-in/To Workspace',[sys,'/','To Workspace'])
set_param([sys,'/','To Workspace'],...
		'orientation',2,...
		'hide name',0,...
		'mat-name','yout',...
		'buffer','10000',...
		'position',[150,385,200,405])

add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
		'hide name',0,...
		'inputs','-+',...
		'position',[280,75,300,95])

add_block('built-in/Note',[sys,'/','Ff'])
set_param([sys,'/','Ff'],...
		'position',[245,200,250,205])

add_block('built-in/Gain',[sys,'/','-1//m'])
set_param([sys,'/','-1//m'],...
		'Gain','-1/m',...
		'position',[280,178,320,222])


%     Subsystem  ['Wheel',13,'Speed'].

new_system([sys,'/',['Wheel',13,'Speed']])
set_param([sys,'/',['Wheel',13,'Speed']],'Location',[452,229,1117,789])

add_block('built-in/Saturation',[sys,'/',['Wheel',13,'Speed/Saturation']])
set_param([sys,'/',['Wheel',13,'Speed/Saturation']],...
		'Lower Limit','lower_limit',...
		'Upper Limit','upper_limit',...
		'position',[325,110,350,130])

add_block('built-in/Switch',[sys,'/',['Wheel',13,'Speed/Switch']])
set_param([sys,'/',['Wheel',13,'Speed/Switch']],...
		'Threshold','0.5',...
		'position',[110,80,135,160])

add_block('built-in/Integrator',[sys,'/',['Wheel',13,'Speed/Integrator']])
set_param([sys,'/',['Wheel',13,'Speed/Integrator']],...
		'Initial','X0',...
		'position',[165,99,200,141])

add_block('built-in/Constant',[sys,'/',['Wheel',13,'Speed/Constant2']])
set_param([sys,'/',['Wheel',13,'Speed/Constant2']],...
		'Value','0',...
		'position',[20,135,40,155])

add_block('built-in/Inport',[sys,'/',['Wheel',13,'Speed/Inport']])
set_param([sys,'/',['Wheel',13,'Speed/Inport']],...
		'position',[25,85,45,105])

add_block('built-in/Outport',[sys,'/',['Wheel',13,'Speed/Outport']])
set_param([sys,'/',['Wheel',13,'Speed/Outport']],...
		'position',[515,110,535,130])

add_block('built-in/Constant',[sys,'/',['Wheel',13,'Speed/Constant4']])
set_param([sys,'/',['Wheel',13,'Speed/Constant4']],...
		'hide name',0,...
		'Value','0',...
		'position',[355,425,375,445])

add_block('built-in/Constant',[sys,'/',['Wheel',13,'Speed/Constant3']])
set_param([sys,'/',['Wheel',13,'Speed/Constant3']],...
		'hide name',0,...
		'Value','0',...
		'position',[355,260,375,280])

add_block('built-in/Logical Operator',[sys,'/',['Wheel',13,'Speed/Logical',13,'Operator']])
set_param([sys,'/',['Wheel',13,'Speed/Logical',13,'Operator']],...
		'hide name',0,...
		'Operator','AND',...
		'position',[570,280,605,315])

add_block('built-in/Logical Operator',[sys,'/',['Wheel',13,'Speed/Logical',13,'Operator2']])
set_param([sys,'/',['Wheel',13,'Speed/Logical',13,'Operator2']],...
		'hide name',0,...
		'Operator','OR',...
		'position',[490,360,525,395])

add_block('built-in/Logical Operator',[sys,'/',['Wheel',13,'Speed/Logical',13,'Operator1']])
set_param([sys,'/',['Wheel',13,'Speed/Logical',13,'Operator1']],...
		'hide name',0,...
		'Operator','OR',...
		'position',[490,200,525,235])

add_block('built-in/Relational Operator',[sys,'/',['Wheel',13,'Speed/Relational',13,'operator2']])
set_param([sys,'/',['Wheel',13,'Speed/Relational',13,'operator2']],...
		'hide name',0,...
		'Operator','<=',...
		'position',[415,231,445,284])

add_block('built-in/Relational Operator',[sys,'/',['Wheel',13,'Speed/Relational',13,'operator3']])
set_param([sys,'/',['Wheel',13,'Speed/Relational',13,'operator3']],...
		'hide name',0,...
		'position',[415,396,445,449])

add_block('built-in/Constant',[sys,'/',['Wheel',13,'Speed/Constant1']])
set_param([sys,'/',['Wheel',13,'Speed/Constant1']],...
		'hide name',0,...
		'Value','lower_limit',...
		'position',[325,345,390,365])

add_block('built-in/Relational Operator',[sys,'/',['Wheel',13,'Speed/Relational',13,'operator1']])
set_param([sys,'/',['Wheel',13,'Speed/Relational',13,'operator1']],...
		'hide name',0,...
		'position',[415,312,445,368])

add_block('built-in/Constant',[sys,'/',['Wheel',13,'Speed/Constant']])
set_param([sys,'/',['Wheel',13,'Speed/Constant']],...
		'hide name',0,...
		'Value','upper_limit',...
		'position',[325,179,395,201])

add_block('built-in/Relational Operator',[sys,'/',['Wheel',13,'Speed/Relational',13,'operator']])
set_param([sys,'/',['Wheel',13,'Speed/Relational',13,'operator']],...
		'hide name',0,...
		'Operator','<=',...
		'position',[415,151,445,204])
add_line([sys,'/',['Wheel',13,'Speed']],[355,120;510,120])
add_line([sys,'/',['Wheel',13,'Speed']],[205,120;320,120])
add_line([sys,'/',['Wheel',13,'Speed']],[50,95;105,95])
add_line([sys,'/',['Wheel',13,'Speed']],[65,95;65,245;410,245])
add_line([sys,'/',['Wheel',13,'Speed']],[65,245;65,410;410,410])
add_line([sys,'/',['Wheel',13,'Speed']],[140,120;160,120])
add_line([sys,'/',['Wheel',13,'Speed']],[400,190;410,190])
add_line([sys,'/',['Wheel',13,'Speed']],[395,355;410,355])
add_line([sys,'/',['Wheel',13,'Speed']],[610,300;625,300;625,490;85,490;85,120;105,120])
add_line([sys,'/',['Wheel',13,'Speed']],[45,145;105,145])
add_line([sys,'/',['Wheel',13,'Speed']],[450,180;465,180;465,210;485,210])
add_line([sys,'/',['Wheel',13,'Speed']],[450,260;465,260;465,225;485,225])
add_line([sys,'/',['Wheel',13,'Speed']],[530,220;540,220;540,290;565,290])
add_line([sys,'/',['Wheel',13,'Speed']],[450,340;460,340;460,370;485,370])
add_line([sys,'/',['Wheel',13,'Speed']],[450,425;460,425;460,385;485,385])
add_line([sys,'/',['Wheel',13,'Speed']],[530,380;540,380;540,305;565,305])
add_line([sys,'/',['Wheel',13,'Speed']],[380,270;410,270])
add_line([sys,'/',['Wheel',13,'Speed']],[380,435;410,435])
add_line([sys,'/',['Wheel',13,'Speed']],[205,120;245,120;245,165;315,165;315,325;410,325])
add_line([sys,'/',['Wheel',13,'Speed']],[315,165;410,165])
set_param([sys,'/',['Wheel',13,'Speed']],...
		'Mask Display','plot(-1,-0.2,3.5,1.2,[0.05,1,2,2.9],[0,0,1,1]); 1/s    ',...
		'Mask Type','Limited Integrator.',...
		'Mask Dialogue','Limited Integrator|Lower bound:|Upper bound:|Initial condition:')
set_param([sys,'/',['Wheel',13,'Speed']],...
		'Mask Translate','lower_limit=@1;upper_limit=@2;X0=@3;')
set_param([sys,'/',['Wheel',13,'Speed']],...
		'Mask Help','Implements a limited integrator with \nan expression of the form:\n\nif(x<=lb and u<0) or (x>=ub and u>0)\n   xdot=0\nelse\n   xdot=u',...
		'Mask Entries','0\/1000\/v0/Rr\/')


%     Finished composite block ['Wheel',13,'Speed'].

set_param([sys,'/',['Wheel',13,'Speed']],...
		'position',[405,70,445,100])


%     Subsystem  ['Vehicle',13,'speed'].

new_system([sys,'/',['Vehicle',13,'speed']])
set_param([sys,'/',['Vehicle',13,'speed']],'Location',[115,42,780,588])

add_block('built-in/Relational Operator',[sys,'/',['Vehicle',13,'speed/Relational',13,'operator']])
set_param([sys,'/',['Vehicle',13,'speed/Relational',13,'operator']],...
		'hide name',0,...
		'Operator','<=',...
		'position',[415,151,445,204])

add_block('built-in/Constant',[sys,'/',['Vehicle',13,'speed/Constant']])
set_param([sys,'/',['Vehicle',13,'speed/Constant']],...
		'hide name',0,...
		'Value','upper_limit',...
		'position',[325,179,395,201])

add_block('built-in/Relational Operator',[sys,'/',['Vehicle',13,'speed/Relational',13,'operator1']])
set_param([sys,'/',['Vehicle',13,'speed/Relational',13,'operator1']],...
		'hide name',0,...
		'position',[415,312,445,368])

add_block('built-in/Constant',[sys,'/',['Vehicle',13,'speed/Constant1']])
set_param([sys,'/',['Vehicle',13,'speed/Constant1']],...
		'hide name',0,...
		'Value','lower_limit',...
		'position',[325,345,390,365])

add_block('built-in/Relational Operator',[sys,'/',['Vehicle',13,'speed/Relational',13,'operator3']])
set_param([sys,'/',['Vehicle',13,'speed/Relational',13,'operator3']],...
		'hide name',0,...
		'position',[415,396,445,449])

add_block('built-in/Relational Operator',[sys,'/',['Vehicle',13,'speed/Relational',13,'operator2']])
set_param([sys,'/',['Vehicle',13,'speed/Relational',13,'operator2']],...
		'hide name',0,...
		'Operator','<=',...
		'position',[415,231,445,284])

add_block('built-in/Logical Operator',[sys,'/',['Vehicle',13,'speed/Logical',13,'Operator1']])
set_param([sys,'/',['Vehicle',13,'speed/Logical',13,'Operator1']],...
		'hide name',0,...
		'Operator','OR',...
		'position',[490,200,525,235])

add_block('built-in/Logical Operator',[sys,'/',['Vehicle',13,'speed/Logical',13,'Operator2']])
set_param([sys,'/',['Vehicle',13,'speed/Logical',13,'Operator2']],...
		'hide name',0,...
		'Operator','OR',...
		'position',[490,360,525,395])

add_block('built-in/Logical Operator',[sys,'/',['Vehicle',13,'speed/Logical',13,'Operator']])
set_param([sys,'/',['Vehicle',13,'speed/Logical',13,'Operator']],...
		'hide name',0,...
		'Operator','AND',...
		'position',[570,280,605,315])

add_block('built-in/Constant',[sys,'/',['Vehicle',13,'speed/Constant3']])
set_param([sys,'/',['Vehicle',13,'speed/Constant3']],...
		'hide name',0,...
		'Value','0',...
		'position',[355,260,375,280])

add_block('built-in/Constant',[sys,'/',['Vehicle',13,'speed/Constant4']])
set_param([sys,'/',['Vehicle',13,'speed/Constant4']],...
		'hide name',0,...
		'Value','0',...
		'position',[355,425,375,445])

add_block('built-in/Outport',[sys,'/',['Vehicle',13,'speed/Outport']])
set_param([sys,'/',['Vehicle',13,'speed/Outport']],...
		'position',[515,110,535,130])

add_block('built-in/Inport',[sys,'/',['Vehicle',13,'speed/Inport']])
set_param([sys,'/',['Vehicle',13,'speed/Inport']],...
		'position',[25,85,45,105])

add_block('built-in/Constant',[sys,'/',['Vehicle',13,'speed/Constant2']])
set_param([sys,'/',['Vehicle',13,'speed/Constant2']],...
		'Value','0',...
		'position',[20,135,40,155])

add_block('built-in/Integrator',[sys,'/',['Vehicle',13,'speed/Integrator']])
set_param([sys,'/',['Vehicle',13,'speed/Integrator']],...
		'Initial','X0',...
		'position',[165,99,200,141])

add_block('built-in/Switch',[sys,'/',['Vehicle',13,'speed/Switch']])
set_param([sys,'/',['Vehicle',13,'speed/Switch']],...
		'Threshold','0.5',...
		'position',[110,80,135,160])

add_block('built-in/Saturation',[sys,'/',['Vehicle',13,'speed/Saturation']])
set_param([sys,'/',['Vehicle',13,'speed/Saturation']],...
		'Lower Limit','lower_limit',...
		'Upper Limit','upper_limit',...
		'position',[325,110,350,130])
add_line([sys,'/',['Vehicle',13,'speed']],[205,120;245,120;245,165;315,165;315,325;410,325])
add_line([sys,'/',['Vehicle',13,'speed']],[315,165;410,165])
add_line([sys,'/',['Vehicle',13,'speed']],[380,435;410,435])
add_line([sys,'/',['Vehicle',13,'speed']],[380,270;410,270])
add_line([sys,'/',['Vehicle',13,'speed']],[530,380;540,380;540,305;565,305])
add_line([sys,'/',['Vehicle',13,'speed']],[450,425;460,425;460,385;485,385])
add_line([sys,'/',['Vehicle',13,'speed']],[450,340;460,340;460,370;485,370])
add_line([sys,'/',['Vehicle',13,'speed']],[530,220;540,220;540,290;565,290])
add_line([sys,'/',['Vehicle',13,'speed']],[450,260;465,260;465,225;485,225])
add_line([sys,'/',['Vehicle',13,'speed']],[450,180;465,180;465,210;485,210])
add_line([sys,'/',['Vehicle',13,'speed']],[45,145;105,145])
add_line([sys,'/',['Vehicle',13,'speed']],[610,300;625,300;625,490;85,490;85,120;105,120])
add_line([sys,'/',['Vehicle',13,'speed']],[395,355;410,355])
add_line([sys,'/',['Vehicle',13,'speed']],[400,190;410,190])
add_line([sys,'/',['Vehicle',13,'speed']],[140,120;160,120])
add_line([sys,'/',['Vehicle',13,'speed']],[50,95;105,95])
add_line([sys,'/',['Vehicle',13,'speed']],[65,95;65,245;410,245])
add_line([sys,'/',['Vehicle',13,'speed']],[65,245;65,410;410,410])
add_line([sys,'/',['Vehicle',13,'speed']],[205,120;320,120])
add_line([sys,'/',['Vehicle',13,'speed']],[355,120;510,120])
set_param([sys,'/',['Vehicle',13,'speed']],...
		'Mask Display','plot(-1,-0.2,3.5,1.2,[0.05,1,2,2.9],[0,0,1,1]); 1/s    ',...
		'Mask Type','Limited Integrator.')
set_param([sys,'/',['Vehicle',13,'speed']],...
		'Mask Dialogue','Limited Integrator|Lower bound:|Upper bound:|Initial condition:',...
		'Mask Translate','lower_limit=@1;upper_limit=@2;X0=@3;')
set_param([sys,'/',['Vehicle',13,'speed']],...
		'Mask Help','Implements a limited integrator with \nan expression of the form:\n\nif(x<=lb and u<0) or (x>=ub and u>0)\n   xdot=0\nelse\n   xdot=u',...
		'Mask Entries','0\/1000\/v0\/')


%     Finished composite block ['Vehicle',13,'speed'].

set_param([sys,'/',['Vehicle',13,'speed']],...
		'position',[350,185,390,215])

add_block('built-in/Transfer Fcn',[sys,'/','Lag '])
set_param([sys,'/','Lag '],...
		'Denominator','[TB 1]',...
		'position',[145,55,195,105])


%     Subsystem  ['Break',13,'pressure'].

new_system([sys,'/',['Break',13,'pressure']])
set_param([sys,'/',['Break',13,'pressure']],'Location',[452,229,1117,789])

add_block('built-in/Saturation',[sys,'/',['Break',13,'pressure/Saturation']])
set_param([sys,'/',['Break',13,'pressure/Saturation']],...
		'Lower Limit','lower_limit',...
		'Upper Limit','upper_limit',...
		'position',[325,110,350,130])

add_block('built-in/Switch',[sys,'/',['Break',13,'pressure/Switch']])
set_param([sys,'/',['Break',13,'pressure/Switch']],...
		'Threshold','0.5',...
		'position',[110,80,135,160])

add_block('built-in/Integrator',[sys,'/',['Break',13,'pressure/Integrator']])
set_param([sys,'/',['Break',13,'pressure/Integrator']],...
		'Initial','X0',...
		'position',[165,99,200,141])

add_block('built-in/Constant',[sys,'/',['Break',13,'pressure/Constant2']])
set_param([sys,'/',['Break',13,'pressure/Constant2']],...
		'Value','0',...
		'position',[20,135,40,155])

add_block('built-in/Inport',[sys,'/',['Break',13,'pressure/Inport']])
set_param([sys,'/',['Break',13,'pressure/Inport']],...
		'position',[25,85,45,105])

add_block('built-in/Outport',[sys,'/',['Break',13,'pressure/Outport']])
set_param([sys,'/',['Break',13,'pressure/Outport']],...
		'position',[515,110,535,130])

add_block('built-in/Constant',[sys,'/',['Break',13,'pressure/Constant4']])
set_param([sys,'/',['Break',13,'pressure/Constant4']],...
		'hide name',0,...
		'Value','0',...
		'position',[355,425,375,445])

add_block('built-in/Constant',[sys,'/',['Break',13,'pressure/Constant3']])
set_param([sys,'/',['Break',13,'pressure/Constant3']],...
		'hide name',0,...
		'Value','0',...
		'position',[355,260,375,280])

add_block('built-in/Logical Operator',[sys,'/',['Break',13,'pressure/Logical',13,'Operator']])
set_param([sys,'/',['Break',13,'pressure/Logical',13,'Operator']],...
		'hide name',0,...
		'Operator','AND',...
		'position',[570,280,605,315])

add_block('built-in/Logical Operator',[sys,'/',['Break',13,'pressure/Logical',13,'Operator2']])
set_param([sys,'/',['Break',13,'pressure/Logical',13,'Operator2']],...
		'hide name',0,...
		'Operator','OR',...
		'position',[490,360,525,395])

add_block('built-in/Logical Operator',[sys,'/',['Break',13,'pressure/Logical',13,'Operator1']])
set_param([sys,'/',['Break',13,'pressure/Logical',13,'Operator1']],...
		'hide name',0,...
		'Operator','OR',...
		'position',[490,200,525,235])

add_block('built-in/Relational Operator',[sys,'/',['Break',13,'pressure/Relational',13,'operator2']])
set_param([sys,'/',['Break',13,'pressure/Relational',13,'operator2']],...
		'hide name',0,...
		'Operator','<=',...
		'position',[415,231,445,284])

add_block('built-in/Relational Operator',[sys,'/',['Break',13,'pressure/Relational',13,'operator3']])
set_param([sys,'/',['Break',13,'pressure/Relational',13,'operator3']],...
		'hide name',0,...
		'position',[415,396,445,449])

add_block('built-in/Constant',[sys,'/',['Break',13,'pressure/Constant1']])
set_param([sys,'/',['Break',13,'pressure/Constant1']],...
		'hide name',0,...
		'Value','lower_limit',...
		'position',[325,345,390,365])

add_block('built-in/Relational Operator',[sys,'/',['Break',13,'pressure/Relational',13,'operator1']])
set_param([sys,'/',['Break',13,'pressure/Relational',13,'operator1']],...
		'hide name',0,...
		'position',[415,312,445,368])

add_block('built-in/Constant',[sys,'/',['Break',13,'pressure/Constant']])
set_param([sys,'/',['Break',13,'pressure/Constant']],...
		'hide name',0,...
		'Value','upper_limit',...
		'position',[325,179,395,201])

add_block('built-in/Relational Operator',[sys,'/',['Break',13,'pressure/Relational',13,'operator']])
set_param([sys,'/',['Break',13,'pressure/Relational',13,'operator']],...
		'hide name',0,...
		'Operator','<=',...
		'position',[415,151,445,204])
add_line([sys,'/',['Break',13,'pressure']],[355,120;510,120])
add_line([sys,'/',['Break',13,'pressure']],[205,120;320,120])
add_line([sys,'/',['Break',13,'pressure']],[50,95;105,95])
add_line([sys,'/',['Break',13,'pressure']],[65,95;65,245;410,245])
add_line([sys,'/',['Break',13,'pressure']],[65,245;65,410;410,410])
add_line([sys,'/',['Break',13,'pressure']],[140,120;160,120])
add_line([sys,'/',['Break',13,'pressure']],[400,190;410,190])
add_line([sys,'/',['Break',13,'pressure']],[395,355;410,355])
add_line([sys,'/',['Break',13,'pressure']],[610,300;625,300;625,490;85,490;85,120;105,120])
add_line([sys,'/',['Break',13,'pressure']],[45,145;105,145])
add_line([sys,'/',['Break',13,'pressure']],[450,180;465,180;465,210;485,210])
add_line([sys,'/',['Break',13,'pressure']],[450,260;465,260;465,225;485,225])
add_line([sys,'/',['Break',13,'pressure']],[530,220;540,220;540,290;565,290])
add_line([sys,'/',['Break',13,'pressure']],[450,340;460,340;460,370;485,370])
add_line([sys,'/',['Break',13,'pressure']],[450,425;460,425;460,385;485,385])
add_line([sys,'/',['Break',13,'pressure']],[530,380;540,380;540,305;565,305])
add_line([sys,'/',['Break',13,'pressure']],[380,270;410,270])
add_line([sys,'/',['Break',13,'pressure']],[380,435;410,435])
add_line([sys,'/',['Break',13,'pressure']],[205,120;245,120;245,165;315,165;315,325;410,325])
add_line([sys,'/',['Break',13,'pressure']],[315,165;410,165])
set_param([sys,'/',['Break',13,'pressure']],...
		'Mask Display','plot(-1,-0.2,3.5,1.2,[0.05,1,2,2.9],[0,0,1,1]); 1/s    ',...
		'Mask Type','Limited Integrator.')
set_param([sys,'/',['Break',13,'pressure']],...
		'Mask Dialogue','Limited Integrator|Lower bound:|Upper bound:|Initial condition:',...
		'Mask Translate','lower_limit=@1;upper_limit=@2;X0=@3;')
set_param([sys,'/',['Break',13,'pressure']],...
		'Mask Help','Implements a limited integrator with \nan expression of the form:\n\nif(x<=lb and u<0) or (x>=ub and u>0)\n   xdot=0\nelse\n   xdot=u',...
		'Mask Entries','0\/PBmax\/0\/')


%     Finished composite block ['Break',13,'pressure'].

set_param([sys,'/',['Break',13,'pressure']],...
		'position',[70,65,110,95])

add_block('built-in/To Workspace',[sys,'/','To Workspace1'])
set_param([sys,'/','To Workspace1'],...
		'orientation',1,...
		'hide name',0,...
		'mat-name','distance',...
		'buffer','10000',...
		'position',[555,315,605,335])

add_block('built-in/Note',[sys,'/',['Developed by Larry Michaels',13,'The MathWorks, Inc',13,'']])
set_param([sys,'/',['Developed by Larry Michaels',13,'The MathWorks, Inc',13,'']],...
		'position',[515,420,520,425])


%     Subsystem  'run it'.

new_system([sys,'/','run it'])
set_param([sys,'/','run it'],'Location',[90,578,225,691])
set_param([sys,'/','run it'],...
		'Mask Display','Double click\nto run model',...
		'Mask Dialogue','eval(''runabs;'')')


%     Finished composite block 'run it'.

set_param([sys,'/','run it'],...
		'BackGround',5,...
		'hide name',0,...
		'position',[266,421,360,460])
add_line(sys,[325,200;345,200])
add_line(sys,[380,85;400,85])
add_line(sys,[305,85;340,85])
add_line(sys,[255,120;255,90;275,90])
add_line(sys,[240,200;275,200])
add_line(sys,[170,200;185,200])
add_line(sys,[205,290;110,290;110,200;130,200])
add_line(sys,[325,290;265,290])
add_line(sys,[200,80;275,80])
add_line(sys,[115,80;140,80])
add_line(sys,[395,200;420,200])
add_line(sys,[135,290;135,375;110,375])
add_line(sys,[545,140;555,140])
add_line(sys,[450,85;615,85;615,295;370,295])
add_line(sys,[470,85;470,130;500,130])
add_line(sys,[450,365;415,365])
add_line(sys,[470,200;540,200;540,365;510,365])
add_line(sys,[540,280;370,280])
add_line(sys,[300,290;300,395;205,395])
add_line(sys,[405,200;405,240;490,240])
add_line(sys,[525,240;580,240;580,310])
add_line(sys,[25,315;25,265])
add_line(sys,[35,230;35,210])
add_line(sys,[35,170;35,155])
add_line(sys,[35,115;35,80;65,80])
add_line(sys,[45,290;40,290;40,265])
add_line(sys,[110,290;85,290])
add_line(sys,[175,290;175,350])
add_line(sys,[515,55;535,55])
add_line(sys,[485,200;485,145;500,145])
add_line(sys,[240,200;255,200;255,165])

drawnow

% Return any arguments.
if (nargin | nargout)
	% Must use feval here to access system in memory
	if (nargin > 3)
		if (flag == 0)
			eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
		else
			eval(['ret =', sys,'(t,x,u,flag);'])
		end
	else
		[ret,x0,str,ts,xts] = feval(sys);
	end
else
	drawnow % Flash up the model and execute load callback
end
