Where is the PLS for M502?
M502 has to be a field device in a maintained state. Likely from a HMI or other operator interface as previously suggested. M502 will not come on through the program according to your PDF. But it is turned off when a series of events occur.
Y005 will not some on because it is missing the conditional statement M501.
The question we need answered is What are M501 and M502? How are they set if not through the program?
HMI is only used to change length in D26 register.