function [ret,x0,str,ts,xts]=s8_3(t,x,u,flag);
%S8_3 is the M-file description of the SIMULINK system named S8_3.
% The block-diagram can be displayed by typing: S8_3.
%
% SYS=S8_3(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 S8_3 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 S8_3 with a FLAG of zero:
% [SIZES]=S8_3([],[],[],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',[6,83,578,387])
open_system(sys)
end;
set_param(sys,'algorithm', 'Linear')
set_param(sys,'Start time', '0.0')
set_param(sys,'Stop time', 't_d')
set_param(sys,'Min step size', 'Tc')
set_param(sys,'Max step size', 'Tc')
set_param(sys,'Relative error','1e-8')
set_param(sys,'Return vars', '')

add_block('built-in/Sum',[sys,'/','Sum2'])
set_param([sys,'/','Sum2'],...
'hide name',0,...
'Font Name','Arial',...
'inputs','+-',...
'position',[400,142,415,178])

add_block('built-in/Gain',[sys,'/','Gain3'])
set_param([sys,'/','Gain3'],...
'hide name',0,...
'Font Name','Arial',...
'Gain','k_t',...
'Mask Display','k_t',...
'position',[345,135,375,165])

add_block('built-in/Sum',[sys,'/','Sum1'])
set_param([sys,'/','Sum1'],...
'hide name',0,...
'Font Name','Arial',...
'inputs','+--',...
'position',[230,128,245,172])

add_block('built-in/Gain',[sys,'/','Gain5'])
set_param([sys,'/','Gain5'],...
'orientation',2,...
'hide name',0,...
'Font Name','Arial',...
'Gain','k_v',...
'Mask Display','k_v',...
'position',[345,225,375,255])

% Subsystem 'Subsystem5'.

new_system([sys,'/','Subsystem5'])
set_param([sys,'/','Subsystem5'],'Location',[355,393414,500,393509])

add_block('built-in/Note',[sys,'/','Subsystem5/start'])
set_param([sys,'/','Subsystem5/start'],...
'position',[55,45,60,50])
set_param([sys,'/','Subsystem5'],...
'Mask Display','velocity',...
'Mask Dialogue','eval(''clear all;c=1;i8_3;'')')

% Finished composite block 'Subsystem5'.

set_param([sys,'/','Subsystem5'],...
'hide name',0,...
'Font Name','Arial',...
'Drop Shadow',4,...
'position',[90,5,160,41])

% Subsystem 'Subsystem4'.

new_system([sys,'/','Subsystem4'])
set_param([sys,'/','Subsystem4'],'Location',[355,393414,500,393509])

add_block('built-in/Note',[sys,'/','Subsystem4/start'])
set_param([sys,'/','Subsystem4/start'],...
'position',[55,45,60,50])
set_param([sys,'/','Subsystem4'],...
'Mask Display','current',...
'Mask Dialogue','eval(''clear all;c=0;i8_3;'')')

% Finished composite block 'Subsystem4'.

set_param([sys,'/','Subsystem4'],...
'hide name',0,...
'Font Name','Arial',...
'Drop Shadow',4,...
'position',[5,5,75,41])

add_block('built-in/To Workspace',[sys,'/','To Workspace3'])
set_param([sys,'/','To Workspace3'],...
'hide name',0,...
'Font Name','Arial',...
'mat-name','curr',...
'buffer','[5001,1,Ts]',...
'position',[400,68,450,92])

add_block('built-in/Transfer Fcn',[sys,'/','Transfer Fcn'])
set_param([sys,'/','Transfer Fcn'],...
'hide name',0,...
'Font Name','Arial',...
'Numerator','[G_v]',...
'Denominator','[T_v 1]',...
'position',[150,117,195,153])

add_block('built-in/Transfer Fcn',[sys,'/','Transfer Fcn1'])
set_param([sys,'/','Transfer Fcn1'],...
'hide name',0,...
'Font Name','Arial',...
'Denominator','[L_a 0]',...
'position',[265,132,305,168])

add_block('built-in/Gain',[sys,'/','Gain1'])
set_param([sys,'/','Gain1'],...
'orientation',2,...
'hide name',0,...
'Font Name','Arial',...
'Gain','R_a',...
'Mask Display','R_a',...
'position',[270,180,300,210])

add_block('built-in/Gain',[sys,'/','Gain6'])
set_param([sys,'/','Gain6'],...
'orientation',2,...
'hide name',0,...
'Font Name','Arial',...
'Gain','k_i',...
'Mask Display','k_i',...
'position',[155,65,185,95])

add_block('built-in/Transfer Fcn',[sys,'/','Transfer Fcn3'])
set_param([sys,'/','Transfer Fcn3'],...
'hide name',0,...
'Font Name','Arial',...
'Numerator','[K_i*T_i K_i]',...
'Denominator','[1 0]',...
'Mask Display','C_i(s)',...
'position',[90,117,130,153])

add_block('built-in/Step Fcn',[sys,'/',['V''_c']])
set_param([sys,'/',['V''_c']],...
'Font Name','Arial',...
'Time','0.0001',...
'position',[5,130,25,150])

add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
'hide name',0,...
'Font Name','Arial',...
'inputs','-+',...
'position',[50,115,70,150])

% Subsystem 'Subsystem8'.

new_system([sys,'/','Subsystem8'])
set_param([sys,'/','Subsystem8'],'Location',[355,393414,500,393509])

add_block('built-in/Note',[sys,'/','Subsystem8/start'])
set_param([sys,'/','Subsystem8/start'],...
'position',[55,45,60,50])
set_param([sys,'/','Subsystem8'],...
'Mask Display','plot',...
'Mask Dialogue','eval(''p8_3;'')')

% Finished composite block 'Subsystem8'.

set_param([sys,'/','Subsystem8'],...
'orientation',2,...
'hide name',0,...
'Font Name','Arial',...
'Drop Shadow',4,...
'position',[495,265,565,296])

add_block('built-in/Gain',[sys,'/','Gain4'])
set_param([sys,'/','Gain4'],...
'orientation',2,...
'hide name',0,...
'Font Name','Arial',...
'Gain','F_m',...
'Mask Display','F_m',...
'position',[440,190,470,220])

add_block('built-in/To Workspace',[sys,'/','To Workspace2'])
set_param([sys,'/','To Workspace2'],...
'hide name',0,...
'Font Name','Arial',...
'mat-name','omega',...
'buffer','[5001,1,Ts]',...
'position',[515,148,565,172])

add_block('built-in/Transfer Fcn',[sys,'/','Transfer Fcn2'])
set_param([sys,'/','Transfer Fcn2'],...
'hide name',0,...
'Font Name','Arial',...
'Denominator','[I_m 0]',...
'position',[435,142,475,178])

add_block('built-in/Clock',[sys,'/','Clock'])
set_param([sys,'/','Clock'],...
'hide name',0,...
'Font Name','Arial',...
'position',[445,10,465,30])

add_block('built-in/To Workspace',[sys,'/','To Workspace1'])
set_param([sys,'/','To Workspace1'],...
'hide name',0,...
'Font Name','Arial',...
'mat-name','time',...
'buffer','[5001,1,Ts]',...
'position',[515,8,565,32])
add_line(sys,[30,140;45,140])
add_line(sys,[75,135;85,135])
add_line(sys,[200,135;225,135])
add_line(sys,[250,150;260,150])
add_line(sys,[310,150;340,150])
add_line(sys,[380,150;395,150])
add_line(sys,[420,160;430,160])
add_line(sys,[435,205;385,205;395,170])
add_line(sys,[310,150;325,150;325,195;305,195])
add_line(sys,[265,195;215,195;225,165])
add_line(sys,[340,240;205,240;205,150;225,150])
add_line(sys,[150,80;35,80;45,125])
add_line(sys,[470,20;510,20])
add_line(sys,[480,160;495,160;495,240;380,240])
add_line(sys,[495,205;475,205])
add_line(sys,[325,150;325,80;190,80])
add_line(sys,[325,80;395,80])
add_line(sys,[135,135;145,135])
add_line(sys,[495,160;510,160])

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