# magnetic levitation system

Post on 12-Jan-2017

706 views

Embed Size (px)

TRANSCRIPT

1

CHAPTER 1: INTRODUCTION

Maglev or Magnetic Levitation technology has become quite popular in recent years

with the advent of Maglev trains and magnetic bearings. As the use of this technology is

increasing due to inherent advantages it offers, the need to develop efficient control

systems to achieve desired results from this system has been realized. These type of

systems are normally is unstable and it is described as highly nonlinear where it is

difficult to control the system. It is very challenging in order to construct the high

performance feedback controllers to regulate the position of the levitation ball. Most

popular control mechanism in such cases is usually a PID controller which of course

yields good results but such a controller has drawbacks of its own. With the emergence

of digital networks such drawbacks are increasingly becoming more apparent and hence

the need for better controllers.

Model Predictive Control, or MPC, is an advanced method of process control that has

been in use in the process industries such as chemical plants and oil refineries since the

1980s. Model predictive controllers rely on dynamic models of the process, most often

linear empirical models obtained by system identification. Due to their ability to model

and predict for highly nonlinear systems makes it a good choice for highly non-linear

and unstable system as Maglev. Model Predictive Control strategy is selected as an

alternative for such a complex system as a MPC controller fares better than a PID

controller in many ways such as [1]:

MPC starts adjusting the control signal ahead of reference changes, while PID

cannot start before

MPC gives substantially less control error

Propagation of measurement noise through controller is less with MPC than PID

MPC controller is able to limit the process output variable (temperature)

according to the set constraint.

Using the same concept Artificial Neural Networks are used which have an inherent

advantage to model any non-linear system and give desired results after tuning various

parameters. The modeling of the system is done using system identification process and

a suitable optimization technique is then utilized to manipulate the control current to

keep the ball levitated at a desired height. The levitated ball is in the state of very fast

dynamic equilibrium which makes this system highly difficult to control. The report is

well supported with Matlab simulations of various control techniques that are applied

throughout the course of this project

http://en.wikipedia.org/wiki/Process_controlhttp://en.wikipedia.org/wiki/Industrial_processhttp://en.wikipedia.org/wiki/Chemical_planthttp://en.wikipedia.org/wiki/Oil_refinerieshttp://en.wikipedia.org/wiki/Empiricalhttp://en.wikipedia.org/wiki/System_identification

2

1.1 MODEL PREDICTIVE CONTROL

Model predictive control is the family of controllers, makes the explicit use of model to obtain control signal. The models used in MPC are generally intended to represent the behavior of complex dynamical systems. The additional complexity of the MPC control algorithm is not generally needed to provide adequate control of simple systems, which are often controlled well by generic PID controllers. However, the basic design of PID is not very effective for the plant having dead time.

MPC models predict the change in the dependent variables of the modeled system that will be caused by changes in the independent variables. In a chemical process, independent variables that can be adjusted by the controller are often either the set points of regulatory PID controllers (pressure, flow, temperature, etc.) or the final control element (valves, dampers, etc.). Independent variables that cannot be adjusted by the controller are used as disturbances. Dependent variables in these processes are other measurements that represent either control objectives or process constraints.

MPC uses the current plant measurements, the current dynamic state of the process, the MPC models, and the process variable targets and limits to calculate future changes in the dependent variables. These changes are calculated to hold the dependent variables close to target while honoring constraints on both independent and dependent variables. The MPC typically sends out only the first change in each independent variable to be implemented, and repeats the calculation when the next change is required.

While many real processes are not linear, they can often be considered to be approximately linear over a small operating range. Linear MPC approaches are used in the majority of applications with the feedback mechanism of the MPC compensating for prediction errors due to structural mismatch between the model and the process. In model predictive controllers that consist only of linear models, the superposition principle of linear algebra enables the effect of changes in multiple independent variables to be added together to predict the response of the dependent variables. This simplifies the control problem to a series of direct matrix algebra calculations that are fast and robust.

When linear models are not sufficiently accurate to represent the real process nonlinearities, several approaches can be used. In some cases, the process variables can be transformed before and/or after the linear MPC model to reduce the nonlinearity. The process can be controlled with nonlinear MPC that uses a nonlinear model directly in the control application. The nonlinear model may be in the form of an empirical data fit (e.g. artificial neural networks).

Key terms that must be understood to understand are:

1. Moving horizon window: the time-dependent window from an arbitrary time ti to ti+Tp. The length of the window Tp remains constant.

