function [ret,x0,str,ts,xts]=hydcyl4(t,x,u,flag);
%HYDCYL4	is the M-file description of the SIMULINK system named HYDCYL4.
%	The block-diagram can be displayed by typing: HYDCYL4.
%
%	SYS=HYDCYL4(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 HYDCYL4 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 HYDCYL4 with a FLAG of zero:
%	[SIZES]=HYDCYL4([],[],[],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',[240,133,839,674])
     open_system(sys)
end;
set_param(sys,'algorithm',     'RK-45')
set_param(sys,'Start time',    '1e-5')
set_param(sys,'Stop time',     '0.1')
set_param(sys,'Min step size', '0.0001')
set_param(sys,'Max step size', '0.005')
set_param(sys,'Relative error','1e-4')
set_param(sys,'Return vars',   '')

add_block('built-in/Note',[sys,'/','4 CYLINDER MODEL'])
set_param([sys,'/','4 CYLINDER MODEL'],...
		'Font Name','helvetica',...
		'Font Weight','bold',...
		'Font Angle','oblique',...
		'Font Size',18,...
		'position',[290,10,295,15])

add_block('built-in/From Workspace',[sys,'/','Q'])
set_param([sys,'/','Q'],...
		'matl_expr','[T'', Q'']',...
		'Mask Display','plot(T,Q)',...
		'Mask Type','Look-up Table',...
		'Mask Dialogue','Input Flow|Time Values (t):|Flow Values(Q):',...
		'Mask Translate','T=@1;Q=@2;')
set_param([sys,'/','Q'],...
		'Mask Entries','[0        .04     .04     .05    .05     .1]\/[.125   .125     0        0    .125    .125]\/',...
		'position',[45,62,85,88])

add_block('built-in/Gain',[sys,'/','Gain2'])
set_param([sys,'/','Gain2'],...
		'hide name',0,...
		'Gain','0.9',...
		'position',[220,202,250,238])

add_block('built-in/Gain',[sys,'/','Gain1'])
set_param([sys,'/','Gain1'],...
		'hide name',0,...
		'Gain','0.9',...
		'position',[220,152,250,188])

add_block('built-in/Gain',[sys,'/','Gain3'])
set_param([sys,'/','Gain3'],...
		'hide name',0,...
		'Gain','0.9',...
		'position',[210,397,240,433])

add_block('built-in/Gain',[sys,'/','Gain4'])
set_param([sys,'/','Gain4'],...
		'hide name',0,...
		'Gain','0.9',...
		'position',[210,357,240,393])

add_block('built-in/Constant',[sys,'/','Constant'])
set_param([sys,'/','Constant'],...
		'hide name',0,...
		'Value','0.125',...
		'position',[155,265,190,285])


%     Subsystem  ['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)'].

new_system([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']])
set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)/x']])
set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)/x']],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfunyst',...
		'parameters','ax, color, npts, dt',...
		'position',[130,55,180,75])
add_line([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']],[90,65;125,65])
set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']],...
		'Mask Display','plot(0,0,100,100,[83,76,63,52,42,38,28,16,11,84,11,11,11,90,90,11],[75,58,47,54,72,80,84,74,65,65,65,90,40,40,90,90])')
set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']],...
		'Mask Type','Storage scope.')
set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']],...
		'Mask Dialogue','Storage scope using MATLAB graph window.\nEnter plotting ranges and line type.|Initial Time Range:|Initial y-min:|Initial y-max:|Storage pts.:|Line type (rgbw-.:xo):')
set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']],...
		'Mask Translate','npts = @4; color = @5; ax = [0, @1, @2, @3]; dt=-1;')
set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']],...
		'Mask Help','This block uses a MATLAB figure window to plot the input signal.  The graph limits are automatically scaled to the min and max values of the signal stored in the scope''s signal buffer.  Line type must be in quotes.  See the M-file sfunyst.m.')
set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']],...
		'Mask Entries','0.1\/0\/7e6\/200\/''y-/g-/r-/w-/m*/ro/b+''\/')


%     Finished composite block ['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)'].

set_param([sys,'/',['p3a(yel)',13,'p3b(green)',13,'p3c(red)',13,'p3d(white)']],...
		'position',[510,375,540,415])

add_block('built-in/Mux',[sys,'/','Mux'])
set_param([sys,'/','Mux'],...
		'hide name',0,...
		'position',[440,63,475,132])


%     Subsystem  ['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)'].

new_system([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']])
set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']],'Location',[0,59,274,252])

add_block('built-in/S-Function',[sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfunyst',...
		'parameters','ax, color, npts, dt',...
		'position',[130,55,180,75])

add_block('built-in/Inport',[sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)/x']])
set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)/x']],...
		'position',[65,55,85,75])
add_line([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']],[90,65;125,65])
set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']],...
		'Mask Display','plot(0,0,100,100,[83,76,63,52,42,38,28,16,11,84,11,11,11,90,90,11],[75,58,47,54,72,80,84,74,65,65,65,90,40,40,90,90])')
set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']],...
		'Mask Type','Storage scope.')
set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']],...
		'Mask Dialogue','Storage scope using MATLAB graph window.\nEnter plotting ranges and line type.|Initial Time Range:|Initial y-min:|Initial y-max:|Storage pts.:|Line type (rgbw-.:xo):')
set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']],...
		'Mask Translate','npts = @4; color = @5; ax = [0, @1, @2, @3]; dt=-1;')
set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']],...
		'Mask Help','This block uses a MATLAB figure window to plot the input signal.  The graph limits are automatically scaled to the min and max values of the signal stored in the scope''s signal buffer.  Line type must be in quotes.  See the M-file sfunyst.m.')
set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']],...
		'Mask Entries','0.1\/-0.05\/0.05\/200\/''y-/g-/r-/w-/m*/ro/b+''\/')


%     Finished composite block ['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)'].

set_param([sys,'/',['q1a(yel)',13,'q1b(green)',13,'q1c(red)',13,'q1d(white)']],...
		'position',[500,80,530,120])

