Hi
i am by no means a cicode expert in fact i struggle with code. as a plant electrician i can do alarms, graphis, trends etc.
i have citect V7.2 and i am trying to count the amount of devices that are running to display as a integer value "D1_FIB_TOT_RUNNING " .
i have the tags D1_FIB_1_RUN etc addressed as I1, I2 and so on in my database as integers to a Diskplc (memory)I/O device and can read/write to these tags.
the tags CW_D1F1CH_OUT are existing digital tags from the process. i call the function
D1_Fib_Run() from the events form every 10 seconds as a Global event.
what syntax do i have wrong ?
thanks in advance.
EICS.
FUNCTIOND1_Fib_Run()
IF CW_D1F1CH_OUT ANDNOT CW_D1F1CH_IN THEN D1_FIB_1_RUN = 1ELSE0;
IF CW_D1F2CH_OUT ANDNOT CW_D1F2CH_IN THEN D1_FIB_2_RUN = 1ELSE0;
IF CW_D1F3CH_OUT ANDNOT CW_D1F3CH_IN THEN D1_FIB_3_RUN = 1ELSE0;
IF CW_D1F4CH_OUT ANDNOT CW_D1F4CH_IN THEN D1_FIB_4_RUN = 1ELSE0;
IF CW_D1F5CH_OUT ANDNOT CW_D1F5CH_IN THEN D1_FIB_5_RUN = 1ELSE0;
D1_FIB_TOT_RUNNING = D1_FIB_1_RUN + D1_FIB_2_RUN + D1_FIB_3_RUN + D1_FIB_4_RUN + D1_FIB_5_RUN;
END
END
END
END
END
END
i am by no means a cicode expert in fact i struggle with code. as a plant electrician i can do alarms, graphis, trends etc.
i have citect V7.2 and i am trying to count the amount of devices that are running to display as a integer value "D1_FIB_TOT_RUNNING " .
i have the tags D1_FIB_1_RUN etc addressed as I1, I2 and so on in my database as integers to a Diskplc (memory)I/O device and can read/write to these tags.
the tags CW_D1F1CH_OUT are existing digital tags from the process. i call the function
D1_Fib_Run() from the events form every 10 seconds as a Global event.
what syntax do i have wrong ?
thanks in advance.
EICS.
FUNCTIOND1_Fib_Run()
IF CW_D1F1CH_OUT ANDNOT CW_D1F1CH_IN THEN D1_FIB_1_RUN = 1ELSE0;
IF CW_D1F2CH_OUT ANDNOT CW_D1F2CH_IN THEN D1_FIB_2_RUN = 1ELSE0;
IF CW_D1F3CH_OUT ANDNOT CW_D1F3CH_IN THEN D1_FIB_3_RUN = 1ELSE0;
IF CW_D1F4CH_OUT ANDNOT CW_D1F4CH_IN THEN D1_FIB_4_RUN = 1ELSE0;
IF CW_D1F5CH_OUT ANDNOT CW_D1F5CH_IN THEN D1_FIB_5_RUN = 1ELSE0;
D1_FIB_TOT_RUNNING = D1_FIB_1_RUN + D1_FIB_2_RUN + D1_FIB_3_RUN + D1_FIB_4_RUN + D1_FIB_5_RUN;
END
END
END
END
END
END
Last edited: