function [ZVe,NVe,Q,IN,OU,MT,NV,BRF]=struc011(SOR,OU,P1,P2)
%        [ZVe,NVe,Q,IN,OU,MT,NV,BRF]=struc011(SOR,OU,P1,P2)
%STRUC011 S(book:ex1/par3-d/PI): Par=[VS T1];
%                                Reg=[VR VRd1];
%         easy single control loop - delayed input signal,
%         example 1 paragraph 3 in book "Entwurf digitaler Regler für
%         elektrische Antriebe", Geitner, VDE-Verlag 1996;
%	      structure and simulation see SIST010.mdl; loop design:
%         loop: pre-filter, PI-type controller, one first-order time-delay
%               element, mean value measurement

%AUXILIARY FILE for symbolical definition - no stand-alone calling !!!
%	  SOR:   switch - to shift between plant or control structure
%	  OU:    vector using continuous output numbers for discretized plant state
%            description
%     P1,P2: posibility of any parameter transfer via bod_es.m

% KEY WORDS: Digital Magnitude Optimum, symbolical plant and control structure
%            definition, application basis for: bod_es. / bod_esg.m / bod_esp.m

% Copyright (c) 2011-2023 Dr. Gert-Helge Geitner, TU Dresden,
%                     https://wwwpub.zih.tu-dresden.de/~geitner/ae_1_0e.htm
% Digital Magnitude Optimum reference: Geitner, G.-H.:
%                    Entwurf digitaler Regler für elektrische Antriebe.
%                    VDE-Verlag GmbH Berlin und Offenbach 1996
%                    ISBN 3-8007-1847-2

if SOR==0  %plant structure definition

% ****** beginning ******

sz1='VS;';  sn1='[T1 1];';
 Q=[1 0]; IN=[1]; OU=[1];
 MT=[0 2];
 NV=['VS; T1; '];
% ****** ending ******

s=0; zae=0; ZVe=[]; NVe=[]; BRF=0;
while s==0 zae=zae+1;  eval(['ZVe=[ZVe sz' num2str(zae) '];'],'s=1;');
                       eval(['NVe=[NVe sn' num2str(zae) '];'],'s=1;'); end

else  %control structure definition

% ******* beginning ******

rz2='[VR VRd1];';           rn2='[1 -1];';
rz3='(1+VRd1/VR);';         rn3='[1 VRd1/VR];';
QQ=[1 2  0
    2 3 -1
    3 0  0];
BME=[3];
BMA=[1];
 BM=[2
     0];  BRF=1;
NV=['VR; VRd1; '];
% ****** ending ******

s=0; zae=length(OU); ZVe=[]; NVe=[];
while s==0 zae=zae+1;  eval(['ZVe=[ZVe rz' num2str(zae) '];'],'s=1;');
                       eval(['NVe=[NVe rn' num2str(zae) '];'],'s=1;'); end
Q=QQ;IN=BME;OU=BMA;MT=BM;
end
