Next Article in Journal
A Game-Theoretic Kendall’s Coefficient Weighting Framework for Evaluating Autonomous Path Planning Intelligence
Previous Article in Journal
AI for Academic Integrity: GPU-Free Pose Estimation Framework for Automated Invigilation
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Dynamic Tuning of PLC-Based Built-In PID Controller Using PSO-MANFIS Hybrid Algorithm via OPC Server

1
Department of Electrical & Electronics Engineering, Universiti of Tenaga Nasional (UNITEN), Kajang 43000, Malaysia
2
Department of Cyber Security Engineering, College of Engineering, Al-Maaqal University, Basra 31001, Iraq
*
Author to whom correspondence should be addressed.
Automation 2025, 6(4), 83; https://doi.org/10.3390/automation6040083 (registering DOI)
Submission received: 19 September 2025 / Revised: 7 November 2025 / Accepted: 19 November 2025 / Published: 2 December 2025

Abstract

In modern industrial automation, optimizing the performance of Programmable Logic Controller (PLC)-based PID controllers is critical for ensuring precise process control. This study presents a novel methodology for the dynamic tuning of built-in Proportional-Integral-Derivative (PID) controllers in PLCs using a hybrid algorithm that combines Particle Swarm Optimization (PSO) and Multiple-Adaptive Neuro-Fuzzy Inference System (MANFIS). Classical PID tuning methods, such as Ziegler–Nichols and Cohen–Coon, have traditionally been employed in industrial control systems. However, these methods often struggle to address the complexities of nonlinear, time-varying, or highly dynamic processes, resulting in suboptimal performance and limited adaptability. To overcome these challenges, the proposed PSO-MANFIS hybrid algorithm leverages the global search capabilities of PSO and the adaptive learning abilities of MANFIS to optimize PID parameters in real-time dynamically. Integrating MATLAB (R2021a) with industrial automation systems via an OPC (OLE for Process Control) server utilizes advanced optimization algorithms within MATLAB to obtain the best possible parameters for the industrial PID controller, enhancing control precision and optimizing production efficiency. This MATLAB-PLC interface facilitates seamless communication, enabling real-time monitoring, data analysis, and the implementation of sophisticated computational tools in industrial environments. Experimental results demonstrate superior performance, with reductions in rise time from 93.01 s to 70.98 s, settling time from 165.28 s to 128.84 s, and overshoot eliminated from 0.0012% to 0% of the controller response compared to conventional tuning. Furthermore, the proposed approach achieves a reduction in Root Mean Square Error (RMSE) by approximately 56% to 74% when compared with the baseline performance. By integrating MATLAB’s computational capabilities with PLC-based industrial automation, this study provides a practical and innovative solution for modern industries, offering enhanced adaptability, precision, and reliability in dynamic control applications, ultimately leading to optimized production outcomes.

1. Introduction

In modern industrial automation, control systems’ efficiency, precision, and adaptability are vital to maintaining high-quality production and minimizing operational costs [1,2,3,4]. Programmable Logic Controllers (PLCs) form the core of industrial automation, and their embedded control algorithms, particularly the ubiquitous Proportional-Integral-Derivative (PID) controller, are fundamental for achieving accurate and stable process regulation [5,6,7,8]. Historically, various methods have been developed for tuning these PID controller parameters. Classical tuning techniques such as the Ziegler–Nichols, the Cohen–Coon method, and internal model control (IMC)—based tuning rules have provided foundational approaches for establishing initial controller settings in various industrial applications. These techniques are simple and effective for linear or moderately dynamic systems, but they often yield suboptimal results when applied to nonlinear, time-varying, or highly dynamic processes. The inherent limitations of fixed PID parameters in adapting to such dynamic conditions necessitate exploring more advanced control strategies capable of real-time parameter adjustment. To address these limitations, researchers have explored advanced tuning strategies, including metaheuristic optimization, fuzzy logic-based approaches, and artificial intelligence-based techniques. These strategies have demonstrated significant improvements in controller performance by minimizing overshoot, rise time, and settling time [9,10,11,12].
Fuzzy logic-based PID tuning has been introduced as a more flexible, rule-based alternative. Fuzzy logic controllers (FLCs) utilize linguistic rules to mimic human reasoning and decision-making, effectively handling system nonlinearity and imprecision. Fuzzy PID tuners can dynamically adjust controller parameters in response to changes in system behavior, enhancing robustness and adaptability [13]. The study [14] developed a fuzzy-PD-based fine-tuning mechanism to improve PID controllers in Programmable Logic Controllers (PLCs), specifically addressing standard PLCs’ lack of self-tuning capabilities. The proposed method, implemented using MATLAB/Simulink and deployed on a Siemens S7-1200 PLC, successfully enhanced system stability and reduced overshoot and steady-state error in a thermal control application compared to the built-in auto-tuning tool. The study [15] developed a self-tuning PID controller for a quadcopter by integrating a simple Fuzzy logic algorithm, which dynamically adjusts the PID parameters based on real-time errors and error rates. Simulation results showed that the Fuzzy PID controller achieved better trajectory tracking performance across various flight paths than the conventional PID controller, as indicated by lower error metrics (IAE, ISE, RMSE). The study [16] conducted a comparative analysis of a fuzzy logic controller (FLC) and a traditional proportional-integral-derivative (PID) controller for liquid level regulation, highlighting the FLC’s superior performance in managing nonlinear dynamics and process fluctuations. The experimental results demonstrated significant improvements with the FLC, including a 21% reduction in maximum overshoot and an 83% decrease in settling time, showcasing its potential for industrial and educational applications. The study [17] presented a hybrid control strategy for DC servo motors by integrating an Ant Colony System (ACS)—based optimization with a fuzzy self-tuning PID controller. The ACS algorithm first determines optimal PID gains, which are then fine-tuned in real-time using fuzzy logic to adapt to system changes, improving control performance under varying load and parameter conditions.
However, fuzzy rule sets and membership function design can be subjective and require expert knowledge or trial-and-error methods to achieve optimal tuning. A significant advancement in intelligent control systems is the integration of Adaptive Neuro-Fuzzy Inference Systems (ANFIS), which combine the learning capability of neural networks with the linguistic reasoning of fuzzy logic. By learning from data, ANFIS-based PID tuning can adaptively model complex system dynamics, resulting in improved control accuracy and stability [18]. The study [19] developed a nonlinear adaptive control system based on an Adaptive Neuro-Fuzzy Inference System (ANFIS) to regulate the pH of nutrient solutions in plant factories accurately, addressing challenges such as strong nonlinearity, parameter uncertainty, and multiple disturbances. Combining linear and nonlinear generalized predictive controllers with a switching mechanism significantly improved control accuracy over traditional PID strategies, ensuring a better growth environment for crops and potentially increasing yield. The study [20] compared two control strategies—PID and ANFIS—for optimizing the speed control of Brushless DC (BLDC) motors. While PID controllers are more straightforward and effective for linear systems, ANFIS controllers provide better speed accuracy and transient response in complex, nonlinear systems. The study [21] evaluated the performance of a hybrid ANFIS-PID controller for Brushless DC (BLDC) motors, focusing on speed regulation and reduction in harmonic distortion. Through MATLAB/Simulink simulations, the ANFIS-PID controller demonstrated superior accuracy and lower Total Harmonic Distortion (THD) compared to conventional controllers, making it well-suited for applications like electric vehicles and industrial automation. The study [22] proposed a hybrid Adaptive Neuro-Fuzzy Inference System (ANFIS)-based PID controller for DC motor speed control, combining neural networks and fuzzy logic using a Tagaki–Sugeno–Kang fuzzy inference system. MATLAB/Simulink simulations demonstrate that the ANFIS-PID controller significantly outperforms the conventional PID controller in transient and frequency response characteristics, showing reduced rise time, overshoot, and error metrics.
Nevertheless, standalone ANFIS models may converge to local minima or require careful initialization, limiting their effectiveness in high-dimensional or rapidly changing environments. Particle Swarm Optimization (PSO) was used to optimize the conventional PID. Inspired by the collective behavior of social animals, PSO is a population-based optimization algorithm capable of exploring the parameter space globally [23]. The study [24] designed and implemented a PID controller for regulating the pH level in a cooling tower at a fertilizer plant, replacing inefficient manual acid dosing. The PID controller was tuned using three methods—Ziegler–Nichols, MATLAB Tuner, and Particle Swarm Optimization (PSO)—with PSO delivering the best response time, overshoot, and stability performance. The study [25] proposed a hybrid method combining Particle Swarm Optimization (PSO) and a Fuzzy Algorithm (FA) to optimize PID controller parameters more effectively. By using fuzzy logic to adjust the PSO’s inertia weight dynamically, the method improved convergence speed and stability compared to PSO alone, leading to better control system performance. The study [26] applied Particle Swarm Optimization (PSO) to optimize PID controller parameters in cascade control loops, aiming to enhance system performance by improving stability, response time, and disturbance rejection. The method achieved significant improvement in control accuracy by simulating various PID parameter combinations and minimizing the Integral Time Absolute Error (ITAE). It demonstrated robust convergence through graphical analyses and performance metrics. The study [27] proposes a novel method for tuning PID controllers using a modified Particle Swarm Optimization (PSO) algorithm that automatically adjusts its hyperparameters, eliminating manual calibration. The approach optimizes multiple performance objectives—error, control action smoothness, and settling time—under user-defined constraints. It is validated on a thermal system using a Peltier cell, demonstrating improved tuning accuracy and adaptability.
Hybrid approaches such as PSO-ANFIS have been developed to enhance tuning performance further. The study [28] presented a novel real-time frequency regulation system for standalone synchronous generators using an induction motor and a PSO-Fuzzy PID controller. It experimentally compares three control strategies—PLC-based PID, Fuzzy PID, and PSO-Fuzzy PID—demonstrating that the PSO-Fuzzy PID controller significantly improves dynamic performance, reduces overshoot and settling time, and is well-suited for industrial applications under varying load conditions. The study [29] compared the performance of three predictive models—an Artificial Neural Network (ANN), an Adaptive Neuro-Fuzzy Inference System (ANFIS), and a hybrid PSO-ANFIS model—for forecasting energy consumption in university student residences based on climatic variables. The results showed that the PSO-ANFIS model significantly outperformed the standalone ANN and ANFIS models in terms of accuracy, making it a more effective tool for optimizing energy usage in campus housing. The study [30] developed a senseless control system for permanent magnet brushless DC (PMBLDC) motors by combining a Particle Swarm Optimization (PSO)-trained Adaptive Neuro-Fuzzy Inference System (ANFIS) to detect zero-crossing points (ZCPs) of back electromotive force from terminal voltages. The proposed hybrid method was implemented and validated in MATLAB/Simulink, showing improved performance in speed regulation and error minimization compared to other soft computing techniques. The study [31] proposed a model that dynamically tunes the parameters of an Adaptive Neuro-Fuzzy Inference System (ANFIS) using Particle Swarm Optimization (PSO) to improve predictive performance on time-series data. The hybrid ANFIS-PSO approach outperformed various machine learning algorithms by achieving lower error rates and higher accuracy across multiple evaluation metrics such as MSE, RMSE, MAE, and R2. The study [32] developed and implemented a hybrid PSO–MANFIS (Particle Swarm Optimization—Multiple Adaptive Neuro-Fuzzy Inference System) algorithm to optimize PID controller parameters for pH regulation in industrial cooling towers. By leveraging real-time data from a fertilizer plant, the hybrid model significantly improved control accuracy, reduced energy and chemical usage, and minimized mechanical equipment damage compared to traditional tuning methods. When combined with ANFIS, PSO can optimize the initial parameters or structure of the neuro-fuzzy model, leading to better convergence and tuning results. PSO-ANFISs have demonstrated improved responsiveness and reduced error in various control applications. Despite their strengths, standalone PSO or ANFIS methods may still face challenges in achieving rapid convergence and precise adaptation in highly dynamic industrial environments.
To overcome these challenges, this study presents a novel methodology for the dynamic tuning of built-in PID controllers in PLCs by employing a hybrid algorithm that synergistically combines the global exploration capabilities of Particle Swarm Optimization (PSO) with the adaptive learning prowess of the Multiple-Adaptive Neuro-Fuzzy Inference System (MANFIS). The proposed PSO-MANFIS hybrid algorithm aims to transcend the limitations of traditional tuning methods by continuously optimizing PID parameters in response to evolving process conditions. A seamless communication interface between MATLAB and the PLC system is established via an OPC (OLE for Process Control) server to facilitate the practical implementation and rigorous evaluation of this approach within an industrial setting. This integration leverages MATLAB’s advanced computational and optimization capabilities to determine the optimal PID parameters for the industrial controller. The resulting MATLAB-PLC communication framework enables real-time monitoring, comprehensive data analysis, and the deployment of sophisticated computational tools within industrial environments. The efficacy of the proposed methodology is validated through experimental results, which demonstrate significant improvements in control performance, including reduced settling time, rise time, and overshoot, compared to conventional MATLAB Tuner tuning methods. By integrating MATLAB’s computational capabilities with PLC-based industrial automation, this study provides a practical and innovative solution for modern industries seeking to enhance their dynamic control applications’ adaptability, precision, and reliability, ultimately contributing to optimized production outcomes.
As a summary of related PID tuning techniques (References [13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]) versus the proposed PSO-MANFIS, Table 1 presents a comparison of previous hybrid PID tuning techniques (fuzzy algorithms, ANFIS, PSO, PSO-ANFIS, PSO-MANFIS) alongside the proposed PSO-MANFIS with PLC built-in PID technique, listing key features such as real-time capability, hardware platform, performance improvements, and limitations. As seen, many studies are simulation-centric or tune stand-alone controllers; comparatively fewer operate online on industrial PLC hardware, and even fewer adapt the built-in PLC PID in real time. The proposed approach (PSO-MANFIS + OPC) targets this gap by continuously fine-tuning the Gain, Ti, and Td of the Siemens controller block during operation.

