function [ZVe,NVe,Q,IN,OU,MT,NV,BRF]=struc001(SOR,OU,P1,P2)
%        [ZVe,NVe,Q,IN,OU,MT,NV,BRF]=struc001(SOR,OU,P1,P2)
%STRUC001 K(2S):Par=[VS1 T1 VS2 T2 T3];
%               Reg=[VR1 d11 VR2 d21 d22];
%         two loops cascade structure - undelayed input signales,
%         example see also paragraph 5.4 in book "Entwurf digitaler Regler für
%         elektrische Antriebe", Geitner, VDE-Verlag 1996;
%	      structure and simulation see SIST001.mdl; loop design:
%         inner loop: PI-type controller,  one first-order time-delay element,
%	      outer loop: PID-type controller, two first-order time-delay elements

%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='VS1;';   sn1='[T1 1];';
sz2='VS2;';   sn2='conv([T2 1],[T3 1]);';
 Q=[1 0
    2 1]; IN=[1]; OU=[1 2];
 MT=[0 1
     0 1];
 NV=['VS1; T1; VS2; T2; T3; '];
%****** 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 ******

rz3='[VR1 VR1d11];';               rn3='[1 -1];';
rz4='[VR2 VR2d21 VR2d22];';        rn4='[1 -1];';
QQ=[1  3  0
    2  3  0
    3  4 -1
    4 -2  0];
BME=[3
     4];
BMA=[1
     2];
 BM=[2
     3
     0];  BRF=1;
NV=['VR1; VR1d11; VR2; VR2d21; VR2d22; '];
%****** 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
