echo on
% Demo for use of bran_au.m and subsequently bran_aug.m
% Given: controlled process in Laplace-domain: a two-mass system with
%        electrical motor according a paper in "Automatisierungstechnik"
%        at 35 (1987) 7, p. 275 / 283,
%        Oldenbourg Verlag (publishing house) Muenchen, Germany
% 	 T   = sampling time
%        Tel = remining time constant (current control: closed loop)
%	 TM  = mechanical motor time constant
%	 TF  = spring time constant
%	 TL  = load time constant
%
% Asked: controller gains of a digital state space controller structure,
%        use of Digital Amount Optimum (BOD)
%        K1 = controller gain for differential speed
%        K2 = controller gain for spring torque
%        K3 = controller gain for dynamic error of the motor speed
%        DEMO_3: Disturbance variable and command variable action

pause,           % please press any key

%definition of process time constants
T=1; Tel=4; TM=30; TF=5; TL=30;   % values in milliseconds

% transformation of the controlled process into Z-domain and computation
% of the controller gains as DEMO-solution for other controlled processes
% use of Digital Amount Optimum (BOD)

erg=bran_au(T,Tel,TM,TF,TL)       % please wait

K1=erg(1); K2=erg(2); K3=erg(3);  % preparation for SIMULINK

pause,           %  please press any key

% First SIMULINK-simulation for command variable action (step response)
% by use of br_si_jo.m
% you see motor speed, load speed and differential speed

		 % please press any key
pause,		 % select "simulation" and than "start"
br_si_jo

% Finally SIMULINK-simulation for disturbance variable action (step response)
% by use of brsistjo.m
% you see motor speed, load speed and differential speed

K4=-(1+K2),      % given by use of limes-problem
		 % please press any key
pause,		 % select "simulation" and than "start"
brsistjo
echo off