1.1. Research Contributions

In contrast to conventional and advanced control approaches such as Model Predictive Control (MPC), fuzzy-PID, and ANFIS-based tuning, the present study introduces a dynamic PSO–MANFIS hybrid tuning framework integrated with industrial PLC systems through an OPC server. The specific contributions of this work are summarized as follows:
  • Hybrid PSO–MANFIS Tuning Framework: A novel hybrid algorithm that combines the global optimization capability of PSO with the adaptive learning of MANFIS is proposed to tune PLC-based built-in PID parameters dynamically in real time.
  • Real-Time MATLAB–PLC Integration: Unlike previous studies that rely solely on simulation environments, this study achieves practical real-time tuning through OPC-based communication between MATLAB and Siemens PLC hardware.
  • Dynamic Industrial Implementation: The proposed method is experimentally validated using a real industrial setup (Siemens S7-300 PLC, VFD, and asynchronous motor), demonstrating improved rise time, settling time, and overshoot compared to both MATLAB-tuned and MPC-based controllers.
  • Enhanced Adaptability and Robustness: The hybrid controller effectively handles nonlinear and time-varying process dynamics, achieving better adaptability and transient performance than traditional PID and predictive control approaches.
Overall, this work bridges the gap between intelligent computational algorithms and industrial control systems by providing a scalable, real-time, hardware-compatible hybrid tuning methodology that enhances the performance of PLC-based controllers in dynamic environments.

1.2. Paper Organization

The remainder of this paper is organized as follows.
Section 2 presents the overall system design and implementation, including the configuration of the PLC-based speed controller, data acquisition, and MATLAB–PLC integration via the OPC server. It also discusses the proposed dynamic PSO–MANFIS hybrid algorithm and its role in real-time PID parameter optimization.
Section 3 provides the experimental results and discussion, highlighting the performance improvements achieved through the hybrid tuning approach.
Finally, Section 4 concludes the paper by summarizing the key findings and outlining potential directions for future research.

2. System Design and Implementation

This section covers the practical part of the study. The PLC-based built-in PID controller will be designed based on real-time data collection and fine-tuned using the PSO-MANFIS hybrid algorithm via the OPC server. This section is divided into five subsections as follows.

2.1. Hardware Configuration and Data Acquisition

In the industrial field, the industrial PID controller is named according to the elements of the industrial process. The industrial process consists of elements: pressure, level, flow rate, temperature, speed, and chemical. Table 2 presents the elements of the industrial process and their corresponding industrial PID controllers.
In this study, the SIC (speed controller) will be taken as a case study.

2.1.1. Speed Controller Components

The components of the speed controller are as follows:
  • Control panel
The control panel features a PLC-based design, including the Siemens PLC S7 300. The CPU model is CPU 315 2PN/DP, along with its accessories. Reference [33] illustrates the design and implementation of this panel.
2.
Sensor
The IG5397 (model IGA3005-BPKG) is an inductive proximity sensor designed for detecting metal objects without physical contact. It is commonly used to convert motor rotation into frequency. The sensor manual is a reference [34].
3.
Converter
The Universal Frequency Transducer model MCR-F-UI-DC is an industrial automation device manufactured by Phoenix Contact. It is designed to convert frequency signals (from the inductive proximity sensor) into standard current signals of 4–20 milliamperes (mA). The converter manual is a reference [35].
4.
Variable Frequency Drive (VFD)
The variable frequency drive (VFD) model Siemens SINAMICS G120C is an electronic device used to control the speed of an electric motor by varying the frequency and voltage supplied to the motor through the control signal. The control signal level is 4–20 mA. The VFD manual is a reference [36].
5.
Motor
The motor is a three-phase, explosion-proof asynchronous motor of type 71B4, with a speed of 1500 revolutions per minute (rpm) and a power rating of 0.37 kilowatts (kw). The motor manual is a reference [37].
6.
Monitor
The monitor is a laptop (Field PG) that contains TIA Portal V18, which is used for programming and configuring the control panel mentioned above.
Figure 1 shows the block diagram of the speed controller.

2.1.2. Methodology

The proposed methodology integrates a hybrid Particle Swarm Optimization (PSO) and Multiple-Adaptive Neuro-Fuzzy Inference System (MANFIS) algorithm for the dynamic tuning of PID controllers implemented within Programmable Logic Controllers (PLC). The approach is structured into the following key stages:
  • Open-Loop Data Recording.
  • System Modeling and Process Identification.
  • Initial PID Controller Design.
  • Design of Siemens Speed Controller in TIA Portal V18.
  • Development of the PSO-MANFIS Hybrid Tuner.
  • MATLAB-PLC Integration via OPC Server.
  • Performance Evaluation.

2.1.3. Data Recording and System Modeling

This section covers real-time open-loop data recording and the determination of the system model.
  • Real-time open-loop data recording.
The system model must be determined to design the speed controller. A data-driven method is used to find the system model of the speed controller. This method identifies the system transfer function using MATLAB’s System Identification Toolbox based on real-time input-output system data [38,39]. The independent variable represents the input, and the dependent variable represents the output.
As shown in the circuit of Figure 1, the independent variable is the current (4~20) mA, and the dependent variable is the motor speed (0~1500) rpm.
The software was built using Siemens Totally Integrated Automation (TIA) Portal V18 for current-speed recording. With the help of the “Historical data” property in TIA Portal V18, an Excel file containing the current and speed values was created. The values are 100, and the sampling time is 5 s. Figure 2 shows the flowchart for real-time data recording. Figure 3 illustrates the motor current-speed relationship using TIA Portal V18. Figure 4 presents the motor current-speed relationship using an Excel file.
2.
System model (transfer function) finding.
The real-time data referenced in Section 2.1.3 (item 1) was imported into the MATLAB workspace via a copy-paste operation from an Excel file in preparation for system model estimation. The System Identification Toolbox in MATLAB R2021a was used to determine the system model. This process involves several key steps: designing experiments, collecting data, estimating unknown system characteristics from the experimental results, creating models, and validating the identified system. For this study, the system identification was carried out using 100 data points with a sampling time of 5 s. The model approximation results are shown in Figure 5, where the fit to the estimation data is 97.69%. Equation (1) gives the system’s resulting transfer function (T).
T s = 0.7563 s + 0.007879  
Although the identified transfer function represents a first-order linear model, this simplification was intentionally adopted to ensure computational efficiency and facilitate real-time tuning within the PLC environment. The validation results (97.69% fit) confirmed that the first-order model adequately captured the dominant process dynamics within the tested range. Furthermore, any higher-order effects, such as those associated with motor inertia, are dynamically compensated for through the adaptive PSO-MANFIS tuner during real-time operation.
To verify the reliability of the identified model, a separate validation procedure was conducted using 20% of the collected data as unseen input–output samples. The residual analysis confirmed that the residuals were approximately white and uncorrelated with the input, indicating that the essential system dynamics were captured. The model achieved a 96.84% fit to the validation data, closely matching the 97.69% estimation fit, demonstrating that the identified first-order transfer function provides a sufficiently accurate and generalizable representation for control purposes.
The model order was selected by comparing first- and second-order transfer function structures using MATLAB’s System Identification Toolbox. Although second-order models yielded slightly higher fit values (<1% improvement), the first-order model was adopted due to its simplicity, stability, and computational efficiency for real-time PLC integration. The pole–zero map (Figure 6) shows a single stable dominant pole, confirming that the identified model adequately captures the system dynamics within the tested operating region.

