How can I determine the number of pieces per minute in a STEP 7 program?
You want to determine the number of pieces via a STEP 7 program. The counter must be flexibly programmable due to the time period. It would be interesting to determine the number of pieces per minute or per hour. Values greater than 10,000 per hour are possible.
In this sample program we have created a piece counter that can be called in the organization block OB35.
The counter has a monitoring range of "n * 1 minute (n=1,2...)". The counter input is activated by an edge at the start input and the monitoring time starts. After expiry of the monitoring time the counter value is output. It remains until another time period is started and a new counter value output or until the input of "reset" deletes the value.
Detailed description of the function FC100:
The function FC100 provides a flexible piece counter. The positive edges of the "trigger" counter signal are counted when the counter is started via "start". The monitoring period is specified in minutes at the input "per_minute". After expiry of the time period the result is transferred to the variable "value". Via the "reset" input you can reset the counter result to "Zero" during the monitoring period. Then only the subsequent pulses to the end of the monitoring period are counted.
The example contains a STEP 7 V5 project with the described function and a sample call from the OB35. You can adapt the function as you wish to suit your requirements.
Copy the "cnt_piec.exe" file into a separate directory and then start it with a double-click. The S7 V5 project is now unpacked with all the associated subdirectories. You can then open and process the unpacked project with the SIMATIC Manager.