## 3 Methodology
### Automated PLC Code Generation and Operation on the Physical Equipment  
Figure 10 illustrates the process for automatic generation of PLC code from the Simulink model. The validated model was exported from the MBD platform using the Simulink PLC coder tool to the relevant equipment IDE, providing a hardware-independent IEC 61131-3 compliant code from the modelling environment. The model was exported as an Add On Instruction (AOI) for the Rockwell Automation Studio 5000 programming environment. Once imported into Studio 5000, the AOI was inserted into a ladder diagram routine containing the MAM instruction. The required inputs for both the imported AOI and the MAM instruction were then mapped to the relevant data tags required for operation within the routine.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**ID** & **Summary** & **Description** \\ \hline
1 & Initialise State & The system must Initialise into the Idle state \\ \hline
2 & Idle to Running Transition & When the system is idle and the start input becomes true, then it must transition into the Running state and execute the running logic. \\ \hline
3 & Running to Holding Transition & When the Running state is active and the hold command becomes true, then it must transition to the holding state and execute the holding logic. \\ \hline
4 & Holding to Held Transition & Once the holding logic has been executed, the system must transition to the Held state. \\ \hline
5 & Held to Restarting Transition & When the Held state is active and the Restart command becomes true, then the system must transition to the Restarting state and execute the restarting logic. \\ \hline
6 & Restarting to Running Transition & Once the restarting logic is complete, the system must transition to the Running state. \\ \hline
7 & Restarting to Holding Transition & When the Restarting state is active and the hold command becomes true, then the system must transition to the Holding state and execute the holding logic. \\ \hline
8 & Running to Complete Transition & When the running logic is complete, the system must transition from the Running state to the Complete state. \\ \hline
9 & Complete to Resetting & When the Complete state is active and the Reset command becomes true, then the system must transition to the Resetting state and execute the resetting logic. \\ \hline
10 & Resetting to Idle Transition & Once the Resetting logic is complete, the system must transition to the Idle state. \\ \hline
11 & Transition to Stopping & If the stop command becomes true, then the system must immediately transition to the Stopping state and execute the stopping logic. \\ \hline
12 & Stopping to Stopped Transition & Once the stopping logic is complete the system must transition to the Stopped state. \\ \hline
13 & Stopped to Resetting Transition & When the Stopped state is active and the Reset command becomes true, then the system must transition to the Resetting state and execute the resetting logic. \\ \hline
14 & Transition to Aborting & If the abort command becomes true, then the system must immediately transition to the Aborting state and execute the Aborting logic. \\ \hline
15 & Aborting to Aborted Transition & Once the Aborting logic is complete the system must transition to the Aborted state. \\ \hline
16 & Aborted to Resetting Transition & When the Aborted state is active and the Reset command becomes true, then the system must transition to the Resetting state and execute the resetting logic. \\ \hline \hline \end{tabular}
\end{table}
Table 3: Summary of sixteen functional requirements describing the model behaviour.