State-space model of magnetically suspended ball

Click For Summary

Discussion Overview

The discussion revolves around the modeling and control of a magnetically suspended ball using state-space representation. Participants explore the formulation of the state-space model, the role of inputs and outputs, and the implications of different modeling approaches on control strategies.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant presents a simplified equation for the magnetically suspended ball and seeks help in forming the state-space model, specifically matrices A and B.
  • Another participant suggests an alternative model that incorporates a proportionality constant and emphasizes the need for a process model that reflects observable and controllable variables.
  • Questions arise regarding the appropriate structure of the model to meet specific control requirements, including the relationship between input (position) and output (current).
  • There is discussion about the use of a Jacobian matrix for linearization of the proposed model, with references to external resources for clarification.
  • Participants express uncertainty about the necessity of including current in the state vector and discuss the implications of feedback control laws on system behavior.
  • One participant inquires about the feasibility of controlling the system based on distance from the magnet rather than current, leading to further exploration of control strategies.
  • A participant shares calculations for the linear time-invariant (LTI) system and discusses stability issues, including the use of pole placement for control design.

Areas of Agreement / Disagreement

Participants express differing views on the appropriate modeling approach and control strategies. There is no consensus on the best method to achieve the desired control objectives, and several competing models and ideas are presented throughout the discussion.

Contextual Notes

Limitations include potential misunderstandings of the relationship between state variables and control inputs, as well as the challenges in linearizing non-linear models. The discussion also reflects varying levels of familiarity with control theory concepts among participants.

Who May Find This Useful

This discussion may be useful for students and practitioners interested in control systems, particularly those focusing on state-space modeling and feedback control in physical systems.

rasco
Messages
8
Reaction score
0
Hi,
I have a 'simplified' equation of the magnetically suspended ball.

a = g - (i/h * M)

where

a - actual acceleration of the ball.
h - distance from the magnet.
g - gravitational acceleration, to keep it simple let g = 10
M - mass of the ball 0.05 kg
i - current through the coil = how strong the magnet is.

I need to make a simulation where controller's input 'u' is distance of the ball from magnet and 'y' from the controller is current 'i' of the magnet. The output y directly puts current into the coil (its just processing simulation with a falling ball). To keep it simple, no observer is required.

My suggested solution:
state x consists of [x1, x2, x3] = [h, v, i]
h - dist. from magnet
v - velocity of the ball
i - current

so steady state x0 = [10,0,5]

But I do not know how to make matrixes A and B to build model:
x_dot = Ax + Bu

I started to compute matrix A as a Jacobian matrix but can not compute 3rd raw of the matrix. Maybe jacobian is not necessary.

could anybody help me please? Thx.
 
Astronomy news on Phys.org
There's something off about your model. In the form you've given, the larger the mass M, the less current i it takes to keep it from accelerating. The model:

<br /> \ddot{x} = g - \frac{c}{M} \frac{i}{x} \qquad (1)<br />
makes more sense, I think. c = 1 [N*m/A] is a proportionality constant included to make sense of the units.

First off, I think you should try to make a process model with the position and velocity of the ball as state variables and the current through the electromagnet as the input. That reflects what you'd be able to observe and control if you were to physically implement your control system. The thing is, the RHS of (1) is then not a linear combination of the state and input variables, so you can't put (1) into the form:
<br /> \mathbf{\dot{x}} = \mathbf{A x + B u}<br />
where \mathbf{x} and \mathbf{u} are the state and input vector, respectively.

You can produce such a form from (1), though, by Taylor expansion. You could give that a try.
 
Hi,
thank you very much for your help. I would have two questions:

1. what should the model look like to fulfill requirements:
- input - position of the ball
- output - current needed to keep the ball at the position defined by input. your (1) model can not be used for that? why?

2. could I use a jacobian matrix to get state-space model from your (1) equation?
x=[x1, x2]
x_dot=[x2, x2_dot]

then functions used to create jacobian matrix:

f1: x2
f2: your (1)

Sorry if my questions are off, I am just trying to understand it.
 
rasco said:
1. what should the model look like to fulfill requirements:
- input - position of the ball
- output - current needed to keep the ball at the position defined by input. your (1) model can not be used for that? why?
I know you want to implement a feedback control system so you can make the ball track some position reference you give as an input, but let's differentiate between the model of the controller and the model of the process.

The process model should represent the physical system you want to control, which is the model I was referring to in my previous post. This model will enable you to simulate the response of your physical system to some input. You could, for instance, simulate how the position of the ball changes when you have a current through the electromagnet that's sinusoidal in magnitude.

When you have a process model, then you need to decide on how to control its output. Since you want a linear state-space model, I assume you want to use linear state-space control design. Full state feedback with a reference input is relatively simple to implement. Maybe you've had a course in it?

rasco said:
2. could I use a jacobian matrix to get state-space model from your (1) equation?
The Jacobian is certainly involved. Have a look at this:
http://www.cc.ntut.edu.tw/~jcjeng/Linearization.pdf

for some examples. It was the first hit on Google for 'linearize state space'.
 
Ok. I see.
Now to the point 1:
I indeed want to implement a feedback control system. I did a course on coursera (control of mobile robots) and now want to put all things together. If I understand you correctly. First thing to do is to create a linear model of the physical system. For that I simply can use state variable x[position,velocity] and 3rd variable - current - is not needed. input would be current and output would be position.
And here comes my question. At the course we were taught to use full state feedback with a reference input:

