function [ret,x0,str,ts,xts]=s2(t,x,u,flag);
%s2	is the M-file description of the SIMULINK system named s2.
%	The block-diagram can be displayed by typing: s2.
%
%	SYS=s2(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 s2 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 s2 with a FLAG of zero:
%	[SIZES]=s2([],[],[],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',[78,47,687,392])
     open_system(sys)
end;
set_param(sys,'algorithm',     'Adams/Gear')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     'tstop')
set_param(sys,'Min step size', '0.0001')
set_param(sys,'Max step size', '0.0010')
set_param(sys,'Relative error','1e-5')
set_param(sys,'Return vars',   '')


%     Subsystem  ['CB on//off',13,'signal'].

new_system([sys,'/',['CB on//off',13,'signal']])
set_param([sys,'/',['CB on//off',13,'signal']],'Location',[5,40,315,196])

add_block('built-in/Outport',[sys,'/',['CB on//off',13,'signal/out_1']])
set_param([sys,'/',['CB on//off',13,'signal/out_1']],...
		'position',[285,60,305,80])

add_block('built-in/Look Up Table',[sys,'/',['CB on//off',13,'signal/Look-Up Table']])
set_param([sys,'/',['CB on//off',13,'signal/Look-Up Table']],...
		'Input_Values','t',...
		'Output_Values','y',...
		'position',[210,58,250,82])

add_block('built-in/Fcn',[sys,'/',['CB on//off',13,'signal/Fcn1']])
set_param([sys,'/',['CB on//off',13,'signal/Fcn1']],...
		'Expr','rem(u[1],period)',...
		'position',[110,60,150,80])

add_block('built-in/Clock',[sys,'/',['CB on//off',13,'signal/Clock']])
set_param([sys,'/',['CB on//off',13,'signal/Clock']],...
		'position',[45,60,65,80])
add_line([sys,'/',['CB on//off',13,'signal']],[255,70;280,70])
add_line([sys,'/',['CB on//off',13,'signal']],[70,70;105,70])
add_line([sys,'/',['CB on//off',13,'signal']],[155,70;205,70])
set_param([sys,'/',['CB on//off',13,'signal']],...
		'Mask Display','plot([t,t+period,t+2*period],[y,y,y])',...
		'Mask Type','Repeating table')
set_param([sys,'/',['CB on//off',13,'signal']],...
		'Mask Dialogue','Repeating table.\nEnter values of time and output for first cycle.|Time values:|Output values:',...
		'Mask Translate','period = max(@1); t = @1; y = @2;')
set_param([sys,'/',['CB on//off',13,'signal']],...
		'Mask Help','Repeats cycle given in table. Time values should be monotonically increasing.',...
		'Mask Entries','[0 10*Te 10*Te 1.1*tstop ]\/[1 1 0 0  ]\/')


%     Finished composite block ['CB on//off',13,'signal'].

set_param([sys,'/',['CB on//off',13,'signal']],...
		'position',[110,198,140,222])

add_block('built-in/Note',[sys,'/','iR'])
set_param([sys,'/','iR'],...
		'position',[455,150,460,155])

add_block('built-in/Note',[sys,'/','Vb'])
set_param([sys,'/','Vb'],...
		'position',[240,175,245,180])

add_block('built-in/Note',[sys,'/','iS'])
set_param([sys,'/','iS'],...
		'position',[240,150,245,155])

add_block('built-in/Note',[sys,'/','vS'])
set_param([sys,'/','vS'],...
		'position',[360,175,365,180])

add_block('built-in/Note',[sys,'/','vR'])
set_param([sys,'/','vR'],...
		'position',[360,150,365,155])

add_block('built-in/Clock',[sys,'/','Clock'])
set_param([sys,'/','Clock'],...
		'position',[125,110,145,130])


%     Subsystem  'RL load'.

new_system([sys,'/','RL load'])
set_param([sys,'/','RL load'],'Location',[580,121,1019,341])

add_block('built-in/Gain',[sys,'/','RL load/gain1'])
set_param([sys,'/','RL load/gain1'],...
		'Gain','1/LL',...
		'position',[150,68,205,112])

add_block('built-in/Sum',[sys,'/','RL load/Sum'])
set_param([sys,'/','RL load/Sum'],...
		'inputs','+-',...
		'position',[105,62,120,113])

add_block('built-in/Integrator',[sys,'/','RL load/int'])
set_param([sys,'/','RL load/int'],...
		'position',[230,70,270,110])

add_block('built-in/Outport',[sys,'/','RL load/iR'])
set_param([sys,'/','RL load/iR'],...
		'position',[320,80,340,100])

add_block('built-in/Inport',[sys,'/','RL load/vR'])
set_param([sys,'/','RL load/vR'],...
		'position',[35,65,55,85])

add_block('built-in/Gain',[sys,'/','RL load/gain'])
set_param([sys,'/','RL load/gain'],...
		'orientation',2,...
		'Gain','RL',...
		'position',[170,126,230,164])
add_line([sys,'/','RL load'],[275,90;285,90;285,145;235,145])
add_line([sys,'/','RL load'],[165,145;80,145;80,100;100,100])
add_line([sys,'/','RL load'],[275,90;315,90])
add_line([sys,'/','RL load'],[60,75;100,75])
add_line([sys,'/','RL load'],[125,90;145,90])
add_line([sys,'/','RL load'],[210,90;225,90])


%     Finished composite block 'RL load'.

set_param([sys,'/','RL load'],...
		'position',[415,145,445,195])

add_block('built-in/Sine Wave',[sys,'/','e'])
set_param([sys,'/','e'],...
		'amplitude','Epk',...
		'frequency','we',...
		'phase','pi/2',...
		'position',[115,151,145,179])


%     Subsystem  'line'.

new_system([sys,'/','line'])
set_param([sys,'/','line'],'Location',[322,88,1015,437])

add_block('built-in/Note',[sys,'/','line/VbS'])
set_param([sys,'/','line/VbS'],...
		'position',[180,210,185,215])

add_block('built-in/Sum',[sys,'/','line/Sum2'])
set_param([sys,'/','line/Sum2'],...
		'inputs','+-',...
		'position',[190,68,205,132])

add_block('built-in/Note',[sys,'/','line/VfS'])
set_param([sys,'/','line/VfS'],...
		'position',[220,75,225,80])

add_block('built-in/Transport Delay',[sys,'/','line/S_to_R delay'])
set_param([sys,'/','line/S_to_R delay'],...
		'Delay Time','tdelay',...
		'Buffer Size:','buffer_size',...
		'position',[260,76,305,124])

add_block('built-in/Gain',[sys,'/','line/Zc1'])
set_param([sys,'/','line/Zc1'],...
		'orientation',3,...
		'Gain','Zc',...
		'position',[55,170,95,205])

add_block('built-in/Inport',[sys,'/','line/iS'])
set_param([sys,'/','line/iS'],...
		'position',[30,230,50,250])

add_block('built-in/Gain',[sys,'/','line/Gain1'])
set_param([sys,'/','line/Gain1'],...
		'orientation',2,...
		'Gain','2',...
		'position',[115,218,145,252])

add_block('built-in/Sum',[sys,'/','line/Sum1'])
set_param([sys,'/','line/Sum1'],...
		'orientation',3,...
		'position',[59,125,126,140])

add_block('built-in/Transport Delay',[sys,'/','line/R_to_S delay'])
set_param([sys,'/','line/R_to_S delay'],...
		'orientation',2,...
		'Delay Time','tdelay',...
		'Buffer Size:','buffer_size',...
		'position',[270,209,315,261])

add_block('built-in/Gain',[sys,'/','line/atten2'])
set_param([sys,'/','line/atten2'],...
		'orientation',2,...
		'Gain','atten',...
		'position',[200,214,245,256])

add_block('built-in/Note',[sys,'/','line/VbR'])
set_param([sys,'/','line/VbR'],...
		'position',[345,210,350,215])

add_block('built-in/Sum',[sys,'/','line/Sum5'])
set_param([sys,'/','line/Sum5'],...
		'orientation',2,...
		'inputs','-+',...
		'position',[370,199,385,266])

add_block('built-in/Gain',[sys,'/','line/atten1'])
set_param([sys,'/','line/atten1'],...
		'Gain','atten',...
		'position',[340,80,380,120])

add_block('built-in/Note',[sys,'/','line/VfR'])
set_param([sys,'/','line/VfR'],...
		'position',[400,75,405,80])

add_block('built-in/Gain',[sys,'/','line/Gain6'])
set_param([sys,'/','line/Gain6'],...
		'Gain','2',...
		'position',[430,84,465,116])

add_block('built-in/Gain',[sys,'/','line/Zc2'])
set_param([sys,'/','line/Zc2'],...
		'orientation',1,...
		'Gain','Zc',...
		'position',[499,130,541,165])

add_block('built-in/Sum',[sys,'/','line/Sum4'])
set_param([sys,'/','line/Sum4'],...
		'orientation',1,...
		'inputs','+-',...
		'position',[475,200,535,215])

add_block('built-in/Outport',[sys,'/','line/VR '])
set_param([sys,'/','line/VR '],...
		'position',[565,240,585,260])

add_block('built-in/Inport',[sys,'/','line/iR'])
set_param([sys,'/','line/iR'],...
		'orientation',2,...
		'Port','2',...
		'position',[560,80,580,100])

add_block('built-in/Outport',[sys,'/','line/VS'])
set_param([sys,'/','line/VS'],...
		'orientation',2,...
		'Port','2',...
		'position',[25,75,45,95])
add_line([sys,'/','line'],[195,235;165,235;165,115;185,115])
add_line([sys,'/','line'],[195,235;150,235])
add_line([sys,'/','line'],[265,235;250,235])
add_line([sys,'/','line'],[385,100;425,100])
add_line([sys,'/','line'],[310,100;335,100])
add_line([sys,'/','line'],[110,235;110,145])
add_line([sys,'/','line'],[470,100;490,100;490,195])
add_line([sys,'/','line'],[75,165;75,145])
add_line([sys,'/','line'],[210,100;255,100])
add_line([sys,'/','line'],[520,170;520,195])
add_line([sys,'/','line'],[365,235;320,235])
add_line([sys,'/','line'],[505,220;505,250;390,250])
add_line([sys,'/','line'],[505,220;505,250;560,250])
add_line([sys,'/','line'],[55,240;75,240;75,210])
add_line([sys,'/','line'],[555,90;520,90;520,125])
add_line([sys,'/','line'],[95,120;95,85;50,85])
add_line([sys,'/','line'],[95,120;95,85;185,85])
add_line([sys,'/','line'],[385,100;410,100;410,215;390,215])


%     Finished composite block 'line'.

set_param([sys,'/','line'],...
		'position',[310,157,340,208])


%     Subsystem  'breaker'.

new_system([sys,'/','breaker'])
set_param([sys,'/','breaker'],'Location',[292,81,1023,687])

add_block('built-in/Scope',[sys,'/','breaker/Scope1'])
set_param([sys,'/','breaker/Scope1'],...
		'Vgain','3.000000',...
		'Hgain','0.300000',...
		'Vmax','6.000000',...
		'Hmax','2.000000',...
		'Window',[38,803,525,913],...
		'position',[695,92,715,118])

add_block('built-in/Switch',[sys,'/','breaker/Switch'])
set_param([sys,'/','breaker/Switch'],...
		'Threshold','0.5',...
		'position',[530,117,545,163])

add_block('built-in/Sum',[sys,'/','breaker/e-vS-iS*Rcb'])
set_param([sys,'/','breaker/e-vS-iS*Rcb'],...
		'inputs','+--',...
		'position',[180,99,195,151])

add_block('built-in/Switch',[sys,'/','breaker/IS*Rcb insert'])
set_param([sys,'/','breaker/IS*Rcb insert'],...
		'Threshold','0.5',...
		'position',[560,46,575,94])

add_block('built-in/Scope',[sys,'/','breaker/Scope4'])
set_param([sys,'/','breaker/Scope4'],...
		'orientation',2,...
		'Vgain','5.000000',...
		'Hgain','0.300000',...
		'Vmax','10.000000',...
		'Hmax','2.000000',...
		'Window',[30,547,273,660],...
		'position',[40,187,60,213])

add_block('built-in/Logical Operator',[sys,'/','breaker/NOT CB on//off'])
set_param([sys,'/','breaker/NOT CB on//off'],...
		'Operator','NOT',...
		'Number of Input Ports','1',...
		'position',[305,378,335,402])

add_block('built-in/Outport',[sys,'/','breaker/iS'])
set_param([sys,'/','breaker/iS'],...
		'position',[695,140,715,160])

add_block('built-in/Logical Operator',[sys,'/',['breaker/open',13,'M at next',13,'iS zero']])
set_param([sys,'/',['breaker/open',13,'M at next',13,'iS zero']],...
		'orientation',1,...
		'Operator','AND',...
		'Number of Input Ports','3',...
		'position',[556,420,604,440])

add_block('built-in/Switch',[sys,'/','breaker/Insert iS*Ro'])
set_param([sys,'/','breaker/Insert iS*Ro'],...
		'orientation',2,...
		'Threshold','0.5',...
		'position',[110,236,130,284])

add_block('built-in/Gain',[sys,'/','breaker/Gain'])
set_param([sys,'/','breaker/Gain'],...
		'Gain','1/Ls',...
		'position',[340,107,385,143])

add_block('built-in/Gain',[sys,'/','breaker/Ro'])
set_param([sys,'/','breaker/Ro'],...
		'orientation',2,...
		'Gain','Ro',...
		'position',[390,226,435,264])

add_block('built-in/Gain',[sys,'/','breaker/Rc'])
set_param([sys,'/','breaker/Rc'],...
		'orientation',2,...
		'Gain','Rc',...
		'position',[300,166,345,204])

add_block('built-in/Sum',[sys,'/','breaker/Vbreaker'])
set_param([sys,'/','breaker/Vbreaker'],...
		'inputs','+-',...
		'position',[625,23,645,87])

add_block('built-in/Reset Integrator',[sys,'/',['breaker/Reset',13,'Integrator']])
set_param([sys,'/',['breaker/Reset',13,'Integrator']],...
		'position',[595,133,635,167])

add_block('built-in/Sum',[sys,'/','breaker/e-vS'])
set_param([sys,'/','breaker/e-vS'],...
		'inputs','+-',...
		'position',[110,14,125,61])

add_block('built-in/Scope',[sys,'/','breaker/Scope3'])
set_param([sys,'/','breaker/Scope3'],...
		'orientation',2,...
		'Vgain','5.000000',...
		'Hgain','0.300000',...
		'Vmax','10.000000',...
		'Hmax','2.000000',...
		'Window',[31,320,275,434],...
		'position',[40,137,60,163])

add_block('built-in/Inport',[sys,'/','breaker/e'])
set_param([sys,'/','breaker/e'],...
		'position',[40,14,65,36])

add_block('built-in/Inport',[sys,'/','breaker/vS'])
set_param([sys,'/','breaker/vS'],...
		'Port','3',...
		'position',[40,58,65,82])

add_block('built-in/Note',[sys,'/','breaker/M closed '])
set_param([sys,'/','breaker/M closed '],...
		'position',[440,300,445,305])


%     Subsystem  ['breaker/CB_on',13,'status'].

new_system([sys,'/',['breaker/CB_on',13,'status']])
set_param([sys,'/',['breaker/CB_on',13,'status']],'Location',[102,336,551,502])

add_block('built-in/Fcn',[sys,'/',['breaker/CB_on',13,'status/Fcn']])
set_param([sys,'/',['breaker/CB_on',13,'status/Fcn']],...
		'orientation',2,...
		'Expr','u[1]>.2',...
		'position',[170,123,205,147])

add_block('built-in/Demux',[sys,'/',['breaker/CB_on',13,'status/Demux']])
set_param([sys,'/',['breaker/CB_on',13,'status/Demux']],...
		'outputs','2',...
		'position',[275,55,315,90])

add_block('built-in/Combinatorial Logic',[sys,'/',['breaker/CB_on',13,'status/Logic']])
set_param([sys,'/',['breaker/CB_on',13,'status/Logic']],...
		'Truth Table','[0 1;1 0;0 1;0 1;1 0;1 0;0 0;0 0]',...
		'position',[195,55,250,95])

add_block('built-in/Transport Delay',[sys,'/',['breaker/CB_on',13,'status/Transport Delay']])
set_param([sys,'/',['breaker/CB_on',13,'status/Transport Delay']],...
		'orientation',2,...
		'Initial Input','ini',...
		'position',[250,120,295,150])

add_block('built-in/Outport',[sys,'/',['breaker/CB_on',13,'status/out_2']])
set_param([sys,'/',['breaker/CB_on',13,'status/out_2']],...
		'Port','2',...
		'position',[395,70,415,90])

add_block('built-in/Outport',[sys,'/',['breaker/CB_on',13,'status/out_1']])
set_param([sys,'/',['breaker/CB_on',13,'status/out_1']],...
		'position',[355,55,375,75])

add_block('built-in/Mux',[sys,'/',['breaker/CB_on',13,'status/Mux']])
set_param([sys,'/',['breaker/CB_on',13,'status/Mux']],...
		'inputs','3',...
		'position',[135,59,165,91])

add_block('built-in/Inport',[sys,'/',['breaker/CB_on',13,'status/in_1']])
set_param([sys,'/',['breaker/CB_on',13,'status/in_1']],...
		'position',[20,50,40,70])

add_block('built-in/Inport',[sys,'/',['breaker/CB_on',13,'status/in_2']])
set_param([sys,'/',['breaker/CB_on',13,'status/in_2']],...
		'Port','2',...
		'position',[50,65,70,85])
add_line([sys,'/',['breaker/CB_on',13,'status']],[320,65;350,65])
add_line([sys,'/',['breaker/CB_on',13,'status']],[335,65;335,135;300,135])
add_line([sys,'/',['breaker/CB_on',13,'status']],[165,135;110,135;110,85;130,85])
add_line([sys,'/',['breaker/CB_on',13,'status']],[245,135;210,135])
add_line([sys,'/',['breaker/CB_on',13,'status']],[75,75;130,75])
add_line([sys,'/',['breaker/CB_on',13,'status']],[45,60;105,60;105,65;130,65])
add_line([sys,'/',['breaker/CB_on',13,'status']],[170,75;190,75])
add_line([sys,'/',['breaker/CB_on',13,'status']],[255,75;270,75])
add_line([sys,'/',['breaker/CB_on',13,'status']],[320,80;390,80])
set_param([sys,'/',['breaker/CB_on',13,'status']],...
		'Mask Display','S  1\n\nR  0',...
		'Mask Type','Latch',...
		'Mask Dialogue','Latch|Initial State for Output "1":',...
		'Mask Translate','ini=(@1~=0);')
set_param([sys,'/',['breaker/CB_on',13,'status']],...
		'Mask Help','Latches the S input.  When S (set) is one, the uncomplemented output (1) becomes one.  The output remains one until the R (reset) input becomes one, forcing the output to zero.  If both R and S are one, the latch will be in an undefined state.')
set_param([sys,'/',['breaker/CB_on',13,'status']],...
		'Mask Entries','0\/')


%     Finished composite block ['breaker/CB_on',13,'status'].

set_param([sys,'/',['breaker/CB_on',13,'status']],...
		'position',[360,309,395,351])

add_block('built-in/Logical Operator',[sys,'/',['breaker/Logical',13,'Operator4']])
set_param([sys,'/',['breaker/Logical',13,'Operator4']],...
		'orientation',3,...
		'Operator','XOR',...
		'position',[150,455,190,480])


%     Subsystem  'breaker/Latch2'.

new_system([sys,'/','breaker/Latch2'])
set_param([sys,'/','breaker/Latch2'],'Location',[102,336,551,502])

add_block('built-in/Fcn',[sys,'/','breaker/Latch2/Fcn'])
set_param([sys,'/','breaker/Latch2/Fcn'],...
		'orientation',2,...
		'Expr','u[1]>.2',...
		'position',[170,123,205,147])

add_block('built-in/Demux',[sys,'/','breaker/Latch2/Demux'])
set_param([sys,'/','breaker/Latch2/Demux'],...
		'outputs','2',...
		'position',[275,55,315,90])

add_block('built-in/Combinatorial Logic',[sys,'/','breaker/Latch2/Logic'])
set_param([sys,'/','breaker/Latch2/Logic'],...
		'Truth Table','[0 1;1 0;0 1;0 1;1 0;1 0;0 0;0 0]',...
		'position',[195,55,250,95])

add_block('built-in/Transport Delay',[sys,'/','breaker/Latch2/Transport Delay'])
set_param([sys,'/','breaker/Latch2/Transport Delay'],...
		'orientation',2,...
		'Initial Input','ini',...
		'position',[250,120,295,150])

add_block('built-in/Outport',[sys,'/','breaker/Latch2/out_2'])
set_param([sys,'/','breaker/Latch2/out_2'],...
		'Port','2',...
		'position',[395,70,415,90])

add_block('built-in/Outport',[sys,'/','breaker/Latch2/out_1'])
set_param([sys,'/','breaker/Latch2/out_1'],...
		'position',[355,55,375,75])

add_block('built-in/Mux',[sys,'/','breaker/Latch2/Mux'])
set_param([sys,'/','breaker/Latch2/Mux'],...
		'inputs','3',...
		'position',[135,59,165,91])

add_block('built-in/Inport',[sys,'/','breaker/Latch2/in_1'])
set_param([sys,'/','breaker/Latch2/in_1'],...
		'position',[20,50,40,70])

add_block('built-in/Inport',[sys,'/','breaker/Latch2/in_2'])
set_param([sys,'/','breaker/Latch2/in_2'],...
		'Port','2',...
		'position',[50,65,70,85])
add_line([sys,'/','breaker/Latch2'],[320,65;350,65])
add_line([sys,'/','breaker/Latch2'],[335,65;335,135;300,135])
add_line([sys,'/','breaker/Latch2'],[165,135;110,135;110,85;130,85])
add_line([sys,'/','breaker/Latch2'],[245,135;210,135])
add_line([sys,'/','breaker/Latch2'],[75,75;130,75])
add_line([sys,'/','breaker/Latch2'],[45,60;105,60;105,65;130,65])
add_line([sys,'/','breaker/Latch2'],[170,75;190,75])
add_line([sys,'/','breaker/Latch2'],[255,75;270,75])
add_line([sys,'/','breaker/Latch2'],[320,80;390,80])
set_param([sys,'/','breaker/Latch2'],...
		'Mask Display','S  1\n\nR  0',...
		'Mask Type','Latch',...
		'Mask Dialogue','Latch|Initial State for Output "1":',...
		'Mask Translate','ini=(@1~=0);')
set_param([sys,'/','breaker/Latch2'],...
		'Mask Help','Latches the S input.  When S (set) is one, the uncomplemented output (1) becomes one.  The output remains one until the R (reset) input becomes one, forcing the output to zero.  If both R and S are one, the latch will be in an undefined state.')
set_param([sys,'/','breaker/Latch2'],...
		'Mask Entries','0\/')


%     Finished composite block 'breaker/Latch2'.

set_param([sys,'/','breaker/Latch2'],...
		'orientation',2,...
		'position',[445,490,480,530])


%     Subsystem  'breaker/Latch3'.

new_system([sys,'/','breaker/Latch3'])
set_param([sys,'/','breaker/Latch3'],'Location',[102,336,551,502])

add_block('built-in/Fcn',[sys,'/','breaker/Latch3/Fcn'])
set_param([sys,'/','breaker/Latch3/Fcn'],...
		'orientation',2,...
		'Expr','u[1]>.2',...
		'position',[170,123,205,147])

add_block('built-in/Demux',[sys,'/','breaker/Latch3/Demux'])
set_param([sys,'/','breaker/Latch3/Demux'],...
		'outputs','2',...
		'position',[275,55,315,90])

add_block('built-in/Combinatorial Logic',[sys,'/','breaker/Latch3/Logic'])
set_param([sys,'/','breaker/Latch3/Logic'],...
		'Truth Table','[0 1;1 0;0 1;0 1;1 0;1 0;0 0;0 0]',...
		'position',[195,55,250,95])

add_block('built-in/Transport Delay',[sys,'/','breaker/Latch3/Transport Delay'])
set_param([sys,'/','breaker/Latch3/Transport Delay'],...
		'orientation',2,...
		'Initial Input','ini',...
		'position',[250,120,295,150])

add_block('built-in/Outport',[sys,'/','breaker/Latch3/out_2'])
set_param([sys,'/','breaker/Latch3/out_2'],...
		'Port','2',...
		'position',[395,70,415,90])

add_block('built-in/Outport',[sys,'/','breaker/Latch3/out_1'])
set_param([sys,'/','breaker/Latch3/out_1'],...
		'position',[355,55,375,75])

add_block('built-in/Mux',[sys,'/','breaker/Latch3/Mux'])
set_param([sys,'/','breaker/Latch3/Mux'],...
		'inputs','3',...
		'position',[135,59,165,91])

add_block('built-in/Inport',[sys,'/','breaker/Latch3/in_1'])
set_param([sys,'/','breaker/Latch3/in_1'],...
		'position',[20,50,40,70])

add_block('built-in/Inport',[sys,'/','breaker/Latch3/in_2'])
set_param([sys,'/','breaker/Latch3/in_2'],...
		'Port','2',...
		'position',[50,65,70,85])
add_line([sys,'/','breaker/Latch3'],[320,65;350,65])
add_line([sys,'/','breaker/Latch3'],[335,65;335,135;300,135])
add_line([sys,'/','breaker/Latch3'],[165,135;110,135;110,85;130,85])
add_line([sys,'/','breaker/Latch3'],[245,135;210,135])
add_line([sys,'/','breaker/Latch3'],[75,75;130,75])
add_line([sys,'/','breaker/Latch3'],[45,60;105,60;105,65;130,65])
add_line([sys,'/','breaker/Latch3'],[170,75;190,75])
add_line([sys,'/','breaker/Latch3'],[255,75;270,75])
add_line([sys,'/','breaker/Latch3'],[320,80;390,80])
set_param([sys,'/','breaker/Latch3'],...
		'Mask Display','S  1\n\nR  0',...
		'Mask Type','Latch',...
		'Mask Dialogue','Latch|Initial State for Output "1":',...
		'Mask Translate','ini=(@1~=0);')
set_param([sys,'/','breaker/Latch3'],...
		'Mask Help','Latches the S input.  When S (set) is one, the uncomplemented output (1) becomes one.  The output remains one until the R (reset) input becomes one, forcing the output to zero.  If both R and S are one, the latch will be in an undefined state.')
set_param([sys,'/','breaker/Latch3'],...
		'Mask Entries','0\/')


%     Finished composite block 'breaker/Latch3'.

set_param([sys,'/','breaker/Latch3'],...
		'position',[310,435,345,475])

add_block('built-in/Transport Delay',[sys,'/','breaker/delay to'])
set_param([sys,'/','breaker/delay to'],...
		'orientation',2,...
		'Delay Time','to',...
		'position',[345,507,400,543])

add_block('built-in/Fcn',[sys,'/','breaker/abs(iS)'])
set_param([sys,'/','breaker/abs(iS)'],...
		'orientation',2,...
		'Expr','abs(u[1])',...
		'position',[615,483,650,517])

add_block('built-in/Logical Operator',[sys,'/',['breaker/t0 delay',13,'enable']])
set_param([sys,'/',['breaker/t0 delay',13,'enable']],...
		'orientation',2,...
		'Operator','AND',...
		'position',[285,516,320,554])


%     Subsystem  'breaker/Latch1'.

new_system([sys,'/','breaker/Latch1'])
set_param([sys,'/','breaker/Latch1'],'Location',[102,336,551,502])

add_block('built-in/Fcn',[sys,'/','breaker/Latch1/Fcn'])
set_param([sys,'/','breaker/Latch1/Fcn'],...
		'orientation',2,...
		'Expr','u[1]>.2',...
		'position',[170,123,205,147])

add_block('built-in/Demux',[sys,'/','breaker/Latch1/Demux'])
set_param([sys,'/','breaker/Latch1/Demux'],...
		'outputs','2',...
		'position',[275,55,315,90])

add_block('built-in/Combinatorial Logic',[sys,'/','breaker/Latch1/Logic'])
set_param([sys,'/','breaker/Latch1/Logic'],...
		'Truth Table','[0 1;1 0;0 1;0 1;1 0;1 0;0 0;0 0]',...
		'position',[195,55,250,95])

add_block('built-in/Transport Delay',[sys,'/','breaker/Latch1/Transport Delay'])
set_param([sys,'/','breaker/Latch1/Transport Delay'],...
		'orientation',2,...
		'Initial Input','ini',...
		'position',[250,120,295,150])

add_block('built-in/Outport',[sys,'/','breaker/Latch1/out_2'])
set_param([sys,'/','breaker/Latch1/out_2'],...
		'Port','2',...
		'position',[395,70,415,90])

add_block('built-in/Outport',[sys,'/','breaker/Latch1/out_1'])
set_param([sys,'/','breaker/Latch1/out_1'],...
		'position',[355,55,375,75])

add_block('built-in/Mux',[sys,'/','breaker/Latch1/Mux'])
set_param([sys,'/','breaker/Latch1/Mux'],...
		'inputs','3',...
		'position',[135,59,165,91])

add_block('built-in/Inport',[sys,'/','breaker/Latch1/in_1'])
set_param([sys,'/','breaker/Latch1/in_1'],...
		'position',[20,50,40,70])

add_block('built-in/Inport',[sys,'/','breaker/Latch1/in_2'])
set_param([sys,'/','breaker/Latch1/in_2'],...
		'Port','2',...
		'position',[50,65,70,85])
add_line([sys,'/','breaker/Latch1'],[320,65;350,65])
add_line([sys,'/','breaker/Latch1'],[335,65;335,135;300,135])
add_line([sys,'/','breaker/Latch1'],[165,135;110,135;110,85;130,85])
add_line([sys,'/','breaker/Latch1'],[245,135;210,135])
add_line([sys,'/','breaker/Latch1'],[75,75;130,75])
add_line([sys,'/','breaker/Latch1'],[45,60;105,60;105,65;130,65])
add_line([sys,'/','breaker/Latch1'],[170,75;190,75])
add_line([sys,'/','breaker/Latch1'],[255,75;270,75])
add_line([sys,'/','breaker/Latch1'],[320,80;390,80])
set_param([sys,'/','breaker/Latch1'],...
		'Mask Display','S  1\n\nR  0',...
		'Mask Type','Latch',...
		'Mask Dialogue','Latch|Initial State for Output "1":',...
		'Mask Translate','ini=(@1~=0);')
set_param([sys,'/','breaker/Latch1'],...
		'Mask Help','Latches the S input.  When S (set) is one, the uncomplemented output (1) becomes one.  The output remains one until the R (reset) input becomes one, forcing the output to zero.  If both R and S are one, the latch will be in an undefined state.')
set_param([sys,'/','breaker/Latch1'],...
		'Mask Entries','0\/')


%     Finished composite block 'breaker/Latch1'.

set_param([sys,'/','breaker/Latch1'],...
		'orientation',2,...
		'position',[175,525,210,565])

add_block('built-in/Relational Operator',[sys,'/','breaker/|iS|<=eps'])
set_param([sys,'/','breaker/|iS|<=eps'],...
		'orientation',2,...
		'Operator','<=',...
		'position',[545,526,575,564])

add_block('built-in/Constant',[sys,'/','breaker/eps'])
set_param([sys,'/','breaker/eps'],...
		'orientation',2,...
		'position',[615,541,635,569])

add_block('built-in/Switch',[sys,'/','breaker/Insert iS*Rc'])
set_param([sys,'/','breaker/Insert iS*Rc'],...
		'orientation',2,...
		'Threshold','0.5',...
		'position',[175,175,195,225])


%     Subsystem  'breaker/delay tc'.

new_system([sys,'/','breaker/delay tc'])
set_param([sys,'/','breaker/delay tc'],'Location',[485,451,992,690])

add_block('built-in/Note',[sys,'/',['breaker/delay tc/AND  used to suppress',13,'spurious operation when',13,'input goes from high to low']])
set_param([sys,'/',['breaker/delay tc/AND  used to suppress',13,'spurious operation when',13,'input goes from high to low']],...
		'position',[350,178,355,183])

add_block('built-in/Logical Operator',[sys,'/',['breaker/delay tc/Logical',13,'Operator1']])
set_param([sys,'/',['breaker/delay tc/Logical',13,'Operator1']],...
		'Operator','AND',...
		'position',[320,42,365,138])

add_block('built-in/Outport',[sys,'/','breaker/delay tc/out_1'])
set_param([sys,'/','breaker/delay tc/out_1'],...
		'position',[405,80,425,100])

add_block('built-in/Inport',[sys,'/','breaker/delay tc/in_1'])
set_param([sys,'/','breaker/delay tc/in_1'],...
		'position',[20,90,40,110])

add_block('built-in/Logical Operator',[sys,'/',['breaker/delay tc/Logical',13,'Operator']])
set_param([sys,'/',['breaker/delay tc/Logical',13,'Operator']],...
		'Operator','XOR',...
		'position',[225,85,275,145])

add_block('built-in/Transport Delay',[sys,'/',['breaker/delay tc/Transport',13,'Delay1']])
set_param([sys,'/',['breaker/delay tc/Transport',13,'Delay1']],...
		'Delay Time','tc',...
		'position',[105,110,170,150])
add_line([sys,'/','breaker/delay tc'],[175,130;220,130])
add_line([sys,'/','breaker/delay tc'],[45,100;60,100;60,130;100,130])
add_line([sys,'/','breaker/delay tc'],[45,100;220,100])
add_line([sys,'/','breaker/delay tc'],[370,90;400,90])
add_line([sys,'/','breaker/delay tc'],[280,115;315,115])
add_line([sys,'/','breaker/delay tc'],[60,100;60,65;315,65])


%     Finished composite block 'breaker/delay tc'.

set_param([sys,'/','breaker/delay tc'],...
		'orientation',3,...
		'position',[230,340,280,370])

add_block('built-in/Inport',[sys,'/',['breaker/CB on//off',13,'signal']])
set_param([sys,'/',['breaker/CB on//off',13,'signal']],...
		'Port','2',...
		'position',[55,380,75,400])

add_block('built-in/Outport',[sys,'/','breaker/vb'])
set_param([sys,'/','breaker/vb'],...
		'Port','2',...
		'position',[675,45,695,65])
add_line([sys,'/','breaker'],[650,55;670,55])
add_line([sys,'/','breaker'],[105,260;95,260;95,125;175,125])
add_line([sys,'/','breaker'],[200,125;220,125;220,55;555,55])
add_line([sys,'/','breaker'],[385,245;135,245])
add_line([sys,'/','breaker'],[200,125;335,125])
add_line([sys,'/','breaker'],[170,200;125,200;125,140;175,140])
add_line([sys,'/','breaker'],[70,25;105,25])
add_line([sys,'/','breaker'],[580,70;620,70])
add_line([sys,'/','breaker'],[130,40;620,40])
add_line([sys,'/','breaker'],[130,40;155,40;155,110;175,110])
add_line([sys,'/','breaker'],[640,150;690,150])
add_line([sys,'/','breaker'],[670,150;670,185;350,185])
add_line([sys,'/','breaker'],[390,125;525,125])
add_line([sys,'/','breaker'],[670,185;670,245;440,245])
add_line([sys,'/','breaker'],[550,140;590,140])
add_line([sys,'/','breaker'],[350,445;490,445;490,70;555,70])
add_line([sys,'/','breaker'],[490,435;490,140;525,140])
add_line([sys,'/','breaker'],[295,185;200,185])
add_line([sys,'/','breaker'],[665,245;670,245;670,500;655,500])
add_line([sys,'/','breaker'],[610,500;600,500;600,535;580,535])
add_line([sys,'/','breaker'],[610,555;580,555])
add_line([sys,'/','breaker'],[80,390;300,390])
add_line([sys,'/','breaker'],[665,150;670,150;670,105;690,105])
add_line([sys,'/','breaker'],[95,150;65,150])
add_line([sys,'/','breaker'],[155,200;65,200])
add_line([sys,'/','breaker'],[540,545;325,545])
add_line([sys,'/','breaker'],[340,525;325,525])
add_line([sys,'/','breaker'],[280,535;215,535])
add_line([sys,'/','breaker'],[255,335;255,320;355,320])
add_line([sys,'/','breaker'],[80,390;255,390;255,375])
add_line([sys,'/','breaker'],[70,70;85,70;85,50;105,50])
add_line([sys,'/','breaker'],[400,320;580,320;580,415])
add_line([sys,'/','breaker'],[340,390;565,390;565,415])
add_line([sys,'/','breaker'],[170,535;160,535;160,485])
add_line([sys,'/','breaker'],[255,385;255,445;305,445])
add_line([sys,'/','breaker'],[280,535;270,535;270,465;305,465])
add_line([sys,'/','breaker'],[540,545;525,545;525,405;595,415])
add_line([sys,'/','breaker'],[580,445;580,500;485,500])
add_line([sys,'/','breaker'],[440,500;180,500;180,485])
add_line([sys,'/','breaker'],[440,500;415,500;405,525])
add_line([sys,'/','breaker'],[580,445;580,455;550,455;550,150;590,150])
add_line([sys,'/','breaker'],[95,390;95,585;505,585;505,520;485,520])
add_line([sys,'/','breaker'],[230,585;230,555;215,555])
add_line([sys,'/','breaker'],[255,335;255,200;200,200])
add_line([sys,'/','breaker'],[170,450;170,260;135,260])
set_param([sys,'/','breaker'],...
		'Mask Display','')


%     Finished composite block 'breaker'.

set_param([sys,'/','breaker'],...
		'position',[195,154,225,206])

add_block('built-in/Mux',[sys,'/','Mux2'])
set_param([sys,'/','Mux2'],...
		'orientation',3,...
		'inputs','7',...
		'position',[125,85,515,100])

add_block('built-in/Note',[sys,'/',['Double click on masked block m2 in this screen or run m2.m in ',13,'MATLAB command window to initialize this simulation.  ',13,'After the simulation, type return after the K>> prompt in the ',13,'MATLAB  command window to plot results.']])
set_param([sys,'/',['Double click on masked block m2 in this screen or run m2.m in ',13,'MATLAB command window to initialize this simulation.  ',13,'After the simulation, type return after the K>> prompt in the ',13,'MATLAB  command window to plot results.']],...
		'position',[315,250,320,255])


%     Subsystem  'm2'.

new_system([sys,'/','m2'])
set_param([sys,'/','m2'],'Location',[-10,4391136,201,4391244])

add_block('built-in/Note',[sys,'/',['m2/Masked block of m2.m to initalize s2.m ',13,'and plot results']])
set_param([sys,'/',['m2/Masked block of m2.m to initalize s2.m ',13,'and plot results']],...
		'position',[125,45,130,50])
set_param([sys,'/','m2'],...
		'Mask Display','Initialize\nand plot',...
		'Mask Type','Masked block of m2.m',...
		'Mask Dialogue','eval(''m2'')',...
		'Mask Help','Uses m2.m to initialize and plot')


%     Finished composite block 'm2'.

set_param([sys,'/','m2'],...
		'Drop Shadow',4,...
		'position',[120,26,194,64])

add_block('built-in/Scope',[sys,'/','Scope'])
set_param([sys,'/','Scope'],...
		'orientation',2,...
		'Vgain','450000.000000',...
		'Hgain','0.250000',...
		'Vmax','900000.000000',...
		'Hmax','0.500000',...
		'Window',[79,364,702,581])
open_system([sys,'/','Scope'])
set_param([sys,'/','Scope'],...
		'position',[250,39,270,61])

add_block('built-in/To Workspace',[sys,'/','To Workspace'])
set_param([sys,'/','To Workspace'],...
		'mat-name','y',...
		'buffer','15000',...
		'position',[380,42,430,58])
add_line(sys,[450,170;485,170;485,245;290,245;290,195;305,195])
add_line(sys,[230,170;305,170])
add_line(sys,[345,170;410,170])
add_line(sys,[150,165;190,165])
add_line(sys,[345,195;375,195;375,235;175,235;175,195;190,195])
add_line(sys,[320,80;320,50;375,50])
add_line(sys,[150,120;155,120;155,105])
add_line(sys,[145,210;160,210;160,180;190,180])
add_line(sys,[320,80;320,50;275,50])
add_line(sys,[150,165;160,165;160,145;210,145;210,105])
add_line(sys,[230,195;265,195;265,105])
add_line(sys,[230,170;255,170;255,140;320,140;320,105])
add_line(sys,[345,195;375,195;375,105])
add_line(sys,[345,170;385,170;385,135;430,135;430,105])
add_line(sys,[450,170;485,170;485,105])

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
