I am an undergraduate currently working on a control design project that involves Nonlinear neural internal model control of a Quadruple Tank Process with Dead Times (QTPwDTs). I have been however stuck on performing system identification of a simple single-tank process using neural networks in MATLAB and SIMULINK which has been impeding my progress on my undergraduate project.
I am admittedly a Newbie in this field, and do not have access to a lot of resources for learning.
Here are the steps I have taken so far:
- Data Generation
- I developed a SIMULINK model for the single tank process
SIMULINK model for the single tank process
- The
Random Number
block was used as an input to the model with a Mean of 60, Variance of 100, Seed of 0, and a Sample Time of 1s. - Here is the MATLAB initialization script for the steady-state values for the model:
clear all;
clc;
u = 150; %flow rate
K = 0.7; %flow co-efficient
A = 150; %cross-sectional area of the tank
g = 981; %acceleration due to gravity
a = 2.5; %cross-sectional area of the hole through which the water flows out
The model was run for a simulation time of
20000s
The scope output for the input and output signal is shown below:
Dimension of the input and output data:
20001x1
double
- Neural Network Training
- I trained a feedforward neural network with two hidden layers having 100 neurons.
- I observed that wider networks (more neurons) yielded a better validation result via experimentation
- The input regressors to the neural network are
[u(k), u(k-1), u(k-2), y(k-1), y(k-2)]
. Whereu
is the input andy
is the output extracted from the SIMULINK model for the data extraction phase. - I used the
poslin
activation function for the two hidden layers - I trained the neural network with 70% of the original data using the
nntool
- I created the SIMULINK block simulating the neural network using the
gensim
function with a sampling time of1
.
function [nn, performance] = train_mff_network(input, output)
% Create a Neural Network Toolbox block
nn = feedforwardnet([100,100]);
N = length(input);
% define the inputs and the targets
% input regressors = [u(k),u(k-1),u(k-2),y(k-1),y(k-2)]
inputs = [input [0;input(1:N-1)] [0;0;input(1:N-2)] [0;output(1:N-1)] [0;0;output(1:N-2)]];
%inputs = single_tank_nn_in';
targets = output;
% configure the neural network
nn = configure(nn,inputs',targets');
% Specify the network architecture and training algorithm
nn.layers{1}.transferFcn = 'poslin';
nn.layers{2}.transferFcn = 'poslin';
nn.trainFcn = 'trainlm';
nn.divideFcn = 'dividerand';
nn.divideParam.trainRatio = 0.7;
nn.divideParam.valRatio = 0.15;
nn.divideParam.testRatio = 0.15;
% Train the neural network
[nn,tr] = train(nn,inputs',targets');
% Validate the trained network
outputs = nn(inputs');
performance = perform(nn,targets,outputs)
end
- Validation
To validate the performance of the neural network;
I implemented the SIMULINK model for validation in MATLAB using the
gensim
generated neural network blockThe SIMULINK model for validation is shown below:
I tested the original model and the feedforward neural network model with an input signal generated using the
Random Number
block with the same configuration used for data extractionA simulation time of
10
seconds was usedHere is the validation output obtained:
I am expecting the output of the feedforward neural network to closely resemble/approximate the output of the original single tank process SIMULINK model used for data extraction
I have tried to retrain with other neural network configurations, however, I have not obtained any major satisfactory result yet.
I strongly believe I am doing something wrong. I really hope an expert can examine the steps I have taken and save me from my current dilemma because my supervisor constantly tells me that it is a simple problem, and I am still far from my main objective which is training a neural network for the Quadratic tank process with dead times that has more complex/problematic dynamics.