2.2. Reference PID Tuning Using MATLAB

Following the determination of the system’s transfer function in Section 2.3, the PID controller can now be designed.

2.2.1. Introduction

PID, or proportional-–integral–derivative, is a linear control mechanism that is now the most often utilized control strategy in engineering applications. The PID control method is direct and practical [40]. PID controllers are frequently employed as feedback controllers in process industries. Notwithstanding the plant’s dynamic characteristics, the PID controller provides outstanding control efficacy. It comprises three essential components: The proportional (P) component responds to the current error value by producing an output commensurate with the error’s magnitude. The integral (I) addresses the cumulative total of previous mistakes to correct any enduring steady-state flaws, thereby eradicating residual differences. The derivative (D) component predicts future mistakes by assessing the rate of change of the error, mitigating overshoot, and enhancing system stability, particularly during fast fluctuations. The PID controller reduces the likelihood of human error and improves automation. To construct a PID controller, three fundamental parameters must be defined: proportional gain (Kp), integral gain (Ki), and derivative gain (Kd). The PID controller’s output may be determined using Equation (2), where the control signal is denoted as u(t) and the error signal as e(t) [41]:
u t   =   K p · e t   +   K i 0 t e t · d t   +   K d · d e ( t ) d t  

2.2.2. MATLAB Tuner

The parameters of the PID controller must be determined using tuning procedures. The MATLAB Tuner was utilized to assign the parameters of the PID controller. Figure 7 depicts the speed controller closed-loop block diagram, whereas Figure 8 presents the speed controller response. Table 3 presents the PID controller parameters established by the MATLAB Tuner. Table 4 delineates the performance metrics of the system response, encompassing rising time, overshoot, and settling time, as ascertained by the MATLAB Tuner.

2.3. PLC Conversion and Implementation

Following the computation of the PID controller parameters (Kp, Ki, and Kd) using MATLAB, a PLC-based built-in PID controller can be implemented. Siemens PLCs offer professional-grade PID controllers that are systematically classified for application across a wide range of control systems. Within the TIA Portal programming environment, Siemens provides various PID function blocks, each developed for specific system requirements and fully compatible with their respective control architectures [42].

2.3.1. Industrial Controller Selection

This study uses the CONT_C function block for implementing continuous PID control on a Siemens S7-300 PLC. The CONT_C block is designed to manage continuous processes involving analog input and output signals. Its modular design allows individual sub-functions of the PID controller to be turned on or off, making it adaptable to the specific dynamics of the controlled process. The controller was configured and implemented using Siemens TIA Portal V18. Detailed documentation for the CONT_C block is available in [43].

2.3.2. Controller Parameters Conversion

The parameters of a PID controller obtained using MATLAB differ from those re-quired by industrial PID controllers due to differences in their structural representations. Specifically, MATLAB-based PID parameters are expressed in gain form, whereas industrial PID controllers typically use a time-based formulation. Consequently, the MATLAB-derived parameters must be appropriately converted before implementation in industrial PID systems. Equations (3)–(5) illustrate the conversion process for implementing the Siemens industrial PID controller CONT_C. Where (Ti) denotes the integral time in (s) and (Td) represents the derivative time in (s).
G a i n P L C = K p M A T L A B
T i P L C = K p M A T L A B K i M A T L A B    
T d P L C = K d M A T L A B K p M A T L A B  
Table 5 presents the corresponding conversion of PID parameters based on Equations (3)–(5).
The conversion between MATLAB and PLC PID parameters assumes a consistent time base in seconds, which was verified during implementation. The PLC cyclic interrupt (OB35) was configured with a 100 ms scan time, ensuring accurate time scaling for Ti and Td. Additionally, while MATLAB expresses the derivative filter through the coefficient (N), the Siemens CONT_C block applies equivalent filtering using the TM_LAG parameter. In this study, TM_LAG was set to 1 s, corresponding approximately to the MATLAB-derived filter coefficient (N = 0.041405), ensuring equivalent derivative smoothing across both platforms.

2.3.3. Speed Controller Implementation

Based on Figure 1, the speed controller was developed and executed using a TIA portal program composed of four main blocks: organizational blocks OB1 and OB35, and function blocks FC1 and FC2. OB1 serves as the main program, incorporating both FC1 and FC2. Specifically, FC1 handles the reading and scaling of the motor speed, while FC2 scales the output signal directed to the Variable Frequency Drive (VFD). OB35 is configured as a cyclic interrupt (CYC_INT5) and executes the CONT_C block every 100 milliseconds. The overall structure of the speed controller program is illustrated in Figure 9. A summary of the block names and their respective functions is provided in Table 6. The terminal settings associated with the CONT_C block are detailed in Table 7, and the corresponding configuration is depicted in Figure 10.

2.3.4. CONT_C Parameters Adjustments

The controller parameters derived in the previous section resulted in a stable speed controller; however, the system exhibited a slow response due to the relatively high integral time (Ti). To enhance the dynamic performance and achieve a more acceptable response from the actual system, selected parameters were fine-tuned based on practical experience [44]. Following these adjustments, updated parameter values were obtained, as presented in Table 8.

2.3.5. Speed Controller Operation

After implementing the speed controller and fine-tuning the CONT_C parameters based on experience, the system was put into operation. Figure 11 presents the commissioning interface, Figure 12 illustrates the graphical interface, and Figure 13 depicts the trend monitoring interface.

2.4. PSO-MANFIS Dynamic Optimization

In this section, a dynamic hybrid algorithm called PSO-MANFIS is developed and used to fine-tune the PLC-based built-in PID controller CONT_C parameters: Gain (G), Integral time (Ti), and derivative time (Td) to optimize the speed controller.
The PSO-MANFIS hybrid algorithm, initially proposed by [32], was designed to op-timize the parameters of the built-in PID controller in MATLAB. This hybrid approach in-tegrates Particle Swarm Optimization (PSO) with three ANFIS models to enhance control performance. The present study modified the PSO-MANFIS algorithm to be suitable for real-time applications. This section is organized into three subsections as follows:

2.4.1. Particle Swarm Optimization (PSO) Algorithm

The particle swarm optimization (PSO) algorithm, developed by Kennedy and Eberhart, is an evolutionary algorithm that functions according to swarm behavior [45]. The algorithm depends on the coordinated movement of the flock, dictated by the bird’s.
Location closest to the food source. The particles’ position and velocity update equations represent the flock’s movements. Equation (6) for velocity and Equation (7) for position are presented below:
V i k + 1 = w k V i k + c 1 r 1 P B e s t k X i k + c 2 r 2 G B e s t k X i k  
X i k + 1 = X i k + V i k + 1
The variables in Equations (6) and (7) are as follows: k denotes the number of repetitions, i represents the particle index, and w indicates the inertia weight, directly influencing velocity. The variables c1 and c2 denote the acceleration factors referred to as cognition and social constants, respectively. The variables r1 and r2 are stochastic values that lie within the interval of 0 to 1. Pbest denotes the ideal local solution, while Gbest signifies the optimal global solution. Vi and Xi represent the velocity and position of particle i, respectively [46].
The PSO parameters c1 = 1, c2 = 2, Wmax = 0.9, and Wmin = 0.4 were selected within standard ranges reported in prior optimization studies to ensure stable convergence and an adequate exploration–exploitation balance. The inertia weight decreases linearly from 0.9 to 0.4 across iterations, allowing broad initial exploration followed by a focused local search. Preliminary tests using alternative settings confirmed that this configuration achieved the most consistent convergence speed and stable tuning behavior of the MANFIS parameters.
The PSO algorithm is applied to enhance the MANFIS model’s performance by adapting the membership function parameters and subsequently minimizing the root mean square error (RMSE) to improve the speed controller response. The RMSE can be expressed by Equation (8):
R M S E = 1 N i = 1 N ( T i P i ) ^ 2
where N represents the number of samples, i represents the sample index, and Ti and Pi denote the target and predicted output values, respectively [47,48].

2.4.2. Multiple Adaptive Neuro-Fuzzy Inference System (MANFIS) Model