add_block('built-in/Mux',[sys,'/','Mux1'])
set_param([sys,'/','Mux1'],...
		'hide name',0,...
		'position',[450,358,485,427])


%     Subsystem  'A'.

new_system([sys,'/','A'])
set_param([sys,'/','A'],'Location',[204,439,481,575])

add_block('built-in/Clock',[sys,'/','A/Clock'])
set_param([sys,'/','A/Clock'],...
		'position',[40,40,60,60])

add_block('built-in/Gain',[sys,'/','A/Gain'])
set_param([sys,'/','A/Gain'],...
		'hide name',0,...
		'Gain','0.03',...
		'position',[95,32,150,68])

add_block('built-in/Outport',[sys,'/','A/A'])
set_param([sys,'/','A/A'],...
		'position',[205,40,225,60])
add_line([sys,'/','A'],[65,50;90,50])
add_line([sys,'/','A'],[155,50;200,50])
set_param([sys,'/','A'],...
		'Mask Display','plot(0,0,100,100,[98,0],[96,0])',...
		'Mask Type','Ramp')


%     Finished composite block 'A'.

set_param([sys,'/','A'],...
		'position',[40,221,80,249])


%     Subsystem  'Hit Crossing'.

new_system([sys,'/','Hit Crossing'])
set_param([sys,'/','Hit Crossing'],'Location',[90,259,548,551])

add_block('built-in/Note',[sys,'/',['Hit Crossing/Places discontinuity into integrator',13,'which slows the simulation down. ']])
set_param([sys,'/',['Hit Crossing/Places discontinuity into integrator',13,'which slows the simulation down. ']],...
		'position',[145,180,150,185])

add_block('built-in/Reset Integrator',[sys,'/',['Hit Crossing/Resetable',13,'Integrator',13,'to stop integral ',13,'wind-up']])
set_param([sys,'/',['Hit Crossing/Resetable',13,'Integrator',13,'to stop integral ',13,'wind-up']],...
		'position',[350,37,380,153])

add_block('built-in/Relational Operator',[sys,'/',['Hit Crossing/Relational',13,'Operator']])
set_param([sys,'/',['Hit Crossing/Relational',13,'Operator']],...
		'Operator','<',...
		'position',[190,37,220,68])

add_block('built-in/Gain',[sys,'/','Hit Crossing/Gain'])
set_param([sys,'/','Hit Crossing/Gain'],...
		'Gain','1/tol',...
		'position',[265,45,285,65])

add_block('built-in/Inport',[sys,'/','Hit Crossing/in_1'])
set_param([sys,'/','Hit Crossing/in_1'],...
		'position',[50,35,70,55])

add_block('built-in/Constant',[sys,'/','Hit Crossing/Constant1'])
set_param([sys,'/','Hit Crossing/Constant1'],...
		'Value','cross',...
		'position',[35,80,85,100])

add_block('built-in/Constant',[sys,'/','Hit Crossing/Constant'])
set_param([sys,'/','Hit Crossing/Constant'],...
		'Value','0',...
		'position',[235,125,285,145])
add_line([sys,'/','Hit Crossing'],[385,95;415,95;415,230;305,230;305,95;345,95])
add_line([sys,'/','Hit Crossing'],[290,135;345,135])
add_line([sys,'/','Hit Crossing'],[75,45;185,45])
add_line([sys,'/','Hit Crossing'],[290,55;345,55])
add_line([sys,'/','Hit Crossing'],[90,90;145,90;145,60;185,60])
add_line([sys,'/','Hit Crossing'],[225,55;260,55])
set_param([sys,'/','Hit Crossing'],...
		'Mask Display','plot(-0.2,-0.2,3.45,1.2,dvec,abs(cos(dvec)),[.6 2.5],[0 0])',...
		'Mask Type','Crossing')
set_param([sys,'/','Hit Crossing'],...
		'Mask Dialogue','Causes simulation to take smaller steps at the crossing value (for instance, near a discontinuity). |Crossing Value:|Tol: (typically square simulation tol)')
set_param([sys,'/','Hit Crossing'],...
		'Mask Translate','cross=@1; tol=@2;dvec=-.3:.03:(pi+.3);')
set_param([sys,'/','Hit Crossing'],...
		'Mask Help','This block causes the simulator to take smaller steps near a crossing point. Systems with discontinuities can be more accurately modeled with this block. Use in conjunction with derivative blocks to stop at rising or falling crossing points.')
set_param([sys,'/','Hit Crossing'],...
		'Mask Entries','0.01\/1e-4\/')


%     Finished composite block 'Hit Crossing'.

set_param([sys,'/','Hit Crossing'],...
		'position',[55,133,95,157])


%     Subsystem  'Subsystem2'.

new_system([sys,'/','Subsystem2'])
set_param([sys,'/','Subsystem2'],'Location',[486,613,757,820])
set_param([sys,'/','Subsystem2'],...
		'Mask Display','Double click to\nrun Simulation\nfor 0.1 seconds',...
		'Mask Type','Button')
set_param([sys,'/','Subsystem2'],...
		'Mask Dialogue','eval(''tout=rk45(get_param,[1e-5,0.1],[],[1e-4,1e-5,0.005]);set(gcf,''''position'''',get(gcf,''''position'''')+[50 -50 0 0]);'')')


%     Finished composite block 'Subsystem2'.

set_param([sys,'/','Subsystem2'],...
		'BackGround',5,...
		'hide name',0,...
		'position',[120,455,251,525])


%     Subsystem  'Subsystem1'.

new_system([sys,'/','Subsystem1'])
set_param([sys,'/','Subsystem1'],'Location',[486,613,757,820])
set_param([sys,'/','Subsystem1'],...
		'Mask Display','Double click to\nsee cylinder and rod\nmodel.',...
		'Mask Type','Button',...
		'Mask Dialogue','eval(''hydrod'');')


%     Finished composite block 'Subsystem1'.

set_param([sys,'/','Subsystem1'],...
		'BackGround',5,...
		'hide name',0,...
		'position',[315,455,446,525])


