2.1. Control System Implementation
We began by studying the components of the liquid level processing platform “3503”, followed by simulating the system using mathematical equations in MATLAB’s Simulink library (MATLAB R2023b, Version 9.14.0, The MathWorks Inc., Natick, MA, USA). We analyzed the system’s response under both a traditional PID controller and an artificial intelligence controller (fuzzy logic controller) designed with MATLAB’s Fuzzy Logic Toolkit. Next, we proceeded with the practical implementation of the proposed control system model, utilizing WinCC Flexible (2008 SP5), Step7-Microwin (V4 SP9), PC-Access OPC (V1.0 SP2), and E-Plan (V 2.4) software. Hardware components included Siemens’s products such as the PLC-S7-200 with an EM-235 analog expansion and a PPI/USB communication cable, recognized for their reliability in control and automation.
The Level Process Station 3503 is designed for control systems in processes for practical training in the measurement and control of various industrial operations [
10]. It consists of the following main components, as shown in
Figure 1.
The Foxboro 762 CNA controller was selected for its dual-loop proportional-integral-derivative (PID) control functionality, which enabled precise regulation of interdependent process variables such as liquid level and flow rate. Its microprocessor-based architecture supports flexible configurations, including operation as two independent control loops or as a single-station cascade/auto-selector system, a feature critical for accommodating dynamic experimental conditions. The controller’s enhanced capabilities, such as its dual auto/manual transfer station and dual 3-variable indicator, provide operational flexibility by allowing seamless transitions between automated and manual control modes during calibration and testing. The front-panel interface incorporates a fluorescent bar graph display for real-time visualization of control variables (e.g., pressure, temperature) and a numeric readout paired with an integrated keypad, enabling direct parameter adjustments, adaptive PID tuning, and alarm threshold configuration. The controller processes analog input signals (4–20 mA, 0–10 V) and generates corresponding analog outputs (4–20 mA) for actuator control, ensuring alignment with the precision requirements of the experimental setup [
11].
Liquid level measurement was achieved using a Foxboro IDP10 I/A differential pressure transmitter, a two-wire device that measures hydrostatic pressure across a calibrated span of 0–500 kPa (0–92 cm level range) with an accuracy of ±0.1% of span. The transmitter integrates a silicon piezoresistive sensor with a stainless-steel isolation diaphragm, ensuring stable performance across a temperature range of −40 °C to 85 °C. Its HART protocol compatibility facilitates remote diagnostics and configuration, eliminating the need for external signal conditioning while providing a standardized 4–20 mA output proportional to the measured pressure [
12].
To actuate the flow control valve (CV-1), an I/P (current-to-pressure) converter translated the controller’s 4–20 mA output signal into a proportional pneumatic pressure signal (3–15 psi/20–102 kPa), modulating the valve position to regulate liquid flow and maintain the process variable within operational limits [
13].
A centrifugal pump (24 VDC, constant speed) transferred water from the lower to the upper tank, with operation initiated via a front-panel switch [
14]. The flow control valve (CV-1), serving as the final control element, adjusted the flow rate dynamically based on the controller’s output signal to ensure precise level regulation [
15].
2.2. Fuzzy Logic Controller Design
We used fuzzy logic for liquid level control in the tank because it can be described linguistically, and fuzzy controllers are effective in handling non-linear systems, excelling in such applications [
16]. Thus, a fuzzy logic controller (FLC) was chosen as an alternative to the PID controller for liquid level control. The Mamdani inference methodology was used in designing the inference rules for our controller, as it is the most commonly used fuzzy methodology, providing a specific output decision that improves system stability, increases effectiveness, and offers flexibility to varying system input values [
17]. Two inputs were defined for the fuzzy controller: the liquid level error (referred to as Level) and the rate of change in the liquid level (referred to as Rate), with one output being the control valve (Valve). The fuzzy logic controller was designed using the Fuzzy Logic Toolkit in the Matlab environment.
After conducting iterative simulations and analyzing system responses, five membership functions for the liquid level error (first input variable) were defined within the normalized range of [−1, 1]: Small, Positive, High-Positive, Negative, and High-Negative. This configuration emerged from an empirical refinement process. Initial tests with three membership functions (Negative, Small, Positive) resulted in oscillations and sluggish convergence due to insufficient granularity in distinguishing error magnitudes. Expanding to five functions enabled finer differentiation between small, moderate, and large deviations, improving the controller’s ability to apply context-sensitive corrections (e.g., aggressive adjustments for High-Negative or High-Positive errors and subtle refinements near the setpoint). The normalized range and partitioning were informed by observed system dynamics, operational constraints, and iterative validation against step and disturbance responses, as shown in
Table 1.
Similarly, after conducting tests and analyzing the response, three membership functions for the second input variable (rate of level change) were defined within the range of [−0.1, 0.1]: Small, Positive, and Negative. These ranges were selected based on experience and understanding of the operational mechanism, as shown in
Table 2.
In the same manner, after testing the controller’s response, five membership functions for the output variable (control valve CV-1) were defined within the range of [−1, 1]: Close-Fast, Close-Slow, No-Change, Open-Low, and Open-Fast, as shown in
Table 3.
The differing ranges for the liquid level error ([−1, 1]) and rate of level change ([−0.1, 0.1]) stem from their distinct roles in the control logic and their empirical normalization. The level error range represents the normalized percentage deviation from the setpoint (e.g., −1 = maximum allowable negative deviation, +1 = maximum positive deviation). This normalization standardizes the input across operational scenarios. Conversely, the narrower rate range ([−0.1, 0.1]) was derived directly from observed system behavior. During testing, the rate of level change rarely exceeded ±0.1 per unit time (normalized) under both transient and steady-state conditions. This tighter range ensures higher sensitivity to small rate fluctuations, enabling the controller to detect gradual drifts early. Crucially, scaling parameters map raw sensor data (e.g., level in meters, rate in m/s) to these normalized ranges, ensuring proportional significance. For instance, a small rate value (e.g., 0.05) within the [−0.1, 0.1] range is amplified by its scaling gain to have a meaningful influence on the control signal, balancing resolution, and stability. The magnitudes of the ranges themselves do not dictate the output; rather, the relative scaling ensures both inputs contribute appropriately to the rule-based decisions.
The design of the fuzzy logic controller was based on the inference rules specified in the MATLAB/Fuzzy Rule Editor, using the Mamdani inference method, as previously mentioned. The continuous level variables and their rates were first mapped to five distinct membership functions, representing linguistic terms such as Very Low, Low, Medium, High, and Very High. This mapping process involved defining appropriate triangular membership functions to capture the dynamic range of the input variables accurately.
For any possible values of the fuzzy controller’s inputs, the outputs depend on these inference rules, which interpret the fuzzy sets derived from the continuous inputs. In the proposed design, the maximum number of inference rules is 15, as the total number of rules equals the product of the number of membership functions for the input variables.
Figure 2 illustrates the designed inference rules in the MATLAB Rule Editor, reflecting how different combinations of membership functions influence the controller’s output.
The Matlab/Simulink toolbox was used to design a comprehensive model of the Level Processing Platform with a PID controller and an artificial intelligence controller (fuzzy logic controller) designed using the FIS Editor tool. Equation (1) describes the relationship between the level and the incoming and outgoing flow rates. For the level to remain constant, the incoming flow rate must equal the outgoing flow rate. The level increases when the incoming flow rate is greater than the outgoing flow rate and decreases when the outgoing flow rate is greater than the incoming flow rate.
where
A: Base area of the tank .
H: liquid level in the tank m.
: Incoming flow .
: Outgoing flow .
The resulting equation yields the following equation:
Equation (2) represents the Laplace–domain relationship between the liquid level and flow rate, adopted from the foundational model by Setiawan [
16].
Figure 2 illustrates the corresponding Simulink implementation of this equation, depicting the functional block diagram of the tank system with incoming and outgoing flow rates. For brevity, detailed derivations of the governing equations are omitted here, as they align with standard liquid level control dynamics thoroughly characterized [
16].
The pump in the studied system has a constant capacity and cannot be controlled in terms of speed; thus, the incoming flow rate provided by the pump is fixed when operational. According to the pump’s technical specifications, the flow rate corresponding to the tank height is 0.00245 [m3/s]. However, the incoming flow rate can be controlled from a minimum to a maximum value by adjusting the control valve opening, which is connected in series with the pump. When the valve is fully closed, the incoming flow rate is zero, and when it is fully open, it allows the maximum flow rate to pass to the tank. Therefore, the pump will be represented by a constant, which is the maximum flow rate, and the control valve will be represented by an integrator with minimum and maximum value limits (0–1) and an initial valve opening value.
The “Fuzzy Controller with Rule viewer” block was used to represent the fuzzy logic controller in the Simulink environment. This block has two inputs: the first is the liquid level error (error), and the second is the rate of change of the liquid level (rate of level). It has a single output, which is the control valve opening, and serves as the input for the control valve. To integrate the system designed using the “FIS Editor” tool with the “Fuzzy Controller with Rule viewer” block, the designed system is saved and exported to the workspace, then opened and invoked in the properties window of the block.
Figure 3 illustrates the final construction of the designed model after setting the PID controller parameters obtained through the Ziegler–Nichols tuning method.
We implemented the system practically, replacing the platform controller with the Siemens PLC-S7-200 and the analog expansion EM-235. The ladder logic language was used to design the programming code for the system in the “Step7-Microwin” environment, ensuring control for both the open-loop and closed-loop configurations of the Level Processing Platform (3503). The PID controller was designed using the “PID Wizard” and integrated into the closed-loop mode within a subroutine, which was then called within the main program using interrupts.
The proposed system requires a monitoring and data collection program to enhance the control system and achieve its intended purpose. To accomplish this, we used WinCC Flexible from Siemens due to its extensive capabilities and widespread use with many programmable control systems and industrial applications. Interactive graphical user interfaces (HMI) were designed to allow selection of the control type, display and modification of PID controller parameters, and visualization of key parameters such as liquid level, valve opening, setpoint value, and actual value. Data are stored in an Excel file, and all response curves are displayed, as shown in
Figure 4 and
Figure 5.
OPC technology is a Microsoft standard that enables industrial applications to exchange data on a single or multiple computers using a “Client-Server” architecture, overcoming compatibility issues between control system components [
15]. This technology creates an intermediary interface independent of the connected device type, allowing users to integrate various hardware and software through an appropriate OPC program [
16].
Figure 6 depicts the designed and implemented laboratory model.