The Multiple Adaptive Neuro-Fuzzy Inference System (MANFIS) is a combination of three independent ANFIS models connected in parallel [49].
The Adaptive Neuro-Fuzzy Inference System (ANFIS) is a hybrid model integrating Neural Networks (NN) and Fuzzy Inference Systems (FIS). It is capable of solving optimization challenges [50]. The standard FLC generally utilizes input signals of the system error (e) and the rate of change (∆e) of the error. The system error is the difference between the set point r(t) and the plant output u(t) at time t, whereas the rate of change in the error ∆e is the difference between the current error e(t) and the preceding error e(t − 1) at time t. The error and its variation are presented in Equations (9) and (10) [51]:
e   t = r t u   t
e   t = e   t e   t 1
Figure 14 illustrates the typical ANFIS model. In this diagram, a circle denotes a fixed node, whereas a square signifies an adaptable node. The Sugeno fuzzy model is the most prevalent among other FIS models owing to its superior interpretability, computing efficiency, and incorporation of optimal and adaptive techniques. For each model, a standardized rule set of two fuzzy if-then rules (as illustrated in Equations (11) and (12)) can be expressed as:
R u l e 1 :   i f   e   i s   A 1   a n d   e   i s   B 1 ,   t h e n   f 1 = p 1 e   +   q 1 e   +   r 1
R u l e 2 :   i f   e   i s   A 2   a n d   e   i s   B 2 ,   t h e n   f 2 = p 2 e + q 2 e + r 2
where A1, A2, B1, and B2 are matching fuzzy sets, while p1, p2, q1, q2, r1, and r2 denote constraints on the output function, and z = f (e, ∆e) is a crisp function in the consequent [52].
Figure 14 shows that the ANFIS comprises five layers. The five layers are the fuzzification layer, product layer, normalized layer, defuzzification layer, and output layer [53], which are detailed as follows:
Layer 1 (fuzzification): This layer uses square nodes to represent an adaptive functional element. Each entry into node i invokes an adaptable membership function to create the degree of membership for linguistic elements.
Membership functions can take on various forms, such as Gaussian, trapezoidal, tri-angular, or extended Bell functions. The layer outputs are shown in Equation (13):
O 1 , i   =   μ Ai   ( e ) ,   i   =   1 , 2   or   O 1 ,   i   =   μ Bi - 2 ( e ) ,   i   =   3 , 4 .  
The two inputs in this context are designated as e and ∆e. The input specifications, μAi and μBi, evaluated as Gaussian membership functions (Equation (14)), require two variables called premise variables, consisting of the center c and the width σ.
G a u s s i a n   x :   c ,   σ = e 1 2 ( x c σ ) 2    
where O1, i denotes the output of layer 1 at the ith node.
Layer 2 (product): These fixed nodes denote the product Π for the computation of a rule’s firing strength. This layer receives input values from the first layer and transforms them into a membership function representing fuzzy input variable sets. The output of each node is the multiplication of all its received signals. The outputs of this layer are shown in Equation (15):
O 2 , i   =   w i   =   μ Ai   ( x )   μ Bi ( y ) ,   i   =   1 ,   2  
Using grid partitioning, the autogenerated rules are m × n, where m is the number of MFs in each input and n is the total number of inputs.
Layer 3 (normalization): Layer 3 nodes are also fixed nodes. Each node in this layer is marked as N. Every node normalizes the firing strength of a rule from the preceding layer by computing the ratio of the (ith) rule’s firing strength to the aggregate firing strength of all rules. The outputs of this layer can be seen in Equation (16):
O 3 , i   =   w ¯ i   = w i w 1 + w 2   i   =   1 ,   2  
where w ¯ is defined as the normalized firing strength of a rule.
Layer 4 (defuzzification): The nodes in this layer are adaptive, with the node function defined by Equation (17):
O 4 , i   =   w ¯ i     f i   =   w ¯ i p i x   +   q i y   +   r i   i   =   1 ,   2  
where w ¯ is the rule’s normalized firing strength and {pi, qi, ri} is a first-order polynomial. O4, i represents the output of layer 4. Parameters in this layer are linear and are well known as consequent parameters. These parameters are identified during the training process of the ANFIS.
Layer 5 (overall output): This single node is called the output layer, which is labeled as (Σ). This layer only sums up the outputs of all rules in the previous layer and converts fuzzy results into crisp outputs, as shown in Equation (18):
O 5 , i   = i = 1 2 w ¯ i f i   =   i = 1 2 w ¯ i f i w 1   +   w 2  
The error is the difference between the actual and predicted outputs of the ANFIS. The fewer the errors, the more successful the ANFIS [54,55,56].
The Multiple Adaptive Neuro-Fuzzy Inference System (MANFIS) comprises three independent ANFIS models operating in parallel. Each ANFIS receives the same two inputs—the instantaneous error e(t) and its rate of change Δe(t)—and produces one corresponding output: ΔKp, ΔKi, or ΔKd. The overall MANFIS mapping can be formally expressed in Equation (19) as:
K p     K i K d = f p   ( e t , e t ; θ p ) f i ( e t , e t ; θ i ) f d ( e t , e t ; θ d )  
where fj (⋅) denotes the nonlinear mapping implemented by the j^th ANFIS sub-model with its parameter set θj, for j ∈ {p, i, d}. Each sub-model updates its output incrementally according to its own rule base and training parameters. This formal representation clarifies that MANFIS acts as a multi-output nonlinear adaptive mapping, producing the parameter updates for the PID controller in real time.

2.4.3. Dynamic PSO-MANFIS Hybrid Algorithm Developing

The proposed Dynamic PSO–MANFIS hybrid algorithm optimizes the PID controller parameters (Kp, Ki, and Kd) to achieve the best speed controller response. Figure 15 and Figure 16 show the flowchart and pseudocode of the Dynamic PSO–MANFIS hybrid algorithm, respectively. Table 9 presents the initial parameters of the PSO algorithm, while the MANFIS initial parameters are listed in Table 10. Each particle in the PSO–MANFIS hybrid algorithm represents a complete set of MANFIS input and output parameters to be optimized. The position vector Xi for particle i is defined in Equation (20) as:
X i = c 1 , σ 1 , c 2 , σ 2 , c m , σ m , p 1 , q 1 , r 1 , p 2 , q 2 , r 2 , p n , q n , r n
where (ck, σk) are the premise (membership function) parameters, and (pk, qk, and rk) are the consequent parameters of the k^th fuzzy rule. The dimensionality of each particle equals the total number of tunable parameters across all three ANFIS models (m + n = 117), as shown in Table 10. During optimization, the particle position is iteratively updated according to Equations (6) and (7), and the global best solution defines the optimal MANFIS parameter set used for online PID tuning.
The operational framework of the proposed PSO-MANFIS hybrid algorithm, illustrated in Figure 15, involves a dynamic real-time data acquisition process conducted via Simulink. Specifically, real-time measurements of the error (e) and its rate of change (Δe) are obtained from a programmable logic controller (PLC) through an OPC server interface. Simulink is configured with an infinite stop time to enable continuous online tuning. Subsequently, three ANFIS models are constructed using the parameter configurations specified in Table 10. A total of 117 input-output parameters are then prepared for processing by the PSO algorithm, which operates based on the settings outlined in Table 9. During execution, PSO identifies the optimal solution from a population of 30 candidates by minimizing the root mean square error (RMSE) fitness function. The three best-performing ANFIS models are then selected and deployed in the active Simulink environment. This optimization and update cycle is performed iteratively and continuously, thereby improving the transient response of the speed controller in real time.

2.5. PLC-MATLAB Communication

A communication link between MATLAB and the PLC is required to enable the PSO-MANFIS hybrid algorithm to perform real-time fine-tuning of the PLC-based built-in PID controller parameters. However, MATLAB does not support direct data exchange with the PLC. Instead, this interaction typically relies on a third-party interface. The most commonly employed method for facilitating this data exchange is the OPC (OLE for Process Control) protocol, as illustrated in Figure 17.

2.5.1. KEPServerEX6.0

KEPServerEX 6.0 is an effective third-party interface for facilitating data exchange between MATLAB and the PLC via the OPC protocol [57]. To enable KEPServerEX 6.0 to recognize the PLC and access its data, the PLC type, IP address, and input-output tags, along with their corresponding data types and memory addresses, must be configured. Figure 18 presents a screenshot illustrating the configuration setup within KEPServerEX 6.0.

2.5.2. MATLAB OPC Toolbox

In MATLAB Simulink, three specific blocks must be appropriately configured to enable data exchange [58], as outlined below:
  • The OPC Configuration block within the OPC Toolbox is primarily responsible for establishing and managing communication between Simulink and the OPC server.
  • The OPC Read block in Simulink acquires real-time data from an OPC Data Access (DA) server during simulation. It establishes a connection with the server defined in the OPC Configuration block. It retrieves the current values of designated OPC items (tags), such as sensor measurements, device statuses, or process variables.
  • The OPC Write block transmits data from Simulink to an OPC Data Access (DA) server during simulation. This block allows Simulink to write control signals—such as setpoints, commands, or actuator values—to industrial devices through the OPC server interface.
Figure 19 illustrates the Simulink model incorporating the configured OPC communication blocks.

2.5.3. Speed Controller Optimization

The algorithm developed in Section 2.4.3 is employed to fine-tune the parameters of the PLC-based built-in PID controller (CONT_C) to improve the transient response of the speed controller and achieve optimal performance metrics, including rise time, overshoot, and settling time. The overall structure of the hybrid controller is illustrated in Figure 20. This controller comprises two main components: the PLC side and the MATLAB side. The CONT_C block is implemented on the PLC side with the necessary configurations. Conversely, the MATLAB side incorporates the PSO-MANFIS hybrid algorithm, which is responsible for reading the error signal (e) from the CONT_C block (the Historical data property in the TIA Portal software is designed to automatically generate an excel file for systematically recording error values.), computing the change in error (∆e), preparing the input and output data (The output data of the MANFIS were selected based on the expert knowledge and practical experience of the system designer) for the initial construction of the MANFIS model, generating the initial MANFIS, identifying the optimal MANFIS configuration, and updating it in real-time within the Simulink environment. This entire process is executed dynamically. Data exchange between the PLC and MATLAB environments is facilitated through the KEPServerEX 6.0 OPC server. Figure 21 presents the transient response of the speed controller during the fine-tuning process, based on a 1500 rpm setpoint.

3. Results and Discussion

This section discusses the outcomes obtained in the preceding section (Section 2) by applying the dynamic tuning process, as well as scalability, limitations, and practical considerations, as follows:

3.1. Discussion of the Results

In order to design the MANFIS (three ANFIS models), input-output data must exist. The input data for MANFIS is represented by error (e) and error change (∆e). The input data is collected from the PLC-based built-in PID controller (CONT_C) during real-time operation and saved in an Excel file using the historical data property of the TIA Portal. The output data for MANFIS is selected based on experience, as shown in Table 11. To demonstrate the effectiveness of the dynamic tuning process using the Dynamic PSO-MANFIS hybrid algorithm, three setpoints were given to the system, both without and with the developed algorithm, as shown in Figure 22, Figure 23 and Figure 24. TIA’s portal built-in historical data property was used to import the error (e) and error change (∆e) into the algorithm. Also, error, error change (∆e), and motor output were recorded to evaluate performance metrics. These performance metrics indicate the enhancement of the speed controller’s transient response.
Figure 22, Figure 23 and Figure 24 compare the system response to three set points under two conditions: without and with dynamic tuning using the optimized MANFIS. The results, summarized in Table 12, demonstrate that optimization enhances the controller’s performance. For instance, at a set point of 1500, the performance indices show notable improvements: the rise time decreased from 93.0124 s to 70.9758 s, the settling time from 165.2766 s to 128.8376 s, the overshoot from 0.0012% to 0%, and the peak time from 620 s to 357 s. Furthermore, Figure 25, Figure 26 and Figure 27 illustrate the corresponding error responses under the same conditions. The optimized MANFIS significantly reduced the tracking error compared to the non-optimized controller, thereby confirming the robustness and reliability of the proposed tuning approach. This improvement in error dynamics further substantiates the effectiveness of the optimization in enhancing both transient and steady-state performance.
On the other hand, RMSE stands for Root Mean Square Error, which is a standard statistical measure of the difference between the ANFIS model’s predicted outputs and the actual target outputs. A lower RMSE means the ANFIS model predictions are closer to the true values. Table 13 compares the RMSE values of the baseline MANFISs and optimized PSO-MANFIS tuners across three setpoints. The results show that the PSO-MANFIS tuner achieved 56–74% lower RMSE values, indicating faster convergence and improved learning accuracy. This demonstrates that incorporating PSO substantially enhances the precision and robustness of the adaptive tuning process. RMSE comparison values for MANFIS and PSO-MANFIS at three setpoints.

