author | laurent |
Tue, 08 Dec 2009 16:26:06 +0100 | |
changeset 229 | ca7bc1324540 |
parent 192 | c6c2a3d487ac |
child 276 | 1679f514f38a |
permissions | -rwxr-xr-x |
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 |