lib/derivative_st.txt
author Catarina Boucinha <ccb@fe.up.pt>
Thu, 02 Jul 2009 11:26:25 +0100
changeset 201 e657008f43d0
parent 192 c6c2a3d487ac
child 276 1679f514f38a
permissions -rwxr-xr-x
Introducing the search_il_operand_type files in the absyntax_utils folder.
The Makefile from absyntax_utils folder and the generate_c_il.cc from the stage4/generate_c
folder was also modified to work with the new search_il_operand_type file.
192
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
     1
 FUNCTION_BLOCK DERIVATIVE
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
     2
   VAR_INPUT
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
     3
     RUN : BOOL ;          (* 0 = reset                  *)
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
     4
     XIN : REAL ;          (* Input to be differentiated *)
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
     5
     CYCLE : TIME ;        (* Sampling period            *)
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
     6
   END_VAR
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
     7
   VAR_OUTPUT
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
     8
     XOUT : REAL ;         (* Differentiated output      *)
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
     9
   END_VAR
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
    10
   VAR X1, X2, X3 : REAL ; END_VAR
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
    11
   IF RUN THEN
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
    12
      XOUT := (3.0 * (XIN - X3) + X1 - X2)
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
    13
              / (10.0 * TIME_TO_REAL(CYCLE)) ;
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
    14
      X3 := X2 ; X2 := X1 ; X1 := XIN ;
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
    15
   ELSE XOUT := 0.0; X1 := XIN ; X2 := XIN ; X3 := XIN ;
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
    16
   END_IF ;
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
    17
 END_FUNCTION_BLOCK
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents:
diff changeset
    18