http://en.wikipedia.org/wiki/Dynamical_systemhttp://en.wikipedia.org/wiki/PID_controllerhttp://en.wikipedia.org/wiki/Dependent_variablehttp://en.wikipedia.org/wiki/Independent_variablehttp://en.wikipedia.org/wiki/Superposition_principlehttp://en.wikipedia.org/wiki/Linear_algebra

3

2. Prediction horizon: dictates how far we wish the future to be predicted for. This parameter equals the length of the moving horizon window, Tp.

3. Receding horizon control: although the optimal trajectory of future control signal is completely described within the moving horizon window, the actual control input to the plant only takes the first sample of the control signal, while neglecting the rest of the trajectory.

4. In the planning process, we need the information at time ti in order to predict the future. This information is denoted as x(ti) which is a vector containing many relevant factors, and is either directly measured or estimated.

5. A given model that will describe the dynamics of the system is paramount in predictive control. A good dynamic model will give a consistent and accurate prediction of the future.

6. In order to make the best decision, a criterion is needed to reflect the objective. The objective is related to an error function based on the difference between the desired and the actual responses. This objective function is often called the cost function J, and the optimal control action is found by minimizing this cost function within the optimization window [2].

1.1.1 PRINCIPLES OF MPC

Model Predictive Control (MPC) is a multivariable control algorithm that uses:

an internal dynamic model of the process

a history of past control moves and

an optimization cost function J over the receding prediction horizon

Control Horizon

Prediction Horizon

Figure 1: MPC block diagram

4

1.1.2 WHY SHOULD MPC BE USED?

1. Processes are difficult to control with standard PID algorithm (e.g., large time constants, substantial time delays, inverse response, etc.)

2. There are significant process interactions between u (input) and y (output) i.e., more than one manipulated variable has a significant effect on an important process variable.

3. Constraints (limits) on process variables and manipulated variables are important for normal control.

1.2 ARTIFICIAL NEURAL NETWORK

Artificial intelligence technique that mimics the operation of the human brain (nerves and neurons), and comprises of densely interconnected computer processors working simultaneously (in parallel). A key feature of neural networks is that they are programmed to 'learn' by sifting data repeatedly, looking for relationships to build mathematical models, and automatically correcting these models to refine them continuously is called artificial neural network.

Before going into details, some key definitions can be looked at:

1. According to Haykin (1994), p. 2:

A neural network is a massively parallel distributed processor that has a natural propensity for storing experiential knowledge and making it available for use. It resembles the brain in two respects:

Knowledge is acquired by the network through a learning process.

Interneuron connection strengths known as synaptic weights are used to store the knowledge.

2. According to Zurada , p. xv:

Artificial neural systems, or neural networks, are physical cellular systems which can acquire, store, and utilize experiential knowledge.

3. Mohamad H Hasssoun

Neural Networks are neural in the sense that they may have been inspired by neuroscience but not necessarily because they are faithful models of biologic neural or cognitive phenomena-

http://www.businessdictionary.com/definition/artificial-intelligence.htmlhttp://www.businessdictionary.com/definition/technique.htmlhttp://www.businessdictionary.com/definition/operation.htmlhttp://www.businessdictionary.com/definition/comprise.htmlhttp://www.businessdictionary.com/definition/computer.htmlhttp://www.businessdictionary.com/definition/processor.htmlhttp://www.businessdictionary.com/definition/worker.htmlhttp://www.businessdictionary.com/definition/parallel.htmlhttp://www.businessdictionary.com/definition/feature.htmlhttp://www.businessdictionary.com/definition/data.htmlhttp://www.businessdictionary.com/definition/relationship.htmlhttp://www.businessdictionary.com/definition/build.htmlhttp://www.businessdictionary.com/definition/mathematical-model.htmlhttp://www.businessdictionary.com/definition/automatically.htmlhttp://www.businessdictionary.com/definition/model.html

5

4. J.A. Anderson

It is not absolutely necessary to believe that neural network models have anything to do with the nervous system, but it helps.

1.2.1 HISTORY

Creation:

1890: William James - defined a neuronal process of learning

Promising Technology:

1943: McCulloch and Pitts - earliest mathematical models

1954: Hebb and IBM research group - earliest simulations

1958: Frank Rosenblatt - The Perceptron

Disenchantment:

1969: Minsky and Papert - perceptrons have severe limitations

Re-emergence:

1985: Multi-layer nets that use back-propagation

1986: PDP Research Group - multi-disciplined approach

1.2.2 BIOLOGICAL INSPIRATION

Animals are able to react adaptively to changes in their external and internal environment, and they use their nervous system to perform these behaviours. An appropriate model/simulation of the nervous system should be able to produce similar responses and behaviours in artificial systems. The nervous system is built by relatively simple units, the neurons, so copying their behaviour and functionality should be the solution. Lets understand how our brain works with the help of these neurons:

A neuron fires when the sum of its collective inputs reaches a threshold

A real neuron is an all-or-none device

There are about 10^11 neurons per person

Each neuron may be connected with up to 10^5 other neurons

6

There are about 10^16 synapses (300 X characters in library of congress)

Figure 1.2: A biological neuron

A simulated NN node is connected to other nodes via links

Each link has an associated weight that determines the strength and nature (+/-) of one nodes influence on another

Influence = weight * output

Activation function can be a threshold function. Node output is then a 0 or 1

Real neurons do a lot more computation. Spikes, frequency, output

Figure 1.3: An artificial neuron

7

1.2.3 ANN MODEL

Artificial Neurons are crude approximations of the neurons found in brains. They may be physical devices, or purely mathematical constructs.

Artificial Neural Networks (ANNs) are networks of Artificial Neurons, and hence constitute crude approximations to parts of real brains. They may be physical devices, or simulated on conventional computers.

From a practical point of view, an ANN is just a parallel computational system consisting of many simple processing elements connected together in a specific way in order to perform a particular task. One should never lose sight of how crude the approximations are, and how over-simplified our ANNs are compared to real brains.

Figure 1.4: Artificial Neural Network Architecture

A neural network consists of four main parts:

1. Processing units

2. Weighted interconnections between the various processing units.

3. An activation rule which acts on the set of input signals at a unit to produce a new output signal, or activation.

8

4. Optionally, a learning rule that specifies how to adjust the weights for a given input/output pair.

1.2.4 IMPORTANCE OF ANN

They are extremely powerful computational devices

Massive parallelism makes them very efficient.

They can learn and generalize from training data so there is no need for enormous feats of programming.

They are particularly fault tolerant this is equivalent to the graceful degradation* found in biological systems. you could shoot every tenth neuron in the brain and not even notice it

They are very noise tolerant so they can cope with situations where normal systems would have difficulty.

* The property that enables a system to continue operating properly in the event of the failure of some of its components.

1.3 MAGNETIC LEVITATION

Magnetic levitation is a method by which an object is suspended with no support other than magnetic fields. Magnetic pressure is used to counteract the effects of the gravitational and any other accelerations. If the magnetic force of attraction is used, it is known as magnetic suspension. If magnetic repulsion is used, it is known as magnetic levitation. In the past, magnetic levitation was attempted by using permanent magnets. Earnshaws theorem (which states that a collection of point charges cannot be maintained in a stable stationary equilibrium configuration solely by the electrostatic interaction of the charges) however, proves that this is mathematically impossible. There exists no arrangement of static magnets of charges that can stably levitate an object.

The following conditions are exceptions to Earnshaws theorem:

Diamagnetism: occurs in materials which have a relative permeability less than one. The result is that is eddy currents are induced in a diamagnetic material, it will repel magnetic flux.

The Meissner Effect: occurs in superconductors. Superconductors have zero internal resistance. As such induced currents tend to persist, and as a result the magnetic field they cause will persist as well.

Feedback: used in conjunction with electromagnets to dynamically adjust magnetic flux in order to maintain levitation.

Magnetic suspension works via the force of attraction between an electromagnet and object. If the object gets too close to the electromagnet, the current in the electromagnet must be reduced. If the object gets too far, the current to the electromagnet must be increased.

9

Electromagnetic levitation works via the magnetic force of repulsion and we use Feedback to the system in order to levitate the object. Levitation can be used to control an object in a three dimensional space. There is much interest in levitation due to its possible applications in high speed transport technology. These applications can be broadly referred to as MagLev, which stands for magnetic levitation.

The easiest way to levitate an object electromagnetically (from a control perspective) is via magnetic suspension. The object that is to be levitated is placed below an electromagnet (only one is required), and the strength of the magnetic field produced by the electromagnet is controlled to exactly cancel out the downward force on the object caused by its weight. This method circumvents Earnshaws theorem by making use of feedback.

The main driving interest behind electromagnetic levitation is in its applications in mass transport. Much research is being done on the methods and complexities of this technology. In its applications in mass transport, particularly trains, this technology is loosely referred to as MagLev.

1.3.1 MAGLEV

This concept has already found commercial application in maglev trains. MagLev is most commonly used when referring to trains. MagLev is desirable in such an application because of the low maintenance for the track networks, and the low friction track that it provides. Because many trains gain their energy from sources not on the actual train, the energy requirements of the system become less stringent. Therefore, even though, it takes a considerable amount of energy to levitate the train, the energy can be feasibly obtained and transferred to the train.