%     Subsystem  'Subsystem A'.

new_system([sys,'/','Subsystem A'])
set_param([sys,'/','Subsystem A'],'Location',[633,257,1020,485])

add_block('built-in/Note',[sys,'/',['Subsystem A/Unmask the Hydraulic Cylinder model',13,'block to see how the implicit loop was',13,'formed. Then Mask to recover last mask.']])
set_param([sys,'/',['Subsystem A/Unmask the Hydraulic Cylinder model',13,'block to see how the implicit loop was',13,'formed. Then Mask to recover last mask.']],...
		'position',[275,170,280,175])

add_block('built-in/Inport',[sys,'/','Subsystem A/Q'])
set_param([sys,'/','Subsystem A/Q'],...
		'position',[15,60,30,80])

add_block('built-in/Inport',[sys,'/','Subsystem A/A'])
set_param([sys,'/','Subsystem A/A'],...
		'Port','2',...
		'position',[15,125,30,145])


%     Subsystem  ['Subsystem A/Hydraulic ',13,'cylinder ',13,'model'].

new_system([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],'Location',[16,121,821,632])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume in cylinder']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume in cylinder']],...
		'position',[625,130,630,135])

add_block('built-in/Outport',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/V']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/V']],...
		'Port','6',...
		'position',[685,425,705,445])

add_block('built-in/Fcn',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume']],...
		'Expr','V0+Ac*u[1]',...
		'position',[580,426,655,444])

add_block('built-in/Outport',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p3']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p3']],...
		'orientation',1,...
		'Port','5',...
		'position',[465,475,485,495])

add_block('built-in/Gain',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/spring -x']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/spring -x']],...
		'Gain','Ac/K',...
		'position',[505,414,550,456])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/',13,'Modeled by Andy Grace,',13,'The MathWorks from equations ',13,'provided by General Motors.']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/',13,'Modeled by Andy Grace,',13,'The MathWorks from equations ',13,'provided by General Motors.']],...
		'position',[375,65,380,70])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Hydraulic Cylinder Model']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Hydraulic Cylinder Model']],...
		'Font Name','helvetica',...
		'Font Weight','bold',...
		'Font Angle','oblique',...
		'Font Size',18,...
		'position',[375,20,380,25])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Inputs:']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Inputs:']],...
		'position',[90,10,95,15])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Q-source flow']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Q-source flow']],...
		'position',[105,30,110,35])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/A-variable orifice area']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/A-variable orifice area']],...
		'position',[125,50,130,55])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Outputs:']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Outputs:']],...
		'position',[580,10,585,15])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p1-pressure upstream of orifice']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p1-pressure upstream of orifice']],...
		'position',[640,70,645,75])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q2-flow diverted to reservoir']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q2-flow diverted to reservoir']],...
		'position',[635,51,640,56])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p3-pressure in cylinder']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p3-pressure in cylinder']],...
		'position',[620,111,625,116])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p2-pressure downstream of orifice']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p2-pressure downstream of orifice']],...
		'position',[645,91,650,96])

add_block('built-in/Note',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1-flow to cylinder']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1-flow to cylinder']],...
		'position',[610,31,615,36])

add_block('built-in/Gain',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1=Clam1*(p2-p3)']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1=Clam1*(p2-p3)']],...
		'Gain','Clam1',...
		'position',[645,347,670,373])

add_block('built-in/Sum',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p2-p3']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p2-p3']],...
		'inputs','+-',...
		'position',[575,331,595,384])

add_block('built-in/Fcn',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/f(q1)']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/f(q1)']],...
		'Expr','(u[1]*u[1])*row/(2*Cd*u[2]*Cd*u[2])',...
		'position',[145,181,325,199])

add_block('built-in/Integrator',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/int p3']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/int p3']],...
		'Initial','1e-8',...
		'position',[405,425,425,445])

add_block('built-in/Fcn',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/f(q1,p3)']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/f(q1,p3)']],...
		'Expr','u[2]/(u[3]+(V0+u[3]*u[1])/beta)',...
		'position',[190,423,390,447])

add_block('built-in/Mux',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p3, q1']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p3, q1']],...
		'hide name',0,...
		'inputs','3',...
		'Mask Display','p3\nq1\nCon',...
		'position',[145,415,175,455])

add_block('built-in/Constant',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Constant']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Constant']],...
		'Value','Ac*Ac/K',...
		'position',[25,435,95,465])

add_block('built-in/Switch',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1>0?']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1>0?']],...
		'position',[420,224,450,256])

add_block('built-in/Gain',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/is flow going backwards?']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/is flow going backwards?']],...
		'Gain','-1',...
		'position',[350,237,375,263])

add_block('built-in/Mux',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1,A']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1,A']],...
		'hide name',0,...
		'inputs','2',...
		'Mask Display','q1\n\nA',...
		'position',[110,163,125,212])

add_block('built-in/Inport',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/A']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/A']],...
		'Port','2',...
		'position',[45,190,60,210])

add_block('built-in/Gain',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p1=q2//Clam2']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p1=q2//Clam2']],...
		'Gain','1/Clam2',...
		'position',[205,303,280,337])

add_block('built-in/Sum',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q2=Q-q1']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q2=Q-q1']],...
		'inputs','-+',...
		'position',[135,294,155,341])

add_block('built-in/Inport',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Q']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/Q']],...
		'position',[35,320,50,340])

add_block('built-in/Sum',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p2=p1+-f(q1)']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p2=p1+-f(q1)']],...
		'inputs','-+',...
		'position',[490,264,510,311])

add_block('built-in/Outport',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q2']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q2']],...
		'Port','2',...
		'position',[190,250,210,270])

add_block('built-in/Outport',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p1']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p1']],...
		'Port','3',...
		'position',[420,310,440,330])

add_block('built-in/Outport',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/q1']],...
		'position',[760,220,780,240])