3.2. Statistical Validation and Repeatability Analysis

To verify the consistency and reliability of the proposed PSO-MANFIS hybrid tuning, five independent experimental runs were conducted at each reference setpoint (500, 1000, and 1500 rpm) under identical environmental and load conditions. Table 14 presents the mean (μ), standard deviation (σ), and coefficient of variation (CV = σ/μ × 100%) for the main transient response metrics—rise time, settling time, and overshoot—before and after applying the hybrid tuning.
A summary of the results in Table 14 is as follows:
  • Across all runs, the standard deviations remained below 2% of the mean values, confirming high repeatability.
  • The average reduction in rise time and settling time remained within ±1.8% deviation across repetitions, indicating stable optimization performance.
  • Overshoot variability was negligible, confirming that the PSO-MANFIS maintained consistent damping across trials.
  • These findings demonstrate that the observed improvements are statistically robust and reproducible, with low experimental variance

3.3. Discussion on Scalability, Limitations and Practical Considerations

Although the proposed PSO-MANFIS dynamic tuning framework achieved substantial performance improvements in a Siemens S7-300-based speed control application, certain scalability and implementation considerations must be acknowledged.
  • Hardware Generalizability:
The methodology can, in principle, be adapted to other PLC brands (e.g., Allen-Bradley, Schneider, Mitsubishi, or Omron) that support open communication protocols such as OPC, Modbus, or Profinet. However, configuration details, data addressing schemes, and PID function block structures vary across platforms. Thus, retuning communication interfaces and parameter conversion equations (Equations (3)–(5)) would be required to ensure consistent mapping between MATLAB and the PLC environment.
  • Applicability to Other Process Variables:
The hybrid PSO-MANFIS algorithm is not limited to speed control. It can be extended to other process variables such as pressure, level, flow, temperature, or pH, provided that (i) the process dynamics are measurable by the availability of instrument devices, and (ii) sufficient training data for the MANFIS component are available. However, processes with faster time constants may require higher sampling rates and more computational resources to maintain real-time stability.
  • Latency and Cycle-Time Constraints:
The integration relies on OPC communication between MATLAB and the PLC. While the measured latency in the current setup (KEPServerEX 6.0) was below 100 ms, higher network loads or slower scan cycles could introduce synchronization delays that affect dynamic tuning accuracy. Additionally, the PLC scan cycle time (100 ms in this study) imposes an upper limit on how frequently controller parameters can be updated without causing race conditions or excessive CPU utilization.
  • Security and Safety Considerations:
Dynamic parameter adjustment introduces cybersecurity and operational safety challenges. Unauthorized access to the OPC interface or accidental overwriting of controller parameters could lead to unstable or unsafe operation. Therefore, it is recommended to use encrypted OPC-UA communication, proper authentication layers, and supervisory authorization before deploying online parameter updates in critical industrial environments.
  • Future Scalability Enhancements:
Future work will explore the lightweight implementation of the PSO-MANFIS algorithm built directly into embedded processors or PLC co-processors to reduce network dependency, minimize latency, and enhance portability. Integrating edge computing or real-time operating systems (RTOS) could improve scalability for high-speed industrial processes.

3.4. Comparative Summary of Hybrid and Intelligent PID Tuning Approaches

The comparative evaluation summarized in Table 15 underscores the extent of improvement (Imp) achieved by the proposed approach relative to conventional methods across key performance indices—namely, rise time, settling time, and overshoot. The enhancements realized through the proposed PSO-MANFIS hybrid controller (current study, cs) are consistent with, and in several aspects surpass, those documented in previous research. For example, fuzzy logic–based tuning strategies reported in [14,15,16,17] demonstrated reductions in overshoot and settling time ranging from 0% to 100%; however, such approaches were primarily validated through simulations or within constrained PLC environments. Likewise, ANFIS-based controllers presented in [19,20,21,22] exhibited improved adaptability to nonlinear systems but were predominantly offline in nature and exhibited sensitivity to initial conditions. Optimization schemes relying solely on PSO [23,24,25,26,27] provided enhanced global search capabilities yet lacked the ability for real-time adaptation. Hybrid PSO–ANFIS frameworks [28,29,30,31] offered better dynamic response characteristics but were rarely implemented in hardware-in-the-loop or industrial PLC settings. Notably, the prior PSO–MANFIS study [32] achieved promising results for pH regulation but did not incorporate closed-loop communication with actual PLCs. In addition to outperforming conventional and hybrid tuning approaches, the proposed PSO–MANFIS controller was also conceptually compared with more recent intelligent designs, such as [59]. While the method in [59] (RBF-based) excels in adaptive fault-tolerant decision-making for aerospace applications, it primarily operates in simulated environments.
In contrast, the present study’s PSO-MANFIS implementation introduces real-time parameter adaptation via OPC communication with a Siemens S7-300 controller, enabling fully online and dynamically tuned operation. Quantitatively, the proposed hybrid controller achieved reductions of 23% in rise time and 22% in settling time, while completely eliminating overshoot compared with MATLAB-tuned PID control—outcomes comparable to or exceeding previously reported hybrid controllers. Furthermore, by embedding the optimization process within an industrial communication framework, the proposed system effectively bridges the gap between simulation-based optimization and practical industrial deployment. These findings substantiate the scalability, robustness, and industrial applicability of the PSO-MANFIS architecture, establishing it as a substantive advancement over earlier hybrid tuning methodologies.

3.5. Performance Improvement and Structural Contribution

The proposed PSO–MANFIS hybrid structure introduces a key advancement over traditional and hybrid tuning approaches by directly coupling the adaptive optimization layer with the PLC hardware in real time via an OPC interface. This enables continuous, online adjustment of PID parameters within the PLC environment—effectively transforming the fixed built-in controller into a self-learning adaptive system. Compared with previous studies summarized in Table 15, the current study achieves simultaneous improvement across all leading performance indicators: rise time reduced by 23% (93.01 → 70.98 s), settling time reduced by 22% (165.28 → 128.84 s), and overshoot eliminated (0.0012% → 0%). In contrast, most prior studies [13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] either lacked complete metric reporting or presented isolated improvements under simulation. The present work, therefore, contributes not only quantitative performance enhancement but also a structural innovation—a scalable, industrially viable framework that combines MATLAB’s computational intelligence with PLC-based automation through seamless OPC communication, bridging the gap between theoretical optimization and practical deployment.

4. Conclusions

In conclusion, this study demonstrates that integrating advanced computational intelligence with PLC-based industrial automation significantly improves process control performance and adaptability. The resulting hybrid controller consists of two complementary components: the industrial PID controller embedded in the PLC for primary control, and the PSO-MANFIS algorithm implemented in MATLAB for fine-tuning. By combining the global optimization power of Particle Swarm Optimization (PSO) with the adaptive learning capability of MANFIS, the proposed framework addresses the limitations of traditional PID tuning methods, especially in managing nonlinear and time-varying industrial processes. The MATLAB–PLC integration through OPC enables real-time optimization while supporting continuous monitoring, data-driven decision-making, and intelligent adaptation. Experimental results show a marked improvement in transient response, with reductions in performance metrics parameters, rise time, settling time, overshoot, and peak time, demonstrating enhanced responsiveness and stability. These improvements directly contribute to greater production efficiency, improved product quality, and reduced downtime. A key innovation of this work lies in the practical integration of MATLAB’s advanced computational tools with PLC-based control systems via an OPC (OLE for Process Control) server. This interface bridges the gap between high-level algorithm development and industrial implementation by enabling real-time data exchange, continuous performance evaluation, and dynamic parameter updates. Furthermore, the MATLAB–PLC communication framework provides comprehensive data logging, performance analytics, and visualization capabilities vital in Industry 4.0 and smart manufacturing. By uniting advanced computational methods with industrial control hardware, this work delivers a scalable and flexible solution suitable for diverse applications, offering a valuable pathway for addressing future challenges in industrial automation.

Author Contributions

Conceptualization, B.A.-N.; Methodology, B.A.-N.; Software, B.A.-N.; Validation, B.A.-N.; Formal analysis, B.A.-N.; Investigation, B.A.-N.; Resources, B.A.-N.; Writing—original draft, B.A.-N.; Visualization, B.A.-N.; Supervision, C.K.H., J.K.S.P. and A.F.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author.

Acknowledgments

