K1: Mode group, channel, program operation, reset response9.16 Program runtime / Part counterBasic Functions668 Function Manual, 09/2011, 6FC5397-0BP40-2BA0Example 3: Measuring the duration of "mySubProgrammA" and "mySubProgrammC"9.16.2 Workpiece counterFunctionThe "Workpiece counter" function makes available various counters which can be used in particular internally inthe control to count workpieces.The counters exist as channel-specific system variables with read and write access in a range of values from 0 to999,999,999.Channel-specific machine data can be used to control counter activation, counter reset timing and the countingalgorithm.System variables for workpiece countingProgram codeN10 DO $AC_PROG_NET_TIME_TRIGGER=2N20 mySubProgrammAN30 DO $AC_PROG_NET_TIME_TRIGGER=3N40 mySubProgrammBN50 DO $AC_PROG_NET_TIME_TRIGGER=4N60 mySubProgrammCN70 DO $AC_PROG_NET_TIME_TRIGGER=1N80 mySubProgrammDN90 M30System variable Description$AC_REQUIRED_PARTS Number of the workpieces to be produced (setpoint number ofworkpieces)In this counter the number of workpieces at which the actual workpiececount ($AC_ACTUAL_PARTS) will be reset to "0" can be defined.MD27880 can be used to activate the generation of the display alarm:"Channel %1 workpiece target = %2 reached"and of the channel-specific NC/PLC interface signal:DB21, DBX317.2 (workpiece target reached).$AC_TOTAL_PARTS Number of completed workpieces in total (actual workpiece total)This counter specifies the total number of all workpieces producedsince the start time. The value is only automatically reset to "0" whenthe control powers up with default values.