add_block('built-in/Outport',[sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p2']])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model/p2']],...
		'Port','4',...
		'position',[565,280,585,300])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[660,435;680,435])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[555,435;575,435])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[430,435;500,435])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,150;85,150;85,305;130,305])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[85,175;105,175])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[515,290;536,290;536,345;570,345])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[535,290;560,290])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,150;385,150;385,240;415,240])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,230;755,230])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,505;120,505;120,435;140,435])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[160,320;200,320])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[175,320;185,260])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[285,320;381,320;381,300;485,300])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[380,320;415,320])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[55,330;130,330])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[330,190;405,190;415,230])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[380,250;415,250])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[600,360;640,360])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[430,435;466,435;466,370;570,370])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[330,190;335,190;345,250])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[430,435;475,435;475,470])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[430,435;441,435;441,363;121,363;121,420;140,420])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[395,435;400,435])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[180,435;185,435])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[100,450;140,450])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[455,240;466,240;466,275;485,275])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[130,190;140,190])
add_line([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],[65,200;105,200])
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Display','   q1\n\n   q2\n\n   p1\n\n   p2\n\n   p3\n\n   V',...
		'Mask Type','Hydraulic cylinder')
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Dialogue','Hydraulic cylinder model|Cd:|row:|[Clam1,Clam2]:|beta:|Ac:|[K,V0]:')
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Translate','Cd = @1; row = @2; Clam1 = @3(1); Clam2 = @3(2); beta = @4; Ac = @5; K = @6(1); V0 = @6(2);')
set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Entries','0.61\/800\/[2e-7,3e-8]\/700e6\/0.01\/[500000, 0.025]\/')


%     Finished composite block ['Subsystem A/Hydraulic ',13,'cylinder ',13,'model'].

set_param([sys,'/',['Subsystem A/Hydraulic ',13,'cylinder ',13,'model']],...
		'position',[105,35,145,165])

add_block('built-in/Outport',[sys,'/','Subsystem A/q1'])
set_param([sys,'/','Subsystem A/q1'],...
		'position',[255,40,275,60])

add_block('built-in/Outport',[sys,'/','Subsystem A/p3'])
set_param([sys,'/','Subsystem A/p3'],...
		'Port','2',...
		'position',[255,120,275,140])
add_line([sys,'/','Subsystem A'],[150,130;250,130])
add_line([sys,'/','Subsystem A'],[150,50;250,50])
add_line([sys,'/','Subsystem A'],[35,135;100,135])
add_line([sys,'/','Subsystem A'],[35,70;100,70])
set_param([sys,'/','Subsystem A'],...
		'Mask Display','plot(0,0,100,100,[90,47,70,70,90,47,47,47,10],[10,10,10,90,90,90,50,50,50],[47,47],[50,10])')


%     Finished composite block 'Subsystem A'.

set_param([sys,'/','Subsystem A'],...
		'position',[280,62,315,113])


%     Subsystem  'Subsystem B'.

new_system([sys,'/','Subsystem B'])
set_param([sys,'/','Subsystem B'],'Location',[633,257,1020,485])

add_block('built-in/Outport',[sys,'/','Subsystem B/p3'])
set_param([sys,'/','Subsystem B/p3'],...
		'Port','2',...
		'position',[255,120,275,140])

add_block('built-in/Outport',[sys,'/','Subsystem B/q1'])
set_param([sys,'/','Subsystem B/q1'],...
		'position',[255,40,275,60])


%     Subsystem  ['Subsystem B/Hydraulic ',13,'cylinder ',13,'model'].

new_system([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],'Location',[16,121,821,632])

add_block('built-in/Outport',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p2']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p2']],...
		'Port','4',...
		'position',[565,280,585,300])

add_block('built-in/Outport',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1']],...
		'position',[760,220,780,240])

add_block('built-in/Outport',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p1']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p1']],...
		'Port','3',...
		'position',[420,310,440,330])

add_block('built-in/Outport',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q2']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q2']],...
		'Port','2',...
		'position',[190,250,210,270])

add_block('built-in/Sum',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p2=p1+-f(q1)']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p2=p1+-f(q1)']],...
		'inputs','-+',...
		'position',[490,264,510,311])

add_block('built-in/Inport',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Q']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Q']],...
		'position',[35,320,50,340])

add_block('built-in/Sum',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q2=Q-q1']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q2=Q-q1']],...
		'inputs','-+',...
		'position',[135,294,155,341])

add_block('built-in/Gain',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p1=q2//Clam2']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p1=q2//Clam2']],...
		'Gain','1/Clam2',...
		'position',[205,303,280,337])

add_block('built-in/Inport',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/A']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/A']],...
		'Port','2',...
		'position',[45,190,60,210])

add_block('built-in/Mux',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1,A']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1,A']],...
		'hide name',0,...
		'inputs','2',...
		'Mask Display','q1\n\nA',...
		'position',[110,163,125,212])

add_block('built-in/Gain',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/is flow going backwards?']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/is flow going backwards?']],...
		'Gain','-1',...
		'position',[350,237,375,263])

add_block('built-in/Switch',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1>0?']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1>0?']],...
		'position',[420,224,450,256])

add_block('built-in/Constant',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Constant']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Constant']],...
		'Value','Ac*Ac/K',...
		'position',[25,435,95,465])

add_block('built-in/Mux',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p3, q1']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p3, q1']],...
		'hide name',0,...
		'inputs','3',...
		'Mask Display','p3\nq1\nCon',...
		'position',[145,415,175,455])

add_block('built-in/Fcn',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/f(q1,p3)']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/f(q1,p3)']],...
		'Expr','u[2]/(u[3]+(V0+u[3]*u[1])/beta)',...
		'position',[190,423,390,447])

add_block('built-in/Integrator',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/int p3']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/int p3']],...
		'Initial','1e-8',...
		'position',[405,425,425,445])

add_block('built-in/Fcn',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/f(q1)']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/f(q1)']],...
		'Expr','(u[1]*u[1])*row/(2*Cd*u[2]*Cd*u[2])',...
		'position',[145,181,325,199])

add_block('built-in/Sum',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p2-p3']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p2-p3']],...
		'inputs','+-',...
		'position',[575,331,595,384])