u = -K*x

and here comes my assumption: I though that since 'u' (input vector) is a current variable, it has to be presented in the state vector 'x'. or?

Thx!
 
rasco said:
And here comes my question. At the course we were taught to use full state feedback with a reference input:

u = -K*x

and here comes my assumption: I though that since 'u' (input vector) is a current variable, it has to be presented in the state vector 'x'. or?
Think of it this way: Your process model represents your physical system and, assuming you can't alter the design of your system in any way, you have no control over it. All you can do is run current through its electromagnet (its input variable) and observe how the position and velocity of the ball (its state variables) changes. The thing you can control is the current through the electromagnet.

One way to make the state of the process behave in a certain way is to measure it and feed a function of it back into the system input. The control law:
<br /> \mathbf{u} = \mathbf{-K x} \qquad (2)<br />
does exactly that. You're just measuring \mathbf{x}, multiplying it by some matrix -\mathbf{K} and using the result as the magnitude of current you need to produce in the electromagnet. Maybe you're using some analog sensors to measure \mathbf{x}, a digital computer with an analog-to-digital converter to multiply your measurement with -\mathbf{K} and a current source with a digital interface to produce \mathbf{u}. Your linear process model would be in the form:
<br /> \mathbf{\dot{x}} = \mathbf{A x} + \mathbf{B u} \Leftrightarrow<br /> \begin{bmatrix}\dot{x} \\ \ddot{x}\end{bmatrix}<br /> = \mathbf{A}<br /> \begin{bmatrix}x \\ \dot{x}\end{bmatrix}<br /> + \mathbf{B} <i> ,\, \mathbf{x} =<br /> \begin{bmatrix}x \\ \dot{x}\end{bmatrix}<br /> ,\, \mathbf{u} = <i><br /> </i></i>
If \mathbf{K} is chosen appropriately, \mathbf{x} will tend asymptotically to the zero vector as t→∞, but please note that there's no reference input. Using (2), your control system can only drive your states to zero. You have to use another control law if you want to control what the state is driven towards.
 
Last edited:
OK, so there is no way I can control the system you described so that u=h (distance from magnet) instead of u=i ? Or I have to use some more complex feedback controller that will allow me to do that?

note: yes, I understand, that when using (u=-Kx) without reference, or with 0 reference, I will drive x asymptotically to zero. I just want to move step by step from the simplest solution to more complex.
 
rasco said:
OK, so there is no way I can control the system you described so that u=h (distance from magnet) instead of u=i ? Or I have to use some more complex feedback controller that will allow me to do that?
You can modify the control law so that it takes both the process state and a reference to track as inputs. The control law will use both these inputs to force your process state or output to follow the reference. The input to the process model will still be the current through the electromagnet.

You should probably just start by producing a linear state-space model from (1) and then have a look at implementing full state feedback.
 
Hi,
I calculated this:

LTI system:
A={{0,1},{1,0}}
B={{0},{-2}})
C={{1,0}}
D={}

I use Octave, so eig(A) = [-1;1] which means unstable.
Let's use pole placement P=[-1,-1] to compute K
K=place(A,B,P);
K={{-1,-1}}

Now we can compute our new transformation matrix A_dash:
A_dash=A-B*K
A_dash=[0,1;-1,-2]

eig(A_dash) proves position of the poles to be [-1,-1] so now we have asymp. stable system.
I even wrote simulation in processing (based on (1)) where a ball is driven to zero distance from the magnet when full state feedback [u=-Kx; u=i (current)] is used.

u = K.times(-1).times(x);
i = u.get(0,0);

I experimented then and used this code with a reference input of 50:

float ref = 50;
float N_scale = -0.5; //scale factor - we compare reference to result of K*x and not output of the system y
u = K.times(-1).times(x);
i = u.get(0,0)+(r*N_scale);

It seems to work, although I do not fully understand why. Does the scale factor do that, that although u is current, I can fill in the distance (output [y] is distance) as reference?
 
  • #10
I completely forgot about this thread. Your linearized model looks good. I assume it's for the steady-state point (xss,iss) = (10,5)?

rasco said:
It seems to work, although I do not fully understand why. Does the scale factor do that, that although u is current, I can fill in the distance (output [y] is distance) as reference?
It works because the algorithm you used to calculate N guarantees that your system will have zero steady-state error to any constant input. Does your reading material not show its derivation?
 
  • #11
Yes, the steady-state point is (xss,iss) = (10,5).
I used formula
h'' = g - (c * i)/(M * h)
where
h'' is actual acceleration,
i is current,
c is constant equal to 1
g is gravit.constant equal to 10
M is weight (0.05kg) and
h is distance from the magnet

I stated h'' to be zero and h to be 10 so i = 5.

To calculate the scale factor "N" I used Octave and the function created for MATLAB described here: http://ctms.engin.umich.edu/CTMS/index.php?aux=Extras_rscale

However I have not fully understood yet how is the N factor (a) computed (b) affects the feedback = how N guarantees that your system will have zero steady-state error to any constant input. Going to google it. MANY THX!
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
Replies
24
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
5
Views
4K
Replies
1
Views
1K
Replies
34
Views
3K
Replies
7
Views
2K