 Timestamp:
 Sep 8, 2013, 1:00:46 PM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/BlockOriented EML/Control Systems/PID_Id.mso
r945 r946 27 27 #Controller Options 28 28 Controller_Mode as Switcher(Valid=["P","I","D","PI","PD","PID"],Default="PID"); 29 Controller_Structure as Switcher(Valid=["Ideal","Approx. Derivative"],Default="Ideal");30 29 31 30 # PID Parameters … … 33 32 TauI as Real(Brief="Integral or reset time",Unit='s'); 34 33 TauD as Real(Brief="Derivative time",Unit='s'); 35 N as Real(Brief=" Divisor terms when the approximative approach",Unit='1/s', Default=100);34 N as Real(Brief="Filter parameter",Unit='1/s', Default=200); 36 35 37 36 … … 39 38 40 39 in e as Real(Brief="Deviation error",Protected=true,PosX=0,PosY=0.5); 41 Inte as Real(Brief="Integral of the error",Hidden=true );42 Diffe as Real(Brief="Derivative of the error",Hidden=true);40 Inte as Real(Brief="Integral of the error",Hidden=true,Unit='s'); 41 ef as Real(Brief="Derivative error filter",Hidden=true); 43 42 44 43 P as Real(Brief="Proportional action",Hidden=true); 45 44 I as Real(Brief="Integral or reset action",Hidden=true); 46 D1 as Real(Brief="Derivative or anticipative action for structure 1",Hidden=true);47 D2 as Real(Brief="Derivative or anticipative action for structure 2",Hidden=true);48 45 D as Real(Brief="Final Derivative or anticipative action",Hidden=true); 49 46 out m as Real(Brief="Controller Output",PosX=1, PosY=0.5,Protected=true); … … 53 50 54 51 "Integral of the error" 55 diff(Inte)*'s'=e; 56 57 "Derivative of the error" 58 Diffe=diff(e)*'s'; 52 diff(Inte)=e; 59 53 60 54 "Proportional action" … … 62 56 63 57 "Integral or reset action" 64 I=Kc*(Inte/TauI)*'s'; 65 66 switch Controller_Structure 67 case "Ideal": 68 "Derivative or anticipative action" 69 D1=Kc*TauD*Diffe/'s'; 70 diff(D2)*'s'=0; 71 D=D1; 72 case "Approx. Derivative": 73 "Derivative or anticipative action" 74 (1/N)*diff(D2)+D2=Kc*TauD*Diffe/'s'; 75 D1=0; 76 D=D2; 77 end 58 I=Kc*(Inte/TauI); 59 60 "Derivative or anticipative action" 61 D=Kc*TauD*diff(ef); 62 63 "Error filter" 64 (1/N)*diff(ef)=eef; 78 65 79 66 #PID Controller equation … … 96 83 INITIAL 97 84 98 Inte=0; 99 D2=0; 85 Inte=0*'s'; 86 diff(ef)*'s'=0; 87 # ef=0; 88 end 100 89 101 end102 90 103 91 #* 104 92 Notes: 105 93 106 (1) The "PID with approximate Derivative" approach of Simulink was implemented too.94 (1) A simple derivativefiltered approach as in Simulink was implemented. 107 95 108 96 (2) The controller modes I and D were added for analysis purposes. 109 97 110 98 111 Revision Date: 0 9.11.201299 Revision Date: 02.09.2013 112 100 113 101 *#
Note: See TracChangeset
for help on using the changeset viewer.