add_block('built-in/Gain',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1=Clam1*(p2-p3)']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1=Clam1*(p2-p3)']],...
		'Gain','Clam1',...
		'position',[645,347,670,373])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1-flow to cylinder']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q1-flow to cylinder']],...
		'position',[610,31,615,36])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p2-pressure downstream of orifice']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p2-pressure downstream of orifice']],...
		'position',[645,91,650,96])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p3-pressure in cylinder']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p3-pressure in cylinder']],...
		'position',[620,111,625,116])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q2-flow diverted to reservoir']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/q2-flow diverted to reservoir']],...
		'position',[635,51,640,56])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p1-pressure upstream of orifice']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p1-pressure upstream of orifice']],...
		'position',[640,70,645,75])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Outputs:']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Outputs:']],...
		'position',[580,10,585,15])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/A-variable orifice area']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/A-variable orifice area']],...
		'position',[125,50,130,55])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Q-source flow']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Q-source flow']],...
		'position',[105,30,110,35])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Inputs:']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Inputs:']],...
		'position',[90,10,95,15])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Hydraulic Cylinder Model']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/Hydraulic Cylinder Model']],...
		'Font Name','helvetica',...
		'Font Weight','bold',...
		'Font Angle','oblique',...
		'Font Size',18,...
		'position',[375,20,380,25])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/',13,'Modeled by Andy Grace,',13,'The MathWorks from equations ',13,'provided by General Motors.']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/',13,'Modeled by Andy Grace,',13,'The MathWorks from equations ',13,'provided by General Motors.']],...
		'position',[375,65,380,70])

add_block('built-in/Gain',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/spring -x']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/spring -x']],...
		'Gain','Ac/K',...
		'position',[505,414,550,456])

add_block('built-in/Outport',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p3']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/p3']],...
		'orientation',1,...
		'Port','5',...
		'position',[465,475,485,495])

add_block('built-in/Fcn',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume']],...
		'Expr','V0+Ac*u[1]',...
		'position',[580,426,655,444])

add_block('built-in/Outport',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/V']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/V']],...
		'Port','6',...
		'position',[685,425,705,445])

add_block('built-in/Note',[sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume in cylinder']])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume in cylinder']],...
		'position',[625,130,630,135])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[285,320;381,320;381,300;485,300])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[65,200;105,200])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[130,190;140,190])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[455,240;466,240;466,275;485,275])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[100,450;140,450])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[180,435;185,435])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[395,435;400,435])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[430,435;441,435;441,363;121,363;121,420;140,420])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[430,435;475,435;475,470])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[330,190;335,190;345,250])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[515,290;536,290;536,345;570,345])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[430,435;466,435;466,370;570,370])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[600,360;640,360])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[380,250;415,250])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[330,190;405,190;415,230])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[160,320;200,320])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[55,330;130,330])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[380,320;415,320])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[175,320;185,260])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,150;85,150;85,305;130,305])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,505;120,505;120,435;140,435])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,230;755,230])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,150;385,150;385,240;415,240])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[535,290;560,290])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[85,175;105,175])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[430,435;500,435])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[555,435;575,435])
add_line([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],[660,435;680,435])
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Display','   q1\n\n   q2\n\n   p1\n\n   p2\n\n   p3\n\n   V',...
		'Mask Type','Hydraulic cylinder')
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Dialogue','Hydraulic cylinder model|Cd:|row:|[Clam1,Clam2]:|beta:|Ac:|[K,V0]:')
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Translate','Cd = @1; row = @2; Clam1 = @3(1); Clam2 = @3(2); beta = @4; Ac = @5; K = @6(1); V0 = @6(2);')
set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Entries','0.61\/800\/[2e-7,3e-8]\/700e6\/0.01\/[500000, 0.025]\/')


%     Finished composite block ['Subsystem B/Hydraulic ',13,'cylinder ',13,'model'].

set_param([sys,'/',['Subsystem B/Hydraulic ',13,'cylinder ',13,'model']],...
		'position',[105,35,145,165])

add_block('built-in/Inport',[sys,'/','Subsystem B/A'])
set_param([sys,'/','Subsystem B/A'],...
		'Port','2',...
		'position',[15,125,30,145])

add_block('built-in/Inport',[sys,'/','Subsystem B/Q'])
set_param([sys,'/','Subsystem B/Q'],...
		'position',[15,60,30,80])

add_block('built-in/Note',[sys,'/',['Subsystem B/Unmask the Hydraulic Cylinder model',13,'block to see how the implicit loop was',13,'formed. Then Mask to recover last mask.']])
set_param([sys,'/',['Subsystem B/Unmask the Hydraulic Cylinder model',13,'block to see how the implicit loop was',13,'formed. Then Mask to recover last mask.']],...
		'position',[275,170,280,175])
add_line([sys,'/','Subsystem B'],[35,70;100,70])
add_line([sys,'/','Subsystem B'],[35,135;100,135])
add_line([sys,'/','Subsystem B'],[150,50;250,50])
add_line([sys,'/','Subsystem B'],[150,130;250,130])
set_param([sys,'/','Subsystem B'],...
		'Mask Display','plot(0,0,100,100,[90,47,70,70,90,47,47,47,10],[10,10,10,90,90,90,50,50,50],[47,47],[50,10])')


%     Finished composite block 'Subsystem B'.

set_param([sys,'/','Subsystem B'],...
		'position',[285,167,320,218])


%     Subsystem  'Subsystem C'.

new_system([sys,'/','Subsystem C'])
set_param([sys,'/','Subsystem C'],'Location',[633,257,1020,485])

add_block('built-in/Note',[sys,'/',['Subsystem C/Unmask the Hydraulic Cylinder model',13,'block to see how the implicit loop was',13,'formed. Then Mask to recover last mask.']])
set_param([sys,'/',['Subsystem C/Unmask the Hydraulic Cylinder model',13,'block to see how the implicit loop was',13,'formed. Then Mask to recover last mask.']],...
		'position',[275,170,280,175])