The writers would like to express their gratitude and appreciation to the staff of the Instrumentation Department at Southern Company of Fertilizers (SCF) in Iraq for their outstanding efforts in preparing the experimental devices for operation and providing the necessary measuring instruments for the inspection of the experimental devices.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Soori, M.; Dastres, R.; Arezoo, B.; Jough, F.K.G. Intelligent robotic systems in Industry 4.0: A review. J. Adv. Manuf. Sci. Technol. 2024, 4, 2024007. [Google Scholar] [CrossRef]
  2. Ajiga, D.; Okeleke, P.A.; Folorunsho, S.O.; Ezeigweneme, C. The role of software automation in improving industrial operations and efficiency. Int. J. Eng. Res. Updates 2024, 7, 022–035. [Google Scholar] [CrossRef]
  3. Gurav, V.S.; Gugnani, A.; Meena, Y.R.; Marathe, V.; Vijay, S.A.A.; Nanda, S. The Impact of Industrial Automation on the Manufacturing Industry in the Era of Industry 4.0. In Proceedings of the 2024 15th International Conference on Computing Communication and Networking Technologies, ICCCNT, Kamand, India, 24–28 June 2024. [Google Scholar] [CrossRef]
  4. Efe, E.; Özcan, M.; Hakli, H. Building and Cost Analysis of an Industrial Automation System using Industrial Robots and PLC Integration. Eur. J. Sci. Technol. 2021, 28, 1–10. [Google Scholar] [CrossRef]
  5. Bolton, W. Programmable Logic Controllers, 4th ed.; Elsevier: Burlington, UK, 2006. [Google Scholar]
  6. Sartika, E.M.; Sarjono, T.R.; Saputra, D.D. Saputra. Prediction of PID control model on PLC. Telecommun. Comput. Electron. Control. 2019, 17, 529–536. [Google Scholar] [CrossRef]
  7. Shaikh, M.Z.; Hussain, M.; Kumar, D.; Memon, F.A.; Rustam, B.; Baro, E.N. Design and implementation of PID based flow rate control using PLC. Mehran Univ. Res. J. Eng. Technol. 2023, 42, 115–122. [Google Scholar] [CrossRef]
  8. Saxena, A.; Jabbar, K.A.; Fezaa, L.H. Enhancing Industrial Automation: A Comprehensive Study on Programmable Logic Controllers (PLCs) and their Impact on Manufacturing Efficiency. In Proceedings of the International Conference on Technological Advancements in Computational Sciences, ICTACS, Tashkent, Uzbekistan, 1–3 November 2023; pp. 1182–1187. [Google Scholar] [CrossRef]
  9. Shahrokhi, M.; Zomorrodi, A. Comparison of PID Controller Tuning Methods. Available online: https://www.semanticscholar.org/paper/Comparison-of-PID-Controller-Tuning-Methods-Shahrokhi-Zomorrodi/b4ca1b81247f71593d3e60f4169f9307baa361d4 (accessed on 14 September 2025).
  10. Joseph, E. Cohen-Coon PID Tuning Method: A Better Option to Ziegler Nichols-Pid Tuning Method. 2018. Available online: www.iiste.org (accessed on 14 September 2025).
  11. Bharat, S.; Ganguly, A.; Chatterjee, R.; Basak, B.; Sheet, D.; Ganguly, A. A Review on Tuning Methods for PID Controller. Asian J. Converg. Technol. 2024, 10, 3. Available online: www.asianssr.org (accessed on 14 September 2025).
  12. Ogata, K. Modern Control Engineering, 5th ed.; Prentice Hall/Pearson Education Inc.: Upper Saddle River, NJ, USA, 2010. [Google Scholar]
  13. Jha, D.; Ahmed, A.; Kumar, S.; Roy, D. Fuzzy-PID and interpolation: A novel synergetic approach to process control. Int. J. Optim. Control. Theor. Appl. 2024, 14, 355–364. [Google Scholar] [CrossRef]
  14. Nguyen, V.K.; Tran, V.K.; Pham, H.; Nguyen, H.D.; Nguyen, C.N. Design and Implementation of Fuzzy-based Fine-tuning PID Controller for Programmable Logic Controller. Int. J. Integr. Eng. 2024, 16, 359–372. [Google Scholar] [CrossRef]
  15. Baharuddin, A.; Basri, M.A.M. Self-Tuning PID Controller for Quadcopter using Fuzzy Logic. Int. J. Robot. Control. Syst. 2023, 3, 728–748. [Google Scholar] [CrossRef]
  16. Nazha, H.M.; Youssef, A.M.; Darwich, M.A.; Ibrahim, T.A.; Homsieh, H.E. A Comparative Study on Fuzzy Logic-Based Liquid Level Control Systems with Integrated Industrial Communication Technology. Computation 2025, 13, 60. [Google Scholar] [CrossRef]
  17. Abdelghany, M.A.; Elnady, A.O.; Ibrahim, S.O. Optimum PID Controller with Fuzzy Self-Tuning for DC Servo Motor. J. Robot. Control. 2023, 4, 500–508. [Google Scholar] [CrossRef]
  18. Kheioon, I.A.; Al-Sabur, R.; Sharkawy, A.-N. Design and Modeling of an Intelligent Robotic Gripper Using a Cam Mechanism with Position and Force Control Using an Adaptive Neuro-Fuzzy Computing Technique. Automation 2025, 6, 4. [Google Scholar] [CrossRef]
  19. Wang, Y.; Zhang, N.; Chen, C.; Jiang, Y.; Liu, T. Nonlinear Adaptive Generalized Predictive Control for PH Model of Nutrient Solution in Plant Factory Based on ANFIS. Processes 2023, 11, 2317. [Google Scholar] [CrossRef]
  20. Babu, N.R.; Sai, S.S.; Kumar, U.; Chenchireddy, K.; Kumar, K.T.; Naveen, M. Optimized Speed Control of BLDC Motor Control by using PID and ANFIS. In Proceedings of the International Conference on Sustainable Communication Networks and Application, ICSCNA, Theni, India, 15–17 November 2023; pp. 653–658. [Google Scholar] [CrossRef]
  21. Reddy, K.K.; Kanagasabai, N. Performance Analysis of ANFIS-PID Controller based Speed Regulation and Harmonic Reduction in BLDC Motor Application. Int. J. Electr. Electron. Res. 2024, 12, 187–194. [Google Scholar] [CrossRef]
  22. IEEE. 2019 2nd International Conference on Power Energy Environment and Intelligent Control (PEEIC-2019): 18–19 October 2019, Department of Electrical & Electronics Engineering, G.L. Bajaj Institute of Technology and Management, Greater Noida, India; IEEE: Denvers, MA, USA, 2019. [Google Scholar]
  23. Abbas, I.A.; Mustafa, K. A review of adaptive tuning of PID-controller: Optimization techniques and applications. Int. J. Nonlinear Anal. Appl. 2024, 15, 2008–6822. [Google Scholar] [CrossRef]
  24. Al-Najari, B.; Hen, C.K.; Paw, J.K.S.; Marhoon, A.F. Design and Implementation of PID Controller for the Cooling Tower’s pH Regulation Based on Particle Swarm Optimization PSO Algorithm. Iraqi J. Electr. Electron. Eng. 2024, 20, 59–67. [Google Scholar] [CrossRef]
  25. Cheng, J.-C.; Zhuang, Q.-Y.; Liu, L.-Y.; Su, T.-J. PID Control Design Based on Particle Swarm Algorithm and Fuzzy Algorithm. In Proceedings of the International Symposium on Intelligent Signal Processing and Communication Systems, ISPACS, Kaohsiung, Taiwan, 10–13 December 2024. [Google Scholar] [CrossRef]
  26. Deshmukh, J.K.; Tirole, R.; Bhaskar, A. Optimization of PID Controllers for Cascade Control Loops Using Particle Swarm Optimization Techniques. In Proceedings of the 8th International Conference on I-SMAC (IoT in Social, Mobile, Analytics and Cloud), I-SMAC, Kirtipur, Nepal, 3–5 October 2024; pp. 473–478. [Google Scholar] [CrossRef]
  27. Abad, J.C.Z.; Alemán, M.A.C. Intelligent tuning of PID controllers: Comprehensive approach based on modified Particle Swarm Optimization (PSO) algorithm. In Proceedings of the IECON 2024-50th Annual Conference of the IEEE Industrial Electronics Society, Chicago, IL, USA, 3–6 November 2024. [Google Scholar] [CrossRef]
  28. Elhawat, M.; Altınkaya, H. Frequency Regulation of Stand-Alone Synchronous Generator via Induction Motor Speed Control Using a PSO-Fuzzy PID Controller. Appl. Sci. 2025, 15, 3634. [Google Scholar] [CrossRef]
  29. Oladipo, S.; Sun, Y.; Wang, Z. Efficiency Assessment of ANN, ANFIS, and PSO-ANFIS for Predicting University Residence Energy Usage. In Proceedings of the PMAPS 2024—18th International Conference on Probabilistic Methods Applied to Power Systems, Auckland, New Zealand, 24–26 June 2024. [Google Scholar] [CrossRef]
  30. Hemalatha, N.; Venkatesan, S.; Kannan, R.; Kannan, S.; Bhuvanesh, A.; Kamaraja, A. Sensorless speed and position control of permanent magnet BLDC motor using particle swarm optimization and ANFIS. Meas. Sens. 2023, 31, 100960. [Google Scholar] [CrossRef]
  31. Dirik, M.; Gül, M. Dynamic Optimal ANFIS Parameters Tuning with Particle Swarm Optimization. Eur. J. Sci. Technol. 2021, 28, 1083–1092. [Google Scholar] [CrossRef]
  32. Al-Najari, B.M.A.; Wali, W.A. Optimization of pH Controller Performance for Industrial Cooling Towers via the PSO–MANFIS Hybrid Algorithm. Energies 2025, 18, 1232. [Google Scholar] [CrossRef]
  33. Al-Najari, B. Design and implementation of control Cabinet Based Siemens S7-300 Programmable Logic Controller PLC. In Proceedings of the 2nd International Multi-Disciplinary Conference Theme: Integrated Sciences and Technologies, IMDC-IST 2021, Sakarya, Turkey, 7–9 September 2021. [Google Scholar] [CrossRef]
  34. Available online: https://www.ifm.com/de/en/product/IG5397#documents (accessed on 14 September 2025).
  35. Available online: https://www.phoenixcontact.com/en-us/products/frequency-transducer-mcr-f-ui-dc-2814605?type=pdf (accessed on 14 September 2025).
  36. Available online: https://mall.industry.siemens.com/mall/en/ww/Catalog/Product/?mlfb=6SL3210-1KE15-8UF2 (accessed on 14 September 2025).
  37. Available online: https://www.bernardimotorielettrici.it/upload/documenti/motori-elettrici/01.01-motori-elettrici-standard.pdf (accessed on 14 September 2025).
  38. Peng, C.-C.; Cheng, Y.-H. Data Driven based Modeling and Fault Detection for the MATLAB/Simulink Turbofan Engine: An ARX Model Approach. In Proceedings of the 2022 IEEE Conference on Control Technology and Applications, CCTA 2022, Trieste, Italy, 23–25 August 2022; pp. 498–503. [Google Scholar] [CrossRef]
  39. Chen, M.; Gao, F.; Ren, W. Speed Control of PMSM Based on Data-Driven Method. In Proceedings of the 2022 11th International Conference of Information and Communication Technology, ICTech, Wuhan, China, 4–6 February 2022; pp. 271–276. [Google Scholar] [CrossRef]
  40. Li, Y.; Zhang, Y.; Cui, S.; Liu, Y.; Lv, X. Application of optimizing PID Parameters based on PSO in the Temperature Control System of Haematococcus Pluvialis. In Proceedings of the 2020 IEEE 9th Joint International Information Technology and Artificial Intelligence Conference (ITAIC), Chongqing, China, 11–13 December 2020; pp. 1850–1853. [Google Scholar] [CrossRef]
  41. Ray, N.K.; Mohapatra, S.K.; Dash, S.S. Gravitational Search Algorithm for Optimal Tunning of controller parameters in AVR system. In Proceedings of the 2020 International Conference on Computational Intelligence for Smart Power System and Sustainable Energy (CISPSSE), Keonjhar, India, 29–31 July 2020; pp. 1–6. [Google Scholar]
  42. Rooholahi, B.; Reddy, P.L. Concept and application of PID control and implementation of continuous PID controller in Siemens PLCs. Indian J. Sci. Technol. 2015, 8, 1–9. [Google Scholar] [CrossRef]
  43. Available online: www.fer.unizg.hr/_download/repository/S7pidcob.pdf (accessed on 14 September 2025).
  44. Van Nghiep, D.; Son, L.H. Implementation of Digital PID Controller in Siemens PLC S7-300. Int. J. Electr. Electron. Eng. 2018, 5, 10–13. [Google Scholar] [CrossRef]
  45. Kennedy, J.; Eberhart, R. Particle swarm optimization. In Proceedings of the ICNN’95-International Conference on Neural Networks, Perth, Australia, 27 November–1 December 1995; IEEE: Piscataway, NJ, USA, 1995; Volume 4, pp. 1942–1948. [Google Scholar]
  46. Ozgenc, B.; Ayas, M.S.; Altas, I.H. A Hybrid Optimization Approach to Design Optimally Tuned PID Controller for an AVR System. In Proceedings of the 2020 International Congress on Human-Computer Interaction, Optimization and Robotic Applications (HORA), Ankara, Turkey, 26–28 June 2020; pp. 1–5. [Google Scholar]
  47. Oladipo, S.; Sun, Y.; Amole, A.O. Investigating the influence of clustering techniques and parameters on a hybrid PSO-driven ANFIS model for electricity prediction. Discov. Appl. Sci. 2024, 6, 265. [Google Scholar] [CrossRef]
  48. Ahmadianfar, I.; Shirvani-Hosseini, S.; He, J.; Samadi-Koucheksaraee, A.; Yaseen, Z.M. An improved adaptive neuro fuzzy inference system model using conjoined metaheuristic algorithms for electrical conductivity prediction. Sci. Rep. 2022, 12, 4934. [Google Scholar] [CrossRef]
  49. Hajian, A.; Styles, P.; Zomorrodian, H. Depth Estimation of Cavities from Microgravity Data Through Multi Adaptive Neuro Fuzzy Interference System. In Proceedings of the Near Surface 2011—17th EAGE European Meeting of Environmental and Engineering Geophysics, Leicester, UK, 12–14 September 2011. [Google Scholar] [CrossRef]
  50. Subramaniam, U.; Reddy, K.S.; Kaliyaperumal, D.; Sailaja, V.; Bhargavi, P.; Likhith, S. A MIMO–ANFIS-Controlled Solar-Fuel-Cell-Based Switched Capacitor Z-Source Converter for an Off-Board EV Charger. Energies 2023, 16, 1693. [Google Scholar] [CrossRef]
  51. Petrov, M.; Ganchev, I.; Taneva, A. Fuzzy PID control of nonlinear plants. In Proceedings of the 2002 1st International IEEE Symposium, Varna, Bulgaria, 10–12 September 2002; pp. 30–35. [Google Scholar] [CrossRef]
  52. Klir, E.; Sun, J.R.; Mizutami, C.T. Neuro Fuzzy and Soft Computing; Prentice-Hall Inc.: Upper Saddle River, NJ, USA, 1997. [Google Scholar]
  53. Salleh, M.N.M.; Talpur, N.; Talpur, K.H. A Modified Neuro-Fuzzy System Using Metaheuristic Approaches for Data Classification. In Artificial Intelligence—Emerging Trends and Applications; InTech: Hong Kong, China, 2018. [Google Scholar] [CrossRef]
  54. Salleh, M.N.M.; Hussain, K. A Review of Training Methods of ANFIS for Applications in Business and Economics. Int. J. u- e- Serv. Sci. Technol. 2016, 9, 165–172. [Google Scholar] [CrossRef]
  55. Yonar, A.; Yonar, H. Modeling air pollution by integrating ANFIS and metaheuristic algorithms. Model. Earth Syst. Environ. 2023, 9, 1621–1631. [Google Scholar] [CrossRef] [PubMed]
  56. Ghomsheh, V.S.; Shoorehdeli, M.A.; Teshnehlab, M. Training ANFIS Structure with Modified PSO Algorithm. In Proceedings of the MED’07, Mediterranean Conference on Control & Automation, Athens, Greece, 27–29 June 2007. [Google Scholar]
  57. Altınkaya, H.; Ekmekci, D. Tuning of PID Controller in PLC-Based Automatic Voltage Regulator System Using Adaptive Artificial Bee Colony–Fuzzy Logic Algorithm. Electronics 2024, 13, 5039. [Google Scholar] [CrossRef]
  58. Bagal, K.; Kadu, C.; Parvat, B.; Vikhe, P. PLC Based Real Time Process Control Using SCADA and MATLAB. In Proceedings of the 2018 4th International Conference on Computing, Communication Control and Automation, ICCUBEA, Pune, India, 16–18 August 2018. [Google Scholar] [CrossRef]
  59. Liu, C.; Xu, J.; Yue, X. RBF Neural Network-based Cooperative Electromagnetic Takeover Control for Large-scale Failed Spacecraft. IEEE Trans. Aerosp. Electron. Syst. 2025, 1–11. [Google Scholar] [CrossRef]
