0% found this document useful (0 votes)
17 views12 pages

Matlab Anfis

The document details the training and testing of an Adaptive Neuro-Fuzzy Inference System (ANFIS) for real-time water quality monitoring using sensor data such as pH, TDS, water level, and temperature. It describes the training process, error evaluation, and the model's ability to make intelligent decisions based on learned patterns to maintain optimal water conditions. The document also includes visual representations of the model's structure, performance, and membership functions, emphasizing the system's effectiveness in managing water quality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views12 pages

Matlab Anfis

The document details the training and testing of an Adaptive Neuro-Fuzzy Inference System (ANFIS) for real-time water quality monitoring using sensor data such as pH, TDS, water level, and temperature. It describes the training process, error evaluation, and the model's ability to make intelligent decisions based on learned patterns to maintain optimal water conditions. The document also includes visual representations of the model's structure, performance, and membership functions, emphasizing the system's effectiveness in managing water quality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Figure (?

) Training Data

This ANFIS training in water quality monitoring lies in its ability to

analyze and predict water conditions based on sensor inputs. The water level,

pH level, TDS, and temperature sensors provide real-time data that serve as

inputs for the ANFIS model.

During training, ANFIS learns patterns and relationships between these

inputs and desired outputs, such as water quality status or necessary actions

(e.g., cleaning or refilling). Once trained, the model uses its learned rules to

make intelligent decisions for maintaining optimal water conditions in real-

time.
Figure (?) Testing Data

In this testing model, the ANFIS system evaluates the performance of

the trained fuzzy inference system using the testing dataset. The "Testing

Data" plot shows the actual output (blue circles) and predicted output (solid

line) for the 211 data pairs. The alignment of the predicted outputs with the

actual data indicates how well the model generalizes to unseen data. If the

outputs match closely, the system has effectively learned the input-output

relationship, enhancing its reliability for water quality monitoring using the

sensors integrated into the system.


Figure (?). Training Error

Upon clicking the "Train Now" in the Neuro-Fuzzy Designer interface, the

system starts the Adaptive Neuro-Fuzzy Inference System (ANFIS) training process.

This process utilizes a hybrid optimization method that combines gradient descent and

least-squares estimation to fine-tune the parameters of the fuzzy inference system

(FIS). The purpose of this training is to map input data, such as sensor readings, to

specific desired outputs by minimizing the error over multiple iterations or epochs. As

the training progresses, the graph in the interface displays the error values for each

epoch, helping you monitor the learning progress and determine how well the system

is adapting to the input-output relationships.

This training process is directly connected to the water quality monitoring

system, which relies on data from the water level sensor, pH sensor, TDS sensor, and

temperature sensor. In the ANFIS model, these sensor readings serve as inputs that

are processed through fuzzy logic. The membership functions for each input, such as

"low," "normal," and "high," are adjusted during training to accurately reflect real-

world conditions. For instance, the pH sensor data might be classified into ranges that

indicate acidic, neutral, or alkaline water, while TDS values can represent the
concentration of dissolved solids in the water. Similarly, water level and temperature

readings are categorized to help the system understand the state of the environment.

The training dataset used in this process contains real sensor readings paired with the

desired system response, such as activating or deactivating pumps and solenoids. The

error value shown during training represents the difference between the system's

predicted actions and the actual intended outputs for the given inputs. By minimizing

this error, the ANFIS model becomes more accurate in making decisions based on

sensor data. For example, if the pH level is outside the normal range, the trained

system might activate a pump to introduce neutralizing agents. High TDS levels could

trigger water changes to dilute the concentration of dissolved solids. Similarly,

extreme temperatures might prompt the activation of heating or cooling mechanisms,

while low water levels could signal the need for refilling to prevent equipment

damage.

As the training process continues, the ANFIS model learns to interpret the

sensor data and make decisions effectively. Once training is complete, the system can

use the trained model in real-time to infer the appropriate actions needed to maintain

optimal water quality. The ultimate goal of this training is to reduce errors and create

a system capable of intelligently managing water quality and ensuring the health of

the aquatic environment.


Figure (?). Training Error at 100 Epochs

This updated Training Error plot shows the results of 100 training epochs for

your ANFIS system. The error starts at a certain level (around 7.4194) and remains

consistent throughout the epochs without significant improvement. This indicates that

the system's parameters is optimized early. In the context of the water quality

monitoring system, this training ensures that sensor data (pH, TDS, water level, and

temperature) is accurately mapped to the appropriate control actions. his would result

in better decision-making for managing water quality, such as adjusting pumps or

valves based on sensor readings.


Figure (?). ANFIS Model Structure

The diagram illustrates the architecture of the Adaptive Neuro-Fuzzy

Inference System (ANFIS) used in the water quality monitoring system. The

input layer on the left consists of multiple input nodes, each representing

sensor data such as pH, TDS, water level, and temperature. These inputs are

then passed to the membership function layer, where they are mapped to

