At the moment it is already possible to use Set own diagnosis messages via the ctrlX DataLayer. See more information in the online documentation. Simply click the "view in document" button to open this topic in the document.
For the PLC there should be also some functions already. I will check that and add a comment here.
EDIT:
See topic "Recommended method to identify new diagnostic error/warning?" for new information using library CXAC_Diagnostics.
... View more