looks fine to me.
I can think of a couple of variants, but they are not better.
Important is that the code is readily understandable. ...
+1. Downtime - i.e. troubleshooting while the process is not running and therefore is not
making money - is the primary, and perhaps only, consideration. I am not saying this logic may cause a problem, rather that the less troubleshooting time spent grokking/remembering what this logic is doing means more time spent focusing on finding the actual problem.
Set/Resets lend themselves to being implemented in an ugly way, but that is not the case here: as noted by others, although somewhat of a dog's breakfast
, the Set/Reset instructions are at least very near each other, making it easy to understand.
The [<=] comparison instruction before the Set could be removed (see the red X in the top example of the image below), but it is likely more clear if not removed, and forces the reader to think about the significance of the N.O Contact on the trigger.
The image below may show a couple of the variants @JesperMP was thinking of, and I agree they are not better.
I
might go with the middle one because it is a form of the easily recognized, canonical seal-in-based ladder patterns, and so more easily understood that Set/Reset with all the folderol feeding it, but would be purely a personal preference.
The bottom example is more concise, but it does not fit in as well with OP's original logic, where there are subsequent steps driven by the trigger.
Another consideration is what happens if the PLC cycles power and/or mode: should the value of PASS be reset to 0 if TRIG is not 1 on the first scan, as it would be with the bottom two examples, or would it be best for PASS to keep its value from before the mode cycle as it would with OP's original logic?