In order to integrate all of the smaller functions required in the larger program as whole a modular approach was taken. To facilitate this, each of the smaller functions was coded inside of a function call with its own state and memory space.

The overall hierarchy of the program is one continuously running sequential state machine which enables, disables and clears the associated memory of the smaller state machines as required. To allow for smooth operation and easier debugging, the state memory of each function call block was either cleared and reinitialised or just cleared and  on entry or exit of the function respectively.

During development, bugs were occasionally found in some of the sub-functions but this approach allowed for these to be isolated within only their section of the main program and for easy diagnosis. These are discussed in the Project Review under Notable Issues and Solutions.

This method implementing the project had a number of benefits but also added more complexity where the PLC would be in multiple states at once, namely one main state plus one lighting state and/or one action state. This was considered to be more of an advantage than a hindrance given the tasks at hand.