Various things need to be taken into account when considering the levitation subsystem of a greater MagLev system. The most obvious considerations are the requirements to levitate the train. These include the force required to lift the train, energy consumption, drive systems (the way in which electromagnets are arranged and triggered which causes the train to move forward) and forces acting on the train as it travels at high speed through turns. Oscillations and sudden movements or accelerations are undesirable and can cause great discomfort to passengers. As such, the control requirements are very rigorous. Basically, the train must be kept, levitated, on track and moving forward with the ability to stop as required. All this must preferably be achieved through non-contact methods, such as through the use of magnetic fields.

MagLev seeks to circumvent Earnshaws theorem through the use of feedback. Using feedback and electromagnetic levitation, solves the fundamental problem described by Earnshaw. The next issue of concern is useful levitating stability. The various means of achieving this are through different arrangements of electromagnets. These take advantage of either magnetic suspension or magnetic levitation or both. Due to the rigid nature of the trains structure, and the fact that it must travel down a guided path, the configurations of the electromagnets on the

10

train and on the track become simpler. Below is a diagram of a simplified arrangement of electromagnets for MagLev systems.

Figure 1.5: Arrangements of magnets in MagLev systems

The sideways motion of the train is just as important as the up and down motion of the train. Thus the problem of magnetic levitation has shifted from being a one dimensional problem as in the case of magnetic suspension, to a three dimensional problem (Although in this project we are concerned with one-dimensional control of the system).

1.3.2 APPLICATIONS

Different applications of Magnetic Levitation system are:

Magnetic levitation vehicle

Magnetic levitation bearing

High speed magnetic levitation motor

Wind tunnel magnetic levitation system

Magnetic levitation anti-vibration system

Magnetic levitation fusion

11

CHAPTER 2: INTRODUCTION TO MAGNETIC LEVITATION SYSTEM (LAB HARDWARE)

The Magnetic Levitation Apparatus by Googol Technology Limited, as shown in the figure below was used in the Controls Lab of Electronics and Communications Engineering department, I. I. T., Roorkee.

Figure 2.1: The MagLev system in Lab

12

Figure 2.2: Magnetic Levitation System Configuration

When current goes through the winding, an electromagnetic force F is generated. By controlling the current in the electromagnet winding to balance the steal ball gravity force mg by magnetic force, the steal ball will be levitated in the air. Closed loop control is required for the stability and anti-interference. The distance x from the steal ball to electric magnet is detected by sensor system composed of light source and light sensor. To enhance the performance, the speed of the distance variance can also be considered. The control current is the input for magnetic levitation control object.

13

2.1 SYSTEM COMPONENTS

1. Metallic Ball:

The object to be controlled is a 22g metallic steel ball of radius 12.5 mm.

2. Electromagnet:

This generates the electromagnetic force to counteract the gravitational force on the metallic object. It consists of a solenoid (with a large number of turns) with a ferromagnetic core (to strengthen the magnetic field produced). The strength of the electromagnetic force is controlled by the current through the solenoid (hence control is exercised by controlling the current through the electromagnet.)

3. Light Source and Photo sensor:

A light source and photo sensor is used to detect the position of the ball position and use feedback control for position control of the system.

In magnetic levitation system, sensor is the core component, which requires high precision and stability. In this application, we detect the distance from the steal ball to the electromagnet. The control is applied vertically; therefore linear position sensor is required. Depending on the work precision and speed requirement of the sensor, the common types of sensors used include laser, photo, ultrasonic etc. Each of them has its advantages and disadvantages. In most applications laser distance sensor is used since its high precision, product maturity and feasibility. However, the cost will be higher. Photo -sensor is used in some magnetic levitation devices, but it also has a higher cost.

Ultrasonic sensor has higher feasibility, but its precision is lower than the other two types, and it had better work in position detection of planar objects. Moreover, there is large delay. Since the control object is a ball in this system, ultrasonic sensor is not suitable for the system.

Other common photosensitive components include photosensitive resistors, photosensitive transistors (include photosensitive diodes and photosensitive triodes), silicon solar cells etc. They are all made from semiconducting material and work with the principle of photoelectric effect. Photosensitive resistors are stable. However, they have low sensitivity, less linearity; Photosensitive diodes have high sensitivity, wide spectrum range, small volume, but lower stability and linearity; Photosensitive triodes have very high sensitivity, higher linearity and very high frequency response, but is easily affected by surrounding temperature; The linearity and stability of silicon solar cells are higher, the spectrum range is wider, but the sensitivity is lower, and the speed of frequency response is relatively slow, and the volume is large.

14

