function [ret,x0,str,ts,xts]=sdcmblk(t,x,u,flag);
%SDCMBLK	is the M-file description of the SIMULINK system named SDCMBLK.
%	The block-diagram can be displayed by typing: SDCMBLK.
%
%	SYS=SDCMBLK(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 SDCMBLK 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 SDCMBLK with a FLAG of zero:
%	[SIZES]=SDCMBLK([],[],[],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',[65,139,509,420])
     open_system(sys)
end;
set_param(sys,'algorithm',     'RK-23')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '5')
set_param(sys,'Min step size', '0.01')
set_param(sys,'Max step size', '10')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')

add_block('built-in/Note',[sys,'/','Separately Excited DC Motor'])
set_param([sys,'/','Separately Excited DC Motor'],...
		'Font Name','helvetica',...
		'Font Weight','bold',...
		'Font Angle','oblique',...
		'Font Size',18,...
		'position',[210,30,215,35])

add_block('built-in/Note',[sys,'/',['Click on this block before',13,'running simulation for the',13,'first time']])
set_param([sys,'/',['Click on this block before',13,'running simulation for the',13,'first time']],...
		'position',[170,70,175,75])


%     Subsystem  'DC motor'.

new_system([sys,'/','DC motor'])
set_param([sys,'/','DC motor'],'Location',[399,650,986,936])

add_block('built-in/Inport',[sys,'/','DC motor/v_f'])
set_param([sys,'/','DC motor/v_f'],...
		'BackGround',7,...
		'position',[10,50,30,70])

add_block('built-in/Outport',[sys,'/','DC motor/i_a'])
set_param([sys,'/','DC motor/i_a'],...
		'orientation',2,...
		'BackGround',6,...
		'Port','2',...
		'position',[415,30,435,50])

add_block('built-in/Gain',[sys,'/','DC motor/Gain6'])
set_param([sys,'/','DC motor/Gain6'],...
		'hide name',0,...
		'Gain','Laf/Laa',...
		'position',[285,59,340,111])

add_block('built-in/Product',[sys,'/','DC motor/Product'])
set_param([sys,'/','DC motor/Product'],...
		'hide name',0,...
		'position',[245,75,265,95])

add_block('built-in/Gain',[sys,'/','DC motor/Gain'])
set_param([sys,'/','DC motor/Gain'],...
		'orientation',2,...
		'hide name',0,...
		'Gain','Rf/Lff',...
		'position',[145,93,185,137])

add_block('built-in/Sum',[sys,'/','DC motor/Sum'])
set_param([sys,'/','DC motor/Sum'],...
		'hide name',0,...
		'inputs','+-',...
		'position',[135,55,155,75])

add_block('built-in/Integrator',[sys,'/','DC motor/If'])
set_param([sys,'/','DC motor/If'],...
		'BackGround',4,...
		'position',[180,55,200,75])

add_block('built-in/Integrator',[sys,'/','DC motor/Ia'])
set_param([sys,'/','DC motor/Ia'],...
		'BackGround',4,...
		'position',[425,75,445,95])

add_block('built-in/Sum',[sys,'/','DC motor/Sum1'])
set_param([sys,'/','DC motor/Sum1'],...
		'hide name',0,...
		'inputs','+--',...
		'position',[380,67,400,103])

add_block('built-in/Product',[sys,'/','DC motor/Product3'])
set_param([sys,'/','DC motor/Product3'],...
		'orientation',1,...
		'hide name',0,...
		'position',[475,100,495,120])

add_block('built-in/Gain',[sys,'/','DC motor/Gain2'])
set_param([sys,'/','DC motor/Gain2'],...
		'orientation',2,...
		'hide name',0,...
		'Gain','Ra/Laa',...
		'position',[370,114,425,156])

add_block('built-in/Outport',[sys,'/','DC motor/i_f'])
set_param([sys,'/','DC motor/i_f'],...
		'orientation',2,...
		'BackGround',6,...
		'position',[110,10,130,30])

add_block('built-in/Gain',[sys,'/','DC motor/Gain1'])
set_param([sys,'/','DC motor/Gain1'],...
		'hide name',0,...
		'Gain','1/Lff',...
		'position',[60,41,100,79])

add_block('built-in/Gain',[sys,'/','DC motor/Gain7'])
set_param([sys,'/','DC motor/Gain7'],...
		'hide name',0,...
		'Gain','1/Laa',...
		'position',[300,26,350,64])

add_block('built-in/Inport',[sys,'/','DC motor/v_a'])
set_param([sys,'/','DC motor/v_a'],...
		'BackGround',7,...
		'Port','2',...
		'position',[235,35,260,55])

add_block('built-in/Gain',[sys,'/','DC motor/Gain5'])
set_param([sys,'/','DC motor/Gain5'],...
		'orientation',2,...
		'hide name',0,...
		'Gain','1/Jm',...
		'position',[455,184,495,226])

add_block('built-in/Gain',[sys,'/','DC motor/Gain4'])
set_param([sys,'/','DC motor/Gain4'],...
		'orientation',1,...
		'hide name',0,...
		'Gain','Laf/Jm',...
		'position',[451,150,519,175])

add_block('built-in/Gain',[sys,'/','DC motor/Gain3'])
set_param([sys,'/','DC motor/Gain3'],...
		'hide name',0,...
		'Gain','Bm/Jm',...
		'position',[345,221,395,269])

add_block('built-in/Sum',[sys,'/','DC motor/Sum2'])
set_param([sys,'/','DC motor/Sum2'],...
		'orientation',2,...
		'hide name',0,...
		'inputs','+--',...
		'position',[365,172,385,208])

add_block('built-in/Integrator',[sys,'/','DC motor/Wr'])
set_param([sys,'/','DC motor/Wr'],...
		'orientation',2,...
		'BackGround',4,...
		'position',[325,180,345,200])

add_block('built-in/Inport',[sys,'/','DC motor/t_l'])
set_param([sys,'/','DC motor/t_l'],...
		'orientation',2,...
		'BackGround',7,...
		'Port','3',...
		'position',[540,195,560,215])

add_block('built-in/Outport',[sys,'/','DC motor/w_r'])
set_param([sys,'/','DC motor/w_r'],...
		'orientation',2,...
		'BackGround',6,...
		'Port','3',...
		'position',[230,210,250,230])
add_line([sys,'/','DC motor'],[365,135;355,135;355,95;375,95])
add_line([sys,'/','DC motor'],[485,125;485,145])
add_line([sys,'/','DC motor'],[450,205;425,205;425,190;390,190])
add_line([sys,'/','DC motor'],[400,245;410,245;410,200;390,200])
add_line([sys,'/','DC motor'],[450,85;460,85;460,135;430,135])
add_line([sys,'/','DC motor'],[360,190;350,190])
add_line([sys,'/','DC motor'],[450,85;480,95])
add_line([sys,'/','DC motor'],[405,85;420,85])
add_line([sys,'/','DC motor'],[320,190;220,190;220,90;240,90])
add_line([sys,'/','DC motor'],[320,190;310,190;310,245;340,245])
add_line([sys,'/','DC motor'],[160,65;175,65])
add_line([sys,'/','DC motor'],[140,115;110,115;110,70;130,70])
add_line([sys,'/','DC motor'],[105,60;130,60])
add_line([sys,'/','DC motor'],[35,60;55,60])
add_line([sys,'/','DC motor'],[450,85;460,85;460,40;440,40])
add_line([sys,'/','DC motor'],[320,190;310,190;255,220])
add_line([sys,'/','DC motor'],[535,205;500,205])
add_line([sys,'/','DC motor'],[205,65;215,65;215,20;135,20])
add_line([sys,'/','DC motor'],[205,65;215,65;215,115;190,115])
add_line([sys,'/','DC motor'],[485,180;390,180])
add_line([sys,'/','DC motor'],[215,80;240,80])
add_line([sys,'/','DC motor'],[270,85;280,85])
add_line([sys,'/','DC motor'],[345,85;375,85])
add_line([sys,'/','DC motor'],[265,45;295,45])
add_line([sys,'/','DC motor'],[355,45;360,45;360,75;375,75])
add_line([sys,'/','DC motor'],[215,20;490,20;490,95])


%     Finished composite block 'DC motor'.

set_param([sys,'/','DC motor'],...
		'BackGround',5,...
		'position',[220,139,250,191])

add_block('built-in/Step Fcn',[sys,'/','Vf'])
set_param([sys,'/','Vf'],...
		'BackGround',7,...
		'Time','0',...
		'After','240',...
		'position',[40,140,60,160])

add_block('built-in/Step Fcn',[sys,'/','Load Torque'])
set_param([sys,'/','Load Torque'],...
		'BackGround',6,...
		'Time','2',...
		'After','10',...
		'position',[125,170,145,190])

add_block('built-in/Step Fcn',[sys,'/','Va'])
set_param([sys,'/','Va'],...
		'BackGround',7,...
		'Time','.5',...
		'After','10',...
		'position',[75,155,95,175])


%     Subsystem  'If'.

new_system([sys,'/','If'])
set_param([sys,'/','If'],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/','If/x'])
set_param([sys,'/','If/x'],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['If/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['If/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,'/','If'],[90,65;125,65])
set_param([sys,'/','If'],...
		'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])',...
		'Mask Type','Storage scope.')
set_param([sys,'/','If'],...
		'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,'/','If'],...
		'Mask Translate','npts = @4; color = @5; ax = [0, @1, @2, @3]; dt=-1;')
set_param([sys,'/','If'],...
		'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,'/','If'],...
		'Mask Entries','5\/0\/1\/2000\/''y-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'If'.

set_param([sys,'/','If'],...
		'orientation',2,...
		'BackGround',3,...
		'position',[270,105,300,145])


%     Subsystem  'Wr'.

new_system([sys,'/','Wr'])
set_param([sys,'/','Wr'],'Location',[0,59,274,252])

add_block('built-in/S-Function',[sys,'/',['Wr/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['Wr/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,'/','Wr/x'])
set_param([sys,'/','Wr/x'],...
		'position',[65,55,85,75])
add_line([sys,'/','Wr'],[90,65;125,65])
set_param([sys,'/','Wr'],...
		'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])',...
		'Mask Type','Storage scope.')
set_param([sys,'/','Wr'],...
		'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,'/','Wr'],...
		'Mask Translate','npts = @4; color = @5; ax = [0, @1, @2, @3]; dt=-1;')
set_param([sys,'/','Wr'],...
		'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,'/','Wr'],...
		'Mask Entries','5\/0\/10\/2000\/''y-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'Wr'.

set_param([sys,'/','Wr'],...
		'orientation',2,...
		'BackGround',3,...
		'position',[275,190,305,230])


%     Subsystem  'Ia'.

new_system([sys,'/','Ia'])
set_param([sys,'/','Ia'],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/','Ia/x'])
set_param([sys,'/','Ia/x'],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['Ia/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['Ia/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,'/','Ia'],[90,65;125,65])
set_param([sys,'/','Ia'],...
		'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])',...
		'Mask Type','Storage scope.')
set_param([sys,'/','Ia'],...
		'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,'/','Ia'],...
		'Mask Translate','npts = @4; color = @5; ax = [0, @1, @2, @3]; dt=-1;')
set_param([sys,'/','Ia'],...
		'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,'/','Ia'],...
		'Mask Entries','5\/-5\/10\/2000\/''y-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'Ia'.

set_param([sys,'/','Ia'],...
		'BackGround',3,...
		'position',[340,145,370,185])


%     Subsystem  ['Double click here',13,'to start loading data',13,'and mu-syn design1'].

new_system([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],...
		'Mask Display','Load\nData',...
		'Mask Dialogue','eval([''dcm_par''])')


%     Finished composite block ['Double click here',13,'to start loading data',13,'and mu-syn design1'].

set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],...
		'ForeGround',1,...
		'BackGround',2,...
		'hide name',0,...
		'Drop Shadow',4,...
		'position',[38,74,89,101])
add_line(sys,[100,165;215,165])
add_line(sys,[65,150;215,150])
add_line(sys,[255,150;320,150;320,125;305,125])
add_line(sys,[255,165;335,165])
add_line(sys,[255,180;330,180;330,210;310,210])
add_line(sys,[150,180;215,180])

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