add_block('built-in/Inport',[sys,'/','Subsystem C/Q'])
set_param([sys,'/','Subsystem C/Q'],...
		'position',[15,60,30,80])

add_block('built-in/Inport',[sys,'/','Subsystem C/A'])
set_param([sys,'/','Subsystem C/A'],...
		'Port','2',...
		'position',[15,125,30,145])


%     Subsystem  ['Subsystem C/Hydraulic ',13,'cylinder ',13,'model'].

new_system([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],'Location',[16,121,821,632])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume in cylinder']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume in cylinder']],...
		'position',[625,130,630,135])

add_block('built-in/Outport',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/V']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/V']],...
		'Port','6',...
		'position',[685,425,705,445])

add_block('built-in/Fcn',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume']],...
		'Expr','V0+Ac*u[1]',...
		'position',[580,426,655,444])

add_block('built-in/Outport',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p3']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p3']],...
		'orientation',1,...
		'Port','5',...
		'position',[465,475,485,495])

add_block('built-in/Gain',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/spring -x']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/spring -x']],...
		'Gain','Ac/K',...
		'position',[505,414,550,456])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/',13,'Modeled by Andy Grace,',13,'The MathWorks from equations ',13,'provided by General Motors.']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/',13,'Modeled by Andy Grace,',13,'The MathWorks from equations ',13,'provided by General Motors.']],...
		'position',[375,65,380,70])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Hydraulic Cylinder Model']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Hydraulic Cylinder Model']],...
		'Font Name','helvetica',...
		'Font Weight','bold',...
		'Font Angle','oblique',...
		'Font Size',18,...
		'position',[375,20,380,25])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Inputs:']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Inputs:']],...
		'position',[90,10,95,15])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Q-source flow']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Q-source flow']],...
		'position',[105,30,110,35])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/A-variable orifice area']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/A-variable orifice area']],...
		'position',[125,50,130,55])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Outputs:']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Outputs:']],...
		'position',[580,10,585,15])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p1-pressure upstream of orifice']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p1-pressure upstream of orifice']],...
		'position',[640,70,645,75])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q2-flow diverted to reservoir']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q2-flow diverted to reservoir']],...
		'position',[635,51,640,56])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p3-pressure in cylinder']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p3-pressure in cylinder']],...
		'position',[620,111,625,116])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p2-pressure downstream of orifice']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p2-pressure downstream of orifice']],...
		'position',[645,91,650,96])

add_block('built-in/Note',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1-flow to cylinder']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1-flow to cylinder']],...
		'position',[610,31,615,36])

add_block('built-in/Gain',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1=Clam1*(p2-p3)']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1=Clam1*(p2-p3)']],...
		'Gain','Clam1',...
		'position',[645,347,670,373])

add_block('built-in/Sum',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p2-p3']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p2-p3']],...
		'inputs','+-',...
		'position',[575,331,595,384])

add_block('built-in/Fcn',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/f(q1)']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/f(q1)']],...
		'Expr','(u[1]*u[1])*row/(2*Cd*u[2]*Cd*u[2])',...
		'position',[145,181,325,199])

add_block('built-in/Integrator',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/int p3']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/int p3']],...
		'Initial','1e-8',...
		'position',[405,425,425,445])

add_block('built-in/Fcn',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/f(q1,p3)']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/f(q1,p3)']],...
		'Expr','u[2]/(u[3]+(V0+u[3]*u[1])/beta)',...
		'position',[190,423,390,447])

add_block('built-in/Mux',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p3, q1']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p3, q1']],...
		'hide name',0,...
		'inputs','3',...
		'Mask Display','p3\nq1\nCon',...
		'position',[145,415,175,455])

add_block('built-in/Constant',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Constant']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Constant']],...
		'Value','Ac*Ac/K',...
		'position',[25,435,95,465])

add_block('built-in/Switch',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1>0?']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1>0?']],...
		'position',[420,224,450,256])

add_block('built-in/Gain',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/is flow going backwards?']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/is flow going backwards?']],...
		'Gain','-1',...
		'position',[350,237,375,263])

add_block('built-in/Mux',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1,A']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1,A']],...
		'hide name',0,...
		'inputs','2',...
		'Mask Display','q1\n\nA',...
		'position',[110,163,125,212])

add_block('built-in/Inport',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/A']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/A']],...
		'Port','2',...
		'position',[45,190,60,210])

add_block('built-in/Gain',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p1=q2//Clam2']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p1=q2//Clam2']],...
		'Gain','1/Clam2',...
		'position',[205,303,280,337])

add_block('built-in/Sum',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q2=Q-q1']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q2=Q-q1']],...
		'inputs','-+',...
		'position',[135,294,155,341])

add_block('built-in/Inport',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Q']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/Q']],...
		'position',[35,320,50,340])

add_block('built-in/Sum',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p2=p1+-f(q1)']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p2=p1+-f(q1)']],...
		'inputs','-+',...
		'position',[490,264,510,311])

add_block('built-in/Outport',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q2']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q2']],...
		'Port','2',...
		'position',[190,250,210,270])

add_block('built-in/Outport',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p1']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p1']],...
		'Port','3',...
		'position',[420,310,440,330])

add_block('built-in/Outport',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/q1']],...
		'position',[760,220,780,240])

add_block('built-in/Outport',[sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p2']])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model/p2']],...
		'Port','4',...
		'position',[565,280,585,300])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[660,435;680,435])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[555,435;575,435])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[430,435;500,435])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,150;85,150;85,305;130,305])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[85,175;105,175])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[515,290;536,290;536,345;570,345])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[535,290;560,290])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,150;385,150;385,240;415,240])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,230;755,230])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,505;120,505;120,435;140,435])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[160,320;200,320])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[175,320;185,260])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[285,320;381,320;381,300;485,300])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[380,320;415,320])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[55,330;130,330])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[330,190;405,190;415,230])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[380,250;415,250])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[600,360;640,360])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[430,435;466,435;466,370;570,370])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[330,190;335,190;345,250])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[430,435;475,435;475,470])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[430,435;441,435;441,363;121,363;121,420;140,420])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[395,435;400,435])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[180,435;185,435])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[100,450;140,450])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[455,240;466,240;466,275;485,275])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[130,190;140,190])