Since the signal frequency is low (

15

Figure 2.3: Real Control Model

Using DAQ we tried to control the above system through our Artificial Neural Network. The DAQ toolbox can be understood from the code given in Appendix.

The Problem:

As seen from the figure shown below output range is fixed in the range of [0 5] V and cannot be changed since this parameter is in Read Only mode. However we need to output current (V) more than 5V (average 9.458 V) to be levitated at the height of about 4 V (multiplying factor= .218(per cm) from light sensor).Thus to use this toolbox we had to bring down our height range from 4V to 2V.

16

Figure 2.4 : Snapshot of the properties of channel of Analog Output Object

2.2.2 INTERFACING THROUGH SIMULINK

In this method we explored two methods in its sub domain.

Method 1:

Figure 2.5: Simulink model for method 1

17

This method [7] couldnt work in real time due to a number of errors in real time while directly implementing the code in Simulink. Hence we switched to method 2 as shown below.

Method 2:

This is an indirect method to interact with the real time system. Figure is shown below:

Figure 2.6: Simulink model for method 2

The code to understand such interfacing has been mentioned in the Appendix.

The Problem:

Current in the electromagnet was controlled by changing the gain in shown in above figure but to get the data from Output port in real time, event listener is used which though returns the value in command window but doesnt return the value in workspace which makes it useless as it cannot be utilized by our control algorithms as feedback to optimize future controls.

2.3 SYSTEM PROPERTIES

Though magnetic levitation system has different application with variety of structure and configuration, they have the same basic properties:

1. Nonlinearity

Magnetic levitation is a typical nonlinear complex system. The approximate model can be obtained through linearization. It can also be controlled by nonlinear control theory.

2. Uncertainty

18

The uncertainty mainly is modeling error, electromagnetism interfere and other outside disturbances. In the experiment, uncertainty can be reduced by adding lens hood, enhancing the background light, or reducing the electromagnet temperature, etc.

3. Open loop instability

There is only one steady state of the magnetic levitation system, which is, when the electromagnetic force balance the gravity force of the levitate object. When the system is open loop, slight disturbance will change the steady state.

Above properties increase the control difficulty of the magnetic levitation system and adding research value for users.

2.4 SYSTEM MODELING

In order to analyze or design an automatic control system, the mathematical model that depicts

the system motion pattern, has to be established first. An idealized physical system is called a

physical model. The mathematical expression of the physical model is called the mathematical

model.

The following assumptions are made for the modeling of the magnetic levitation system:

All the magnetic flux go through the magnetic pore outside air gap, ignore the magnetic

flux leak;

Magnetic flux is even in the air gap, no edge effect;

Ignore the magnetism reluctance of the ball and electromagnet. Then the reluctant is

mainly in the air gap between the ball and the electromagnet.

All the magnetic force is focused in the mass center of the ball, which is also the ball

center.

2.4.1 MATHEMATICAL MODELING

Assuming that the ball is not disturbed by external forces, then it is only affected by the

magnetic force F and gravity force mg. The dynamic equation in vertical direction can be

described as:

.(1)

Where

x : Distance of the center of mass of object from the electromagnet.(m);

m : Mass of the object.(kg);

19

F(i,x) : Electromagnetic force on the object.(N);

g : acceleration due to gravity.(m/s^2);

Here (, ) = (

)2

where C : magnetic force constant

Input voltage equation can be stated as

= +()

(2)

Where

R : coils resistance

L : inductance of the coil

i : current of coil

e : voltage input of the coil

Here L(x) is a nonlinear function of x given as

() = 1 +00

(3)

Thus finally we get voltage equation as

= +

(

00

2)

(4)

If 1 = , 2 = , 3 = and u=e (input voltage), then we get state equations as:

1

= 2

2

= /(3/1)2

3

= 3

+

2 (2312

)

+ /

20

2.4.2 SIMULINK MODEL

The above state equations are transformed into a Simulink model which is shown as

Figure 2.7: Simulink model of Maglev System

The nonlinear system shown above is open loop unstable.Its step response can be seen from

the following graph:

Figure 2.8: Maglev open loop response

21

The upper graph shows the step input on y axis and time on x-axis. For the lower graph, height

is shown on y-axis and time on x-axis. The graph clearly shows that our system is open loop

unstable.

2.5 SYSTEM IDENTIFICATION

This involves the artificial neural network training using maglev dataset as obtained from our

plant model. The input-output sequence can be seen from the following figure:

Figure 2.9: Input-Output Sequence

22

CHAPTER 3: NEURAL GENRALIZED PREDICTIVE CONTROL

The GPC system starts with the input signal, r(t), which is presented to the reference model.

This tracking reference signal is used as an input to the CFM block. The CFM algorithm produces

an output, which is used as an input to the plant. Between samples, the CFM algorithm uses

this model to calculate the next control input, u (t+1), from predictions of the response from

the plants model. Once the cost function is minimized, this input is passed to the plant.

Figure 3.1: A GPC system

The objective of predictive control is to compute the future control sequence

u(t),u(t+1),.u(t+Nu-1) in such a way that the future plant output is driven close to the

reference value i.e. the desired height h. This is accomplished by minimizing J(N1,N2,Nu). [8]

3.1 NGPC System:

The Neural Generalized Predictive Control (NGPC) system consists of four components, the

plant to be controlled, a reference model that specifies the desired performance of the plant, a

neural network that models the plant, and the Cost Function Minimization (CFM) algorithm that

determines the input needed to produce the plants desired performance. The NGPC algorithm

consists of the CFM block and the neural net block.

23

Figure 3.2: NGPC system

The NGPC system starts with the input signal, r(n), which is presented to the reference model.

This model produces a tracking reference signal, ym(n), that is used as an input to the CFM

block. The CFM algorithm produces an output that is either used as an input to the plant or the

plants model. The double pole double throw switch, S, is set to the plant when the CFM

algorithm has solved for the best input, u(n), that will minimize a specified cost function.

Between samples, the switch is set to the plants model where the CFM algorithm uses this

model to calculate the next control input, u(n+1), from predictions of the response from the

plants model. Once the cost function is minimized, this input is passed to the plant.

3.2 SELECTION OF MINIMIZATION CRITERIA

The selection of the minimization algorithm affects the computational efficiency of the algorithm. The ability of the GPC to make accurate predictions can be enhanced if a neural network is used to learn the dynamics of the plant instead of standard nonlinear modeling techniques and is called NGPC approach. The selection of a minimization method can be based on several criteria such as: number of iterations to a solution, computational costs and accuracy of the solution. In general these approaches are iteration intensive.

24

CHAPTER 4: CONTROL ALGORITHMS

Since the control algorithms used in this project are based on artificial neural networks, system identification is the preliminary step.

4.1 NONLINEAR PREDICTIVE CONTROL

4.1.1 NETWORK ARCHITECTURE

The prediction model chose in NARX or Nonlinear Auto Regressive using External (Exogenous) Input. Thus it predicts the output y(t) using past d values of y(t) and another time series x(t) as shown in the figure below:

Figure 4.1: NARX model

Figure 4.2: Network Architecture

4.1.2 COST FUNCTION

The idea behind is to minimize a criterion of the following type at each iteration:

25

with respect to the Nu future controls

and subject to the constraint

This cost function minimizes not only the mean squared error between the reference signal and

the plants model, but also the weighted squared rate of change of the control input with its

constraints. When this cost function is minimized, a control input that meets the constraints is

generated that allows the plant to track the reference trajectory within some tolerance. There

are four tuning parameters in the cost function, N1, N2, Nu, and rho.

Here, N1 denotes the minimum prediction (or costing) horizon, N2 the maximum prediction (or

costing) horizon, and Nu the (maximum) control horizon. Rho is a weighting factor for

penalizing variations in the control input. The predictions of the plant will run from N1 to N2

future time steps. The bound on the control horizon is done by Nu.

4.1.2 COST FUNCTION MINIMIZATION ALGORITHM:

The objective of the CFM algorithm is to minimize J with respect to [u(n+l), u(n+2), ..., u(n+Nu)]

denoted U. This is accomplished by setting the Jacobian of Equation to zero and solving for U. J

is minimized iteratively to determine the best U. An iterative process yields intermediate values

for J denoted J(k). For each iteration of J(k) an intermediate control input vector is also

generated and is denoted as vector.

Since the criterion is minimized iteratively an initial guess on the sequence of future controls,

is required. If the criterion has more than one local minimum it is desirable to execute the

optimization algorithm more than once to find the global one, starting from different

initializations of U0(t).

26

After every iteration, all the vectors are updated as in:

The Jacobian is denoted by:

And the Hessian is denoted by:

Each element of the Jacobian is calculated by partially differentiating Jacobian Equation with

respect to vector U. The last computation needed to evaluate U(k+1) is the calculation of the

predicted output yhat of the plant, and its derivatives. The predictions of future outputs, yhat

(t + i),are determined as the minimum variance predictions. The optimization problem (which

27

must be solved on-line since a new linear model is obtained at each sample) results in a

sequence of future controls, U(t).

From this sequence the first component, u(t), is then applied to the process. This process

involving loopback over the prediction horizon, calculating hessian etc has been explained by

Norgaard in the NPC control toolbox and here we directly analyse the controller derived.

Npccon2.m matlab file in the toolbox has been used to simulate NPC using a Newton-Raphson

based Levenberg-Marquardt method.

4.1.3 TUNING OF PLANT PARAMETERS

For any plant to operate at a high productivity level with high efficiency, the plant parameters

and the dynamics of the controller used are modified based on experiment experiences and

simulations obtained. The plant works best under these set of constraints data at high

efficiency. For a Maglev system, the control vector i.e. current and the output function i.e. the

height of ball have certain physical constraints to obtain satisfactory results.

Certain such conditions involved in this plant are as follows:

Nu has to be kept less than N2.Also N1 is generally kept as 1.Output height h should be kept up

to 4 cm only and beyond this range errors are possible. Control current should be kept in the

range +-5 A , to avoid unnecessary ohmic heating.

4.2 INTERNAL MODEL CONTROL

In recent years, neural Networks based techniques have also been explored. They have an

inherent ability to approximate nonlinear functions and so prove useful to model nonlinear

plants. Internal Model Control (IMC) structure models the plant in parallel with the model of

the plant with a controller placed at their input. If the model is exact, there will be no feedback

to the controller. For inexact plant models and in the presence of disturbance, the input to the

controller is the difference of the set point and the feedback signal.

In this approach, the control signal is synthesized by a combination of a forward model of the

process and an inverse model. An attractive property of this design is that it provides an off-set

free response even if the process is affected by a constant disturbance. Here we have used two

Feed forward Neural Networks (FFNN), one to model the plant and one as controller. The back

propagation algorithm is used to determine the parameters of the models.[5]

28

Figure 4.3: Controller Plant transfer function

A controller, Gc(s).,is used to control the process, Gp(s). Suppose Gp(s) is a model of Gp(s). By

setting Gc(s) to be the inverse of the model of the process, i.e.

Gc(s)=Gp(s)-1

and if Gp(s)=Gp(s),

then model is an exact representation of the process and the output will always be equal to the

set point.

Notice that this ideal control performance is achieved without feedback. What this tells us is

that if we have complete knowledge about the process (as encapsulated in the process model)

being controlled, we can achieve perfect control. It also tells us that feedback control is

necessary only when knowledge about the process is inaccurate or incomplete. In practice,

however, process-model mismatch is common; the process model may not be invertible and

the system is often affected by unknown disturbances. Thus the above open loop control

arrangement will not be able to maintain output at set point, but forms a control strategy.

General Structure:

The manipulated input U(s) is introduced to both the process and its model. The process

output, Y(s), is compared with the output of the model, resulting in a signal d(s) i.e.

29

Figure 4.4: Internal Model Control

If d(s) is zero for example, then d(s)is a measure ofthe difference in behavior between the

process and its model. If Gp(s)=Gp(s), then d(s) is equal to the unknown disturbance. Thus d(s)

may be regarded as the information that is missing in the model, Gp(s) and can therefore be

used to improve control. This is done by subtracting d(s) from the set point R(s). [6]

Thus,

and

30

From this closed loop expression, we can see that perfect setpoint tracking and disturbance

rejection is achieved, given the basic conditions are specified.

4.2.1 INVERSE MODEL

Before considering the actual control system, an inverse model must be trained. The principle

of this is that if the process can be described by:

y(t +1) = g(y(t),, y(t - n +1),u(t),,u(t - m))

a network is trained as the inverse of the process:

u(t) = g -1(y(t + 1), y(t),, y(t - n + 1),u(t -1),u(t - m))

The inverse model is subsequently applied as the controller for the process by inserting the

desired output, the reference r(t+1), instead of the output y(t+1).

Figure 4.5: Internal Model Control Block

A generalized technique where the network is trained off-line to minimize the following

criterion ( specifies the weights in the network):

31

An experiment is performed and a set of corresponding inputs and outputs are stored.

Subsequently the function general, which applies a version of the Levenberg-Marquardt

method, is invoked.

32

CHAPTER 5: RESULTS AND OBSERVATION

5.1 NONLINEAR PREDICTIVE CONTROL From the following figures, it is clear that the ball tries to trace the reference heights provided. The plant

can be further fine-tuned to reduce the number of oscillations by changing NN parameters. Satisfactory

tracking results are obtained. This is the result of software simulation .

Figure 5.1: Plot for y and u for a fixed set height of 2.5 cm.

33

Figure 5.2: Plot for y and u for different set heights

When applied the same control system to real time MagLev system, ball didnt hold on to a

particular height.

5.2 INTERNAL MODEL CONTROL

34

CHAPTER 6: CONCLUSION

In case of nonlinear predictive control, the quality of the plants model affects the accuracy of a

prediction. With a linear plant there are tools and techniques available to make modelling

easier, but when the plant is nonlinear this task is more difficult. Models using neural networks

have been shown to have the capability to capture nonlinear dynamics. For nonlinear plants,

the ability of the GPC to make accurate predictions can be enhanced if a neural network is used

to learn the dynamics of the plant instead of standard modelling techniques. Improved

predictions affect rise time, over-shoot, and the energy content of the control signal.

35

CHAPTER 7: APPENDIX

DATA ACQUISITION TOOLBOX CODE

AO=analogoutput('advantech',1);

creates the analog output object AO for the specified adaptor(here advantech is our MAGLEV

adaptor) and for the hardware device with device identifier ID=1.

addchannel(AO, [1])

adds the hardware channels specified by [1] to the device object AO

ai = analoginput('advantech',1);

creates the analog input object AO for the specified adaptor(here advantech is our MAGLEV

adaptor) and for the hardware device with device identifier ID=1.

addchannel(ai,[1]);

adds the hardware channels specified by [1] to the device object ai

load input

loads input/output data for a particular reference height

for i=1:1000

u=in(i);

putsample(AO,u)

sends data given by u(here current(V)) to our MAGLEV system

start(ai);

Start the process to collect input coming from our MAGLEV system

getdata(ai,1)

getting the retrieved input from MAGLEV system(here height(V))

stop(ai);

end

36

SIMULINK INTERFACING CODE

in=1;

open_system('bams_realcontrol');

open the simulink model

rtwbuild('bams_realcontrol');

build the model

set_param(gcs,'SimulationCommand','Connect');

connect the model to the hardware shown by Real Control box above

set_param(gcs,'SimulationCommand','Start');

Start the simulation

rto=get_param('bams_realcontrol/Display1','RuntimeObject');

gcb='bams_realcontrol/Display1';

for i=1:100

in=10;

set_param('bams_realcontrol/Gain','K','in');

Changing the gain of block as per our desired input to the system

rto.InputPort(1).Data

Retrieving the output from the Real Control system

NONLINEAR PREDICTIVE CONTROL CODE % PROGRAM DEMONTRATION OF NEURAL NETWORK BASED PREDICTIVE CONTROL %LOAD THE INPUT OUTPUT SEQUENCE FROM THE PLANT AND DIVIDE IT INTO TRAINING

SET AND VALIDATION SET load expdata; N2=length(U); N1=floor(N2/2); Y1 = Y((1:N1))'; U1 = U(1:N1)'; Y2 = Y((N1+1:N2))'; U2 = U((N1+1:N2))'; %plot the input sequence given to the plant figure plot(U1); grid

37

axis([0 N1 min(U1) max(U1)]) title('Input sequence') xlabel('Time (samples)') %plot the output sequence of the plant figure plot(Y1); grid axis([0 N1 min(Y1) max(Y1)]) xlabel('Time (samples)') title('output sequence')

%TRAIN THE NEURAL NETWORK BY USING INPUT AND OUTPUT SEQUENCE FROM THE %PLANT AS INPUT AND OUTPUT OF THE PLANT AS THE TARGET trparms = settrain; trparms = settrain(trparms,'maxiter',200); NetDef = ['HHHH';'L---']; NN=[4 4 1]; [W1,W2,NSSEvec,iter,lambda]=nnarx(NetDef,NN,[],[],trparms,Y1,U1); save forward2 W1 W2 NetDef NN figure subplot('position',[0.1 0.55 0.45 0.38]); drawnet(W1,W2,eps,{'y(t-1)' 'y(t-2)' 'y(t-3)' 'y(t-4)' 'u(t-1)' 'u(t-2)'

'u(t-3)' 'u(t-4)'},{'yhat(t)'}); title('The trained network')

%VALIDATE THE NETWORK USING VALIDATION DATA [yhat,NSSE] = nnvalid('nnarx',NetDef,NN,W1,W2,Y2,U2);

%SIMULATE THE NGPC PLANT AND PLOTTING ITS REFERNECE AND OUTPUT figure('Units','Centimeters','Position',[1.5 1.5 10 1.5]); npccon2 close figure plot([0:samples-1],[ref_data y_data]); grid axis([0 samples -2.2 2.2]) title('Reference and output signal')

figure plot([0:samples-1],u_data); axis([0 samples min(u_data) max(u_data)]); grid title('Control signal') xlabel('Time (samples)')

figure plot([0:samples-1],[ref_data-y_data]);grid axis([0 samples -3 3]) title('Error between reference model and plant') xlabel('Time (samples)')

INTERNAL MODEL CONTROL CODE

38

CHAPTER 8: REFERENCES: