## 3 The Proposed Model and Methods
### ANN-Based Embedded Data-Driven Controller Design
#### 3.2.2 Training of the ANN for the PLC Algorithm  
Nonlinear systems, like the fluidic muscle press station, generate multiple system responses from the control variable. In the fluidic muscle press station case, static force and displacement outputs were obtained from the applied input pressure. Instead of using a single neural network model for estimating the force and displacement responses, we divided the neural network (NN) training process into two discrete sections: one for displacement and the other for generated static force. The employment of two separate artificial neural networks (ANNs) in a cascaded manner is driven by the advantages of modularity and customization. The selection of multiple ANNs allows for each to fulfill a specific task, facilitating easier training and the fine tuning of each network individually.  
The first neural network was trained to generate the required pressure output for the desired displacement, and the second neural network predicted the generated static force according to the pressure control signal. After the training process, the first neural network's output is connected to the second one's input. With this method, a nonlinear system with one input and two outputs can be easily trained as two discrete single-input, single-output networks with limited training data. After training, it aims to reduce the system to a single control block by cascading the two networks. Thus, the input of the second network, which predicts the force to be produced as a result of contraction, will be the pressure control signal generated by the first network instead of the desired displacement value provided as raw data. As a result, the separately trained system can be expressed in a single control block and consistent outputs can be obtained.  
The hyperparameter of the feedforward backpropagation neural network architecture, as illustrated in Figure 9, is selected empirically as a single hidden layer containing four neurons with the Hyperbolic Tangent Sigmoid transfer function given in (8) for both networks.  
\[tansig(n)=2/(1+e^{-2n})-1 \tag{8}\]  
The selection of a single-layered architecture with four neurons is motivated by the desire to mitigate the risk of overfitting associated with more complex structures, thus enhancing the model's generalization capability. One of the primary motivations for selecting the sigmoid transfer function is its bounded output range and linearity. Additionally, its suitability for practical implementation in Simulink for generating PLC code is a significant factor. Given its smooth and continuous nature, the sigmoid function aligns well with the  
Figure 8: Displacement and force response of the PAM-actuated pressing unit.  
requirements of Simulink-based control system design, facilitating seamless integration into the PLC code generation process for embedded controller design for Edge AI.  
The MATLAB 2017b with Neural Network Toolbox 11.0 was used to train the network. The Levenberg-Marquardt algorithm was used for training processes due to its well-established efficiency in optimizing neural network parameters, especially in scenarios with complex and nonlinear relationships between input and output variables [31]. The experimentally collected data were randomly partitioned into 70% for training, 15% for validation, and 15% for testing purposes. Subsequently, the network training procedure was executed, iteratively adjusting network weights and biases to minimize the discrepancy between predicted and actual outputs. The performance of the neural networks was evaluated based on the Mean Square Error (MSE), with the results depicted in Figure 10a for displacement-pressure and Figure 10b for pressure-static force relationships. Figure 10 shows the relationship between the output of the networks developed for modeling and the targeted values obtained from the experimental results, as visualized through regression charts during the training, validation, and testing phases.