Figure 1. The block diagram of the speed controller.
Figure 1. The block diagram of the speed controller.
Automation 06 00083 g001
Figure 2. The flowchart for real-time data recording using TIA Portal V18.
Figure 2. The flowchart for real-time data recording using TIA Portal V18.
Automation 06 00083 g002
Figure 3. The motor current-speed relationship using TIA Portal V18.
Figure 3. The motor current-speed relationship using TIA Portal V18.
Automation 06 00083 g003
Figure 4. The motor current-speed relationship using an Excel file.
Figure 4. The motor current-speed relationship using an Excel file.
Automation 06 00083 g004
Figure 5. The system identification approximation results.
Figure 5. The system identification approximation results.
Automation 06 00083 g005
Figure 6. Pole–zero map of the identified first-order transfer function.
Figure 6. Pole–zero map of the identified first-order transfer function.
Automation 06 00083 g006
Figure 7. Speed controller closed-loop block diagram.
Figure 7. Speed controller closed-loop block diagram.
Automation 06 00083 g007
Figure 8. Speed controller response.
Figure 8. Speed controller response.
Automation 06 00083 g008
Figure 9. The overall structure of the speed controller program.
Figure 9. The overall structure of the speed controller program.
Automation 06 00083 g009
Figure 10. Complete CONT_C configuration.
Figure 10. Complete CONT_C configuration.
Automation 06 00083 g010
Figure 11. The CONT_C commissioning interface.
Figure 11. The CONT_C commissioning interface.
Automation 06 00083 g011
Figure 12. Speed controller graphic interface.
Figure 12. Speed controller graphic interface.
Automation 06 00083 g012
Figure 13. Speed controller trend interface.
Figure 13. Speed controller trend interface.
Automation 06 00083 g013
Figure 14. Typical ANFIS structure.
Figure 14. Typical ANFIS structure.
Automation 06 00083 g014
Figure 15. The proposed Dynamic PSO-MANFIS hybrid algorithm flowchart.
Figure 15. The proposed Dynamic PSO-MANFIS hybrid algorithm flowchart.
Automation 06 00083 g015
Figure 16. The proposed Dynamic PSO-MANFIS hybrid algorithm pseudocode.
Figure 16. The proposed Dynamic PSO-MANFIS hybrid algorithm pseudocode.
Automation 06 00083 g016
Figure 17. MATLAB-PLC communication via OPC server.
Figure 17. MATLAB-PLC communication via OPC server.
Automation 06 00083 g017
Figure 18. The KEPServerEX 6.0 configuration screenshot.
Figure 18. The KEPServerEX 6.0 configuration screenshot.
Automation 06 00083 g018
Figure 19. Simulink model OPC communication blocks configuration.
Figure 19. Simulink model OPC communication blocks configuration.
Automation 06 00083 g019
Figure 20. The overall structure of the hybrid controller.
Figure 20. The overall structure of the hybrid controller.
Automation 06 00083 g020
Figure 21. Optimized speed controller transient response interface.
Figure 21. Optimized speed controller transient response interface.
Automation 06 00083 g021
Figure 22. Speed controller transient response with a 500 rpm setpoint.
Figure 22. Speed controller transient response with a 500 rpm setpoint.
Automation 06 00083 g022
Figure 23. Speed controller transient response with a 1000 rpm setpoint.
Figure 23. Speed controller transient response with a 1000 rpm setpoint.
Automation 06 00083 g023
Figure 24. Speed controller transient response with a 1500 rpm setpoint.
Figure 24. Speed controller transient response with a 1500 rpm setpoint.
Automation 06 00083 g024
Figure 25. Error transient response with a 500 rpm setpoint.
Figure 25. Error transient response with a 500 rpm setpoint.
Automation 06 00083 g025
Figure 26. Error transient response with a 1000 rpm setpoint.
Figure 26. Error transient response with a 1000 rpm setpoint.
Automation 06 00083 g026
Figure 27. Error transient response with a 1500 rpm setpoint.
Figure 27. Error transient response with a 1500 rpm setpoint.
Automation 06 00083 g027
Table 1. Summary of related PID tuning techniques (Refs. [13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]) versus the proposed PSO-MANFIS.
Table 1. Summary of related PID tuning techniques (Refs. [13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]) versus the proposed PSO-MANFIS.
TechniqueRepresentative ReferenceReal-Time CapabilityTypical Hardware/PlatformReported Performance ImprovementsMain Limitations
Fuzzy PID/Fuzzy fine-tuning[13,14,15,16,17]Mixed: several simulation studies; at least one PLC deployment (e.g., S7-1200)MATLAB/Simulink; some Siemens PLC use casesReduced overshoot and settling time; e.g., up to 21% overshoot reduction and 83% settling-time decrease reported in level/thermal applicationsRule design can be subjective; MF tuning needs domain expertise; scalability across operating regimes can be limited
ANFIS-based PID tuning[18,19,20,21,22]Mostly offline/simulationMATLAB/Simulink; motor drives benchesBetter speed accuracy and transient response; lower THD in motor drives; improved steady-state error, rise time and settling timeMay converge to local minima; sensitive to initialization; limited industrial PLC integration in prior works
PSO-tuned PID (single stage)[23,24,25,26,27]Primarily offline batch tuning; some lab/plant trials (e.g., pH control)MATLAB/Simulink; lab plants; occasional industrial caseFaster response, reduced overshoot, improved stability vs. classical tuning; good global search of Kp-Ki-KdOne-shot tuning (not adaptive); can be slow for large search spaces; limited on-line adaptation under time-varying dynamics
Hybrid PSO–ANFIS[28,29,30,31]Mostly simulation or non-PLC domains (prediction/control)MATLAB/Simulink; generator/motor benchesCombines ANFIS adaptability with PSO exploration; lower overshoot and shorter settling time than PID/Fuzzy aloneOften non-real-time; limited direct deployment on PLC hardware; focus not on industrial built-in PID
PSO–MANFIS (prior art)[32]Algorithmic optimization demonstrated with plant data; not PLC-embeddedMATLAB + plant data (cooling towers)Significant gains reported for industrial pH regulation vs. classical tuningNo direct closed-loop fine-tuning of PLC built-in PID; lacks OPC-based, real-time parameter update on controller hardware
This work: PSO-MANFIS + PLC built-in PID controllerCurrent studyYes—continuous on-line tuning via OPC during operationSiemens S7-300 (CONT_C) + MATLAB/Simulink + KEPServerEX OPC, VFD-driven motorlive fine-tuning of Gain, Ti, Td improves transient responseA third-party software, such as the KEPServerEX OPC Server interface, is required for the MATLAB-PLC connection to enable data exchange for dynamic tuning.
Table 2. Industrial PID controller name.
Table 2. Industrial PID controller name.
Industrial Process ElementPrefixIndustrial PID Controller Name
PressurePICPressure indicating controller
LevelLICLevel indicating controller
FlowFICFlow indicating controller
TemperatureTICTemperature indicating controller
SpeedSICSpeed indicating controller
ChemicalAICAnalyzing indicating controller
Table 3. PID tuning parameters.
Table 3. PID tuning parameters.
ParameterNameValueUnit
KpProportional gain0.034532unitless
KiIntegral gain0.00046726s
KdDerivative gain0.28913s
NFilter0.041405unitless
Table 4. System response performance metrics.
Table 4. System response performance metrics.
Performance Metric NameValueUnit
Rise time66.6567s
Settling time281.5768s
Overshoot4.6426%
Set point1250rpm
Peak1307.3rpm
Peak time168.4399s
Table 5. MATLAB-PLC parameters conversion.
Table 5. MATLAB-PLC parameters conversion.
ParameterDescriptionMATLABPLCUnit
KpProportional gain0.0345320.034532unitless
KiIntegral gain0.0004672673.9s
KdDerivative gain0.289138.37s
Table 6. The block names and their respective functions.
Table 6. The block names and their respective functions.
BlockBlock NameFunction
OB1Main programRun FC1 and FC2
OB35Cyclic interrupt Run the CONT_C block every 100 milliseconds
FC1Function blockReading and scaling of the motor speed
FC2function blockScales the output signal directed to VFD
Table 7. CONT_C block terminals settings.
Table 7. CONT_C block terminals settings.
TerminalDescriptionAddressSignal NameSettingUnit
ENEnableM0.1Always_TrueTrueunitless
COM_RSTComplete restartM0.5COM_RSTFalse\Trueunitless
MAN_ONManual onM0.2modeFalse\Trueunitless
P_SETProportional action onM0.1Always_TrueTrueunitless
I_SETIntegral action onM0.1Always_TrueTrueunitless
D_SETDerivative action onM0.1Always_TrueTrues
CYCLESampling timedirect----------------100ms
SP_INTInternal set pointMD26SP_IN0–100%
PV_INProcess variable inMD2PV_IN0–100%
MANManualMD18MAN0–100%
GainProportional gainMD30Gain0.034532unitless
TiIntegral timeMD34Ti73.9s
TdDerivative timeMD38Td8.37s
TM_LAGTime lagdirect--------------1s
LMNManipulated valueMD10LMN0–100%
ERErrorMD14ER(SP-PV)%
Table 8. Updated CONT_C parameters.
Table 8. Updated CONT_C parameters.
ParameterNameValueUnit
GainProportional gain0.034532unitless
TiIntegral time1.478s
TdDerivative time0.167s
Table 9. PSO initial parameters.
Table 9. PSO initial parameters.
PrefixDescriptionValue
mNumber of variables (MANFIS parameters)117
nPopulation size30
WmaxMaximum iteration weight0.9
WminMinimum iteration weight0.4
c1 and c2Acceleration factors c1 and c21 and 2
r1 and r2Uniformly distribute random factors r1 and r21
LBVariables low bound−10
UBVariables high bound10
MaxiterMaximum number of iterations100
Table 10. MANFIS initial parameters.
Table 10. MANFIS initial parameters.
Parameter NameValue
Partition typeGrid Partition
Membership Function typegaussmf
Number of membership functions per input3
Number of input parameters per ANFIS12
Number of output parameters per ANFIS27
Output type of ANFISlinear
Number of total parameters per ANFIS39
Number of total parameters of MANFIS117
Number of MANFIS inputs (error (e) and change of error (∆e))2
Number of MANFIS outputs (∆Kp, ∆Ki, and ∆Kd)3
Table 11. MANFIS proposed output ranges based on experience.
Table 11. MANFIS proposed output ranges based on experience.
MANFS
Outputs
DescriptionOutput RangeUnit
MinimumMaximum
∆GainDelta gain00.02unitless
∆TiDelta integral time0300millisecond
∆TdDelta derivative time0100millisecond
Table 12. Speed controller transient response performance metrics with three set points.
Table 12. Speed controller transient response performance metrics with three set points.
Controller
Response
Performance MetricsSet Point (rpm)
50010001500
Without
Dynamic
tuning
Rise time (s)92.694091.986693.0124
Settling time (s)162.5888162.9375165.2766
Overshot (%)0.00750.00360.0012
Peak (rpm)478.2085975.20751472.7
Peak time (s)376491620
With
Dynamic
tuning
Rise time (s)69.153170.827070.9758
Settling time (s)121.2942124.4630128.8376
Overshot (%)0.002100
Peak (rpm)480.1349975.82061472.8
Peak time (s)228307357
Table 13. Comparison of RMSE values for MANFIS and PSO-MANFIS at three setpoints.
Table 13. Comparison of RMSE values for MANFIS and PSO-MANFIS at three setpoints.
TunerRoot Mean Square Error (RMSE)
Set Point = 500 rpmSet Point = 1000 rpmSet Point = 1500 rpm
MANFISPSO-MANFISMANFISPSO-MANFISMANFISPSO-MANFIS
∆Gain0.0031930.0013650.003281640.0012370.0032770.00088
∆Ti0.0485190.02109460.04982920.01850330.0497770.0138208
∆Td0.0154570.006417890.01587840.00555550.015880.00406703
MANFIS0.0671680.028877490.068989240.02529580.0689340.01876783
Table 14. Statistical Validation and Repeatability Analysis.
Table 14. Statistical Validation and Repeatability Analysis.
MetricCondition500 rpm1000 rpm1500 rpm
Rise time (s)Conventional92.7 ± 1.4
(CV = 1.5%)
92.0 ± 1.1
(CV = 1.2%)
93.0 ± 1.6
(CV = 1.7%)
PSO-MANFIS69.2 ± 0.9
(CV = 1.3%)
70.8 ± 1.0
(CV = 1.4%)
71.0 ± 1.2
(CV = 1.7%)
Settling time (s)Conventional162.6 ± 2.5
(CV = 1.5%)
162.9 ± 2.0
(CV = 1.2%)
165.3 ± 2.3
(CV = 1.4%)
PSO-MANFIS121.3 ± 1.8
(CV = 1.5%)
124.5 ± 1.7
(CV = 1.4%)
128.8 ± 2.1
(CV = 1.6%)
Overshoot (%)Conventional0.0075 ± 0.00040.0036 ± 0.00020.0012 ± 0.0001
PSO-MANFIS0.0021 ± 0.00020.0000 ± 0.00000.0000 ± 0.0000
Table 15. Comparative summary of hybrid and intelligent PID tuning approaches.
Table 15. Comparative summary of hybrid and intelligent PID tuning approaches.
Ref.Rise Time (s)Settling Time (s)Overshoot (%)
FromToImp.FromToImp.FromToImp.
[13]0.51.7−240%5260%600.898%
[14]5458−7%113118−4%0.940.7916%
[15]6.67956.66680%179.4489179.44760%33.025833.14410%
[16]xx 1923581%230100%
[17]0.32080.250321%10.725810.48242%3.43932.507927%
[18]156.937651%xxno100100%
[19]xxnoxxnoxxno
[20]xxnoxxnoxxno
[21]xxnoxxnoxxno
[22]0.24950.078968%1.43060.133890%18.47050.941894%
[23]xxnoxxnoxxno
[24]10.70.88191%2061.799%24.30.10399%
[25]xxnoxxnoxxno
[26]xxnoxxnoxxno
[27]xxno1.352.95−118%45.61.596%
[28]xxno20670%3.81.6656%
[29]xxnoxxnoxxno
[30]xxno1.71.622%160.3157.255%
[31]xxnoxxnoxxno
[32]7.47865.171930%3.50061.120068%0.54650.258252%
[cs]93.012470.975823%165.2766128.837622%0.00120100%
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Al-Najari, B.; Hen, C.K.; Siaw Paw, J.K.; Marhoon, A.F. Dynamic Tuning of PLC-Based Built-In PID Controller Using PSO-MANFIS Hybrid Algorithm via OPC Server. Automation 2025, 6, 83. https://doi.org/10.3390/automation6040083

AMA Style

Al-Najari B, Hen CK, Siaw Paw JK, Marhoon AF. Dynamic Tuning of PLC-Based Built-In PID Controller Using PSO-MANFIS Hybrid Algorithm via OPC Server. Automation. 2025; 6(4):83. https://doi.org/10.3390/automation6040083

Chicago/Turabian Style

Al-Najari, Basim, Chong Kok Hen, Johnny Koh Siaw Paw, and Ali Fadhil Marhoon. 2025. "Dynamic Tuning of PLC-Based Built-In PID Controller Using PSO-MANFIS Hybrid Algorithm via OPC Server" Automation 6, no. 4: 83. https://doi.org/10.3390/automation6040083

APA Style

Al-Najari, B., Hen, C. K., Siaw Paw, J. K., & Marhoon, A. F. (2025). Dynamic Tuning of PLC-Based Built-In PID Controller Using PSO-MANFIS Hybrid Algorithm via OPC Server. Automation, 6(4), 83. https://doi.org/10.3390/automation6040083

Article Metrics

Back to TopTop