Just found this basic yet interesting article on my rss feed: https://www.controldesign.com/articles/2019/how-to-document-a-plc-program/
It highlight the fact that in real life documenting a PLC software is still considered a simplified version of the “real software documentation” process, unfortunately.
But during reading the referred article https://www.controldesign.com/articles/2017/how-to-write-a-plc-step-sequence-program we should also remember that 61131-3 standard defines an SFC programming language dedicated to step sequence programming https://en.wikipedia.org/wiki/Sequential_function_chart.
Going one step further, i’ve been practicing recently with a very interesting system implementing a complete State Charts Diagram editor as part of a more complex embedded UML editor. Yes, when i mention State Charts I’m talking about this http://www.inf.ed.ac.uk/teaching/courses/seoc/2005_2006/resources/statecharts.pdf