add_line([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],[65,200;105,200])
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Display','   q1\n\n   q2\n\n   p1\n\n   p2\n\n   p3\n\n   V',...
		'Mask Type','Hydraulic cylinder')
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Dialogue','Hydraulic cylinder model|Cd:|row:|[Clam1,Clam2]:|beta:|Ac:|[K,V0]:')
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Translate','Cd = @1; row = @2; Clam1 = @3(1); Clam2 = @3(2); beta = @4; Ac = @5; K = @6(1); V0 = @6(2);')
set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Entries','0.61\/700\/[1e-7,2e-8]\/600e6\/0.011\/[400000, 0.03]\/')


%     Finished composite block ['Subsystem C/Hydraulic ',13,'cylinder ',13,'model'].

set_param([sys,'/',['Subsystem C/Hydraulic ',13,'cylinder ',13,'model']],...
		'position',[105,35,145,165])

add_block('built-in/Outport',[sys,'/','Subsystem C/q1'])
set_param([sys,'/','Subsystem C/q1'],...
		'position',[255,40,275,60])

add_block('built-in/Outport',[sys,'/','Subsystem C/p3'])
set_param([sys,'/','Subsystem C/p3'],...
		'Port','2',...
		'position',[255,120,275,140])
add_line([sys,'/','Subsystem C'],[150,130;250,130])
add_line([sys,'/','Subsystem C'],[150,50;250,50])
add_line([sys,'/','Subsystem C'],[35,135;100,135])
add_line([sys,'/','Subsystem C'],[35,70;100,70])
set_param([sys,'/','Subsystem C'],...
		'Mask Display','plot(0,0,100,100,[90,47,70,70,90,47,47,47,10],[10,10,10,90,90,90,50,50,50],[47,47],[50,10])')


%     Finished composite block 'Subsystem C'.

set_param([sys,'/','Subsystem C'],...
		'position',[285,263,320,312])


%     Subsystem  'Subsystem D'.

new_system([sys,'/','Subsystem D'])
set_param([sys,'/','Subsystem D'],'Location',[380,216,767,444])

add_block('built-in/Outport',[sys,'/','Subsystem D/p3'])
set_param([sys,'/','Subsystem D/p3'],...
		'Port','2',...
		'position',[255,120,275,140])

add_block('built-in/Outport',[sys,'/','Subsystem D/q1'])
set_param([sys,'/','Subsystem D/q1'],...
		'position',[255,40,275,60])


%     Subsystem  ['Subsystem D/Hydraulic ',13,'cylinder ',13,'model'].

new_system([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],'Location',[16,121,821,632])

add_block('built-in/Outport',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p2']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p2']],...
		'Port','4',...
		'position',[565,280,585,300])

add_block('built-in/Outport',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1']],...
		'position',[760,220,780,240])

add_block('built-in/Outport',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p1']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p1']],...
		'Port','3',...
		'position',[420,310,440,330])

add_block('built-in/Outport',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q2']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q2']],...
		'Port','2',...
		'position',[190,250,210,270])

add_block('built-in/Sum',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p2=p1+-f(q1)']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p2=p1+-f(q1)']],...
		'inputs','-+',...
		'position',[490,264,510,311])

add_block('built-in/Inport',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Q']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Q']],...
		'position',[35,320,50,340])

add_block('built-in/Sum',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q2=Q-q1']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q2=Q-q1']],...
		'inputs','-+',...
		'position',[135,294,155,341])

add_block('built-in/Gain',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p1=q2//Clam2']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p1=q2//Clam2']],...
		'Gain','1/Clam2',...
		'position',[205,303,280,337])

add_block('built-in/Inport',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/A']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/A']],...
		'Port','2',...
		'position',[45,190,60,210])

add_block('built-in/Mux',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1,A']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1,A']],...
		'hide name',0,...
		'inputs','2',...
		'Mask Display','q1\n\nA',...
		'position',[110,163,125,212])

add_block('built-in/Gain',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/is flow going backwards?']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/is flow going backwards?']],...
		'Gain','-1',...
		'position',[350,237,375,263])

add_block('built-in/Switch',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1>0?']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1>0?']],...
		'position',[420,224,450,256])

add_block('built-in/Constant',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Constant']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Constant']],...
		'Value','Ac*Ac/K',...
		'position',[25,435,95,465])

add_block('built-in/Mux',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p3, q1']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p3, q1']],...
		'hide name',0,...
		'inputs','3',...
		'Mask Display','p3\nq1\nCon',...
		'position',[145,415,175,455])

add_block('built-in/Fcn',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/f(q1,p3)']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/f(q1,p3)']],...
		'Expr','u[2]/(u[3]+(V0+u[3]*u[1])/beta)',...
		'position',[190,423,390,447])

add_block('built-in/Integrator',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/int p3']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/int p3']],...
		'Initial','1e-8',...
		'position',[405,425,425,445])

add_block('built-in/Fcn',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/f(q1)']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/f(q1)']],...
		'Expr','(u[1]*u[1])*row/(2*Cd*u[2]*Cd*u[2])',...
		'position',[145,181,325,199])

add_block('built-in/Sum',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p2-p3']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p2-p3']],...
		'inputs','+-',...
		'position',[575,331,595,384])

