AnnexF/lag1_st.txt
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 06 May 2016 11:48:02 +0300
changeset 1008 59435d4c5e0c
parent 0 fb772792efd1
permissions -rwxr-xr-x
fix compilation error about missing braces

IEC_TIMESPEC has two fields tv_sec and tv_nsec.

Compilation error:
./build/POUS.c:600:45: error: missing braces around initializer [-Werror=missing-braces]
static const STEP temp_step = {{0, 0}, 0, {0, 0}};
^
compilation terminated due to -Wfatal-errors.
 FUNCTION_BLOCK LAG1
   VAR_INPUT
     RUN : BOOL ;     (* 1 = run, 0 = reset *)
     XIN : REAL ;     (* Input variable *)
     TAU : TIME ;     (* Filter time constant *)
     CYCLE : TIME ;   (* Sampling time interval *)
   END_VAR
   VAR_OUTPUT XOUT : REAL ; END_VAR  (* Filtered output *)
   VAR K : REAL ;     (* Smoothing constant, 0.0<=K<1.0 *)
   END_VAR
   IF RUN THEN XOUT := XOUT + K * (XIN - XOUT) ;
   ELSE XOUT := XIN ;
        K := TIME_TO_REAL(CYCLE) / TIME_TO_REAL(CYCLE + TAU) ;
   END_IF ;
 END_FUNCTION_BLOCK