A box holding five parts advances along a conveyor, then the counter returns to zero.
The fifth detected part triggers the change from filling the box to moving it along the line.

Controlling the packing cycle

I mapped the part sensor and operator buttons to inputs on the programmable logic controller (PLC), and the conveyor motors to outputs. Each detected part increments the counter. The first four keep the line in its filling step. The fifth triggers the box to advance, after which the count resets for the next box.

Documenting the logic

I documented each of the six rungs of ladder logic and drew a connection diagram for the controller, sensors, buttons and motors. Together, the two views show how a signal from the line changes a controller output.

Checks for the next simulation

I would test what happens if the part sensor stays on after one part passes, or if a filled box fails to clear the station. Those cases would show whether the controller could count a part twice or restart filling too early.