add_block('built-in/Gain',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1=Clam1*(p2-p3)']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1=Clam1*(p2-p3)']],...
		'Gain','Clam1',...
		'position',[645,347,670,373])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1-flow to cylinder']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q1-flow to cylinder']],...
		'position',[610,31,615,36])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p2-pressure downstream of orifice']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p2-pressure downstream of orifice']],...
		'position',[645,91,650,96])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p3-pressure in cylinder']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p3-pressure in cylinder']],...
		'position',[620,111,625,116])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q2-flow diverted to reservoir']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/q2-flow diverted to reservoir']],...
		'position',[635,51,640,56])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p1-pressure upstream of orifice']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p1-pressure upstream of orifice']],...
		'position',[640,70,645,75])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Outputs:']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Outputs:']],...
		'position',[580,10,585,15])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/A-variable orifice area']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/A-variable orifice area']],...
		'position',[125,50,130,55])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Q-source flow']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Q-source flow']],...
		'position',[105,30,110,35])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Inputs:']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Inputs:']],...
		'position',[90,10,95,15])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Hydraulic Cylinder Model']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/Hydraulic Cylinder Model']],...
		'Font Name','helvetica',...
		'Font Weight','bold',...
		'Font Angle','oblique',...
		'Font Size',18,...
		'position',[375,20,380,25])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/',13,'Modeled by Andy Grace,',13,'The MathWorks from equations ',13,'provided by General Motors.']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/',13,'Modeled by Andy Grace,',13,'The MathWorks from equations ',13,'provided by General Motors.']],...
		'position',[375,65,380,70])

add_block('built-in/Gain',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/spring -x']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/spring -x']],...
		'Gain','Ac/K',...
		'position',[505,414,550,456])

add_block('built-in/Outport',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p3']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/p3']],...
		'orientation',1,...
		'Port','5',...
		'position',[465,475,485,495])

add_block('built-in/Fcn',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume']],...
		'Expr','V0+Ac*u[1]',...
		'position',[580,426,655,444])

add_block('built-in/Outport',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/V']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/V']],...
		'Port','6',...
		'position',[685,425,705,445])

add_block('built-in/Note',[sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume in cylinder']])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model/V-fluid volume in cylinder']],...
		'position',[625,130,630,135])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[285,320;381,320;381,300;485,300])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[65,200;105,200])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[130,190;140,190])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[455,240;466,240;466,275;485,275])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[100,450;140,450])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[180,435;185,435])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[395,435;400,435])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[430,435;441,435;441,363;121,363;121,420;140,420])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[430,435;475,435;475,470])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[330,190;335,190;345,250])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[515,290;536,290;536,345;570,345])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[430,435;466,435;466,370;570,370])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[600,360;640,360])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[380,250;415,250])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[330,190;405,190;415,230])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[160,320;200,320])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[55,330;130,330])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[380,320;415,320])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[175,320;185,260])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,150;85,150;85,305;130,305])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,505;120,505;120,435;140,435])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,230;755,230])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[675,360;725,360;725,150;385,150;385,240;415,240])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[535,290;560,290])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[85,175;105,175])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[430,435;500,435])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[555,435;575,435])
add_line([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],[660,435;680,435])
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Display','   q1\n\n   q2\n\n   p1\n\n   p2\n\n   p3\n\n   V',...
		'Mask Type','Hydraulic cylinder')
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Dialogue','Hydraulic cylinder model|Cd:|row:|[Clam1,Clam2]:|beta:|Ac:|[K,V0]:')
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Translate','Cd = @1; row = @2; Clam1 = @3(1); Clam2 = @3(2); beta = @4; Ac = @5; K = @6(1); V0 = @6(2);')
set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],...
		'Mask Entries','0.61\/700\/[1e-7,2e-8]\/600e6\/0.011\/[400000, 0.03]\/')


%     Finished composite block ['Subsystem D/Hydraulic ',13,'cylinder ',13,'model'].

set_param([sys,'/',['Subsystem D/Hydraulic ',13,'cylinder ',13,'model']],...
		'position',[105,35,145,165])

add_block('built-in/Inport',[sys,'/','Subsystem D/A'])
set_param([sys,'/','Subsystem D/A'],...
		'Port','2',...
		'position',[15,125,30,145])

add_block('built-in/Inport',[sys,'/','Subsystem D/Q'])
set_param([sys,'/','Subsystem D/Q'],...
		'position',[15,60,30,80])

add_block('built-in/Note',[sys,'/',['Subsystem D/Unmask the Hydraulic Cylinder model',13,'block to see how the implicit loop was',13,'formed. Then Mask to recover last mask.']])
set_param([sys,'/',['Subsystem D/Unmask the Hydraulic Cylinder model',13,'block to see how the implicit loop was',13,'formed. Then Mask to recover last mask.']],...
		'position',[275,170,280,175])
add_line([sys,'/','Subsystem D'],[35,70;100,70])
add_line([sys,'/','Subsystem D'],[35,135;100,135])
add_line([sys,'/','Subsystem D'],[150,50;250,50])
add_line([sys,'/','Subsystem D'],[150,130;250,130])
set_param([sys,'/','Subsystem D'],...
		'Mask Display','plot(0,0,100,100,[90,47,70,70,90,47,47,47,10],[10,10,10,90,90,90,50,50,50],[47,47],[50,10])')


%     Finished composite block 'Subsystem D'.

set_param([sys,'/','Subsystem D'],...
		'position',[285,377,320,428])
add_line(sys,[90,75;275,75])
add_line(sys,[90,75;100,75;100,105;30,105;30,145;50,145])
add_line(sys,[85,235;140,235;140,415;205,415])
add_line(sys,[255,170;255,180;280,180])
add_line(sys,[255,220;255,205;280,205])
add_line(sys,[140,235;140,100;275,100])
add_line(sys,[90,75;155,75;155,170;215,170])
add_line(sys,[140,235;140,220;215,220])
add_line(sys,[140,300;280,300])
add_line(sys,[195,275;280,275])
add_line(sys,[245,415;280,415])
add_line(sys,[245,375;255,375;255,390;280,390])
add_line(sys,[195,275;205,375])
add_line(sys,[480,100;495,100])
add_line(sys,[320,75;435,75])
add_line(sys,[325,180;350,180;350,90;435,90])
add_line(sys,[325,275;355,275;355,105;435,105])
add_line(sys,[325,390;360,390;360,120;435,120])
add_line(sys,[320,100;410,100;410,370;445,370])
add_line(sys,[325,205;405,205;405,385;445,385])
add_line(sys,[325,300;400,300;400,400;445,400])
add_line(sys,[325,415;445,415])
add_line(sys,[490,395;505,395])

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
