tag:blogger.com,1999:blog-25111109.post114493555084278386..comments2020-05-25T17:46:50.557+02:00Comments on MGCplus FAN corner: MGCmasterhttp://www.blogger.com/profile/11714595649505824837noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-25111109.post-1145432858264693852006-04-19T09:47:00.000+02:002006-04-19T09:47:00.000+02:00ML70(B) can be used for many applications. Below t...ML70(B) can be used for many applications. Below there is source text representing export code from codesys. Here you can perform fast online averaging (not only for ML70).<BR/><BR/><BR/>(* @PATH := '\/specfun\/filter\/average' *)<BR/>(* @SYMFILEFLAGS := '0' *)<BR/>FUNCTION_BLOCK average_real (* Online average calculation over N values *)<BR/>VAR_INPUT (* IN : signal of type REAL *)<BR/> IN: REAL; (* N : number of values to consider (INT) *)<BR/> N: INT; (* 2 <= N <=100 *)<BR/> reset: BOOL; (* reset : When TRUE, output OUT is set to zero *)<BR/>END_VAR (* and "history buffer is cleared *)<BR/>VAR_OUTPUT (* OUT : result is average over history *)<BR/> OUT: REAL;<BR/>END_VAR<BR/>VAR<BR/> a: ARRAY [0..99] OF REAL;<BR/> k: INT;<BR/> p: INT;<BR/> summe: REAL;<BR/>END_VAR<BR/>(* @END_DECLARATION := '0' *)<BR/>IF N>100 THEN<BR/> N:=100;<BR/>ELSE<BR/> IF N<2 THEN<BR/> N:=2;<BR/> END_IF;<BR/>END_IF;<BR/>IF NOT reset THEN<BR/> summe:=summe-a[k];<BR/> a[k]:=IN;<BR/> summe:=summe+IN;<BR/> k:=k+1;<BR/> IF k>=N THEN<BR/> k:=0;<BR/> END_IF<BR/> OUT:=summe/INT_TO_REAL(N);<BR/>ELSE<BR/> OUT:=0;<BR/> summe:=0;<BR/> FOR p:=0 TO N-1 DO;<BR/> a[p]:=0;<BR/> END_FOR;<BR/>END_IF;<BR/>END_FUNCTION_BLOCKAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-25111109.post-1145346812712599422006-04-18T09:53:00.000+02:002006-04-18T09:53:00.000+02:00Hi, are there anywhere the CoDeSys programs for ML...Hi, are there anywhere the CoDeSys programs for ML70 or ML70B available for download ?Anonymousnoreply@blogger.com