fuzzy sets like "low," "normal," or "high," defining the range and behavior of

each parameter. The middle layer, represented by blue nodes, corresponds to

the fuzzy rules that combine these membership functions. For example, a rule

might state, "If pH is normal and TDS is normal, then the output is off."

In subsequent layers, the system aggregates and normalizes the results from

all fuzzy rules to ensure consistent and reliable decision-making. Lastly, the

output layer generates a single output node that represents the system's

control action. This output determines actions such as activating or


deactivating pumps and valves based on the combined sensor readings. This

layered approach enables ANFIS to process complex data efficiently,

ensuring accurate control decisions for maintaining water quality.

Figure (?). Surface Viewer

The surface plot visualizes the relationship between water temperature

(X-axis), Total Dissolved Solids (TDS) (Y-axis), and the state of the water

discharge system (Z-axis), where WaterDischarge is either ON (1) or OFF (0).

The X-axis represents the temperature range from 0°C to 50°C, while the Y-

axis covers TDS values from 0 to 1000 ppm. The Z-axis indicates whether the

water discharge system is activated. The plot uses yellow and blue regions to

differentiate between the ON and OFF states of WaterDischarge, showing

how specific combinations of temperature and TDS influence the system’s

behavior.

Sharp transitions in the Z-axis represent boundary conditions where

the state of WaterDischarge changes. Observations reveal that higher


temperatures (e.g., >30°C) tend to activate the discharge system, whereas

lower temperatures (<20°C) often result in the system remaining OFF. For

TDS, low values (<100 ppm) typically keep the system OFF, while higher

levels (e.g., >300 ppm) increase the likelihood of activation. The combined

effects of temperature and TDS highlight distinct zones on the surface where

the system’s behavior changes, illustrating the critical interplay between these

two factors in determining whether WaterDischarge is ON or OFF.

Figure (?). Rule Viewer

The Rule Viewer provides a detailed breakdown of how

specific input values influence the outputs (WaterCharge and

WaterDischarge) in the fuzzy inference system. Each column in

the viewer represents a variable, starting with the inputs and

ending with the outputs. The inputs include Temperature = 25°C,


PH_level = 7, TDS = 500 ppm, and Water_Level = 50 cm, while

the outputs are WaterCharge and WaterDischarge. Yellow

highlighted regions in each column represent the active

membership functions for the given input or output value, with red

vertical lines marking the specific values being analyzed. For

example, Temperature = 25°C activates membership functions

related to the "IDEAL" temperature range, while TDS = 500 ppm

aligns with the "HIGH" membership range.

The outputs, displayed in the far-right columns, indicate that

under the given conditions, WaterDischarge = 1, meaning the

discharge system is ON, and WaterCharge is near zero, implying it

is OFF. The system evaluates 64 fuzzy rules to compute these

outputs, combining input membership functions to determine the

final results. Each input variable contributes differently to the

decision-making process. For instance, TDS = 500 ppm heavily

influences the activation of the discharge system, as it exceeds the

"OPTIMAL" range, while Temperature = 25°C supports the

decision by falling within the "IDEAL" range.


Figure (?). MATLAB FIS

This shows a fuzzy logic system design for a system using a Sugeno-

type fuzzy inference system. It has four input variables: Temperature, pH

level, TDS (Total Dissolved Solids), and Water level, represented by yellow

boxes. These inputs are processed through the central fuzzy logic system,

which applies defined rules and methods, such as "prod" for AND, "probor" for

OR, "min" for implication, and "max" for aggregation. The system outputs two

variables, **WaterCharge** and **WaterDischarge** (blue boxes), which

control water intake and release. The configuration panel at the bottom

provides details about the system and its parameters, while the right panel

shows information about the currently selected variable, such as its name,

type, and range. This setup is likely designed for managing water quality or

operations in systems like aquariums or water treatment facilities.


Figure (?) Membership Function Editor

This figure above shows the Membership Function Editor for the

AQUACARE fuzzy logic system. It focuses on the input variable Temperature,

with a range of [0, 50]. The membership functions (MFs) for Temperature are

plotted as COLD, IDEAL, and HOT, representing different temperature

ranges. The currently selected MF is COLD, defined as a Gaussian function

(type: "gaussmf") with parameters [5.733, 0.75]. These membership functions

determine how input temperature values are fuzzified into linguistic terms,

which are then used in the fuzzy inference process.


Figure (?). ANFIS Info

The output shows the results of training an Adaptive Neuro-Fuzzy

Inference System (ANFIS). The model has 78 nodes, 27 fuzzy rules, and a

total of 54 parameters (27 linear and 27 nonlinear). It was trained using 211

data pairs without validation data for checking. The training ran for two

epochs, achieving a minimal Root Mean Squared Error (RMSE) of 7.419431.

The error remained nearly unchanged after the first epoch, suggesting

convergence or a limit in model improvement. While the model completed

training as specified, the acceptability of the RMSE depends on the specific

application and data context.

You might also like