State-space model of magnetically suspended ball

In summary: I use any other input vector?Thanks for clearing that up for me. You can use any input vector you like as long as it's a current variable.
  • #1
rasco
8
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
  • #2
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:

[tex]
\ddot{x} = g - \frac{c}{M} \frac{i}{x} \qquad (1)
[/tex]
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:
[tex]
\mathbf{\dot{x}} = \mathbf{A x + B u}
[/tex]
where [itex]\mathbf{x}[/itex] and [itex]\mathbf{u}[/itex] 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.
 
  • #3
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.
 
  • #4
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'.
 
  • #5
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!
 
  • #6
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:
[tex]
\mathbf{u} = \mathbf{-K x} \qquad (2)
[/tex]
does exactly that. You're just measuring [itex]\mathbf{x}[/itex], multiplying it by some matrix [itex]-\mathbf{K}[/itex] 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 [itex]\mathbf{x}[/itex], a digital computer with an analog-to-digital converter to multiply your measurement with [itex]-\mathbf{K}[/itex] and a current source with a digital interface to produce [itex]\mathbf{u}[/itex]. Your linear process model would be in the form:
[tex]
\mathbf{\dot{x}} = \mathbf{A x} + \mathbf{B u} \Leftrightarrow
\begin{bmatrix}\dot{x} \\ \ddot{x}\end{bmatrix}
= \mathbf{A}
\begin{bmatrix}x \\ \dot{x}\end{bmatrix}
+ \mathbf{B} ,\, \mathbf{x} =
\begin{bmatrix}x \\ \dot{x}\end{bmatrix}
,\, \mathbf{u} =
[/tex]
If [itex]\mathbf{K}[/itex] is chosen appropriately, [itex]\mathbf{x}[/itex] 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:
  • #7
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.
 
  • #8
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.
 
  • #9
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!
 

1. What is a state-space model for a magnetically suspended ball?

A state-space model for a magnetically suspended ball is a mathematical representation of the dynamics of a ball that is suspended in mid-air using magnetic forces. It describes the relationship between the state variables (position, velocity, and acceleration) of the ball and the input variables (voltage and current) that control the magnetic forces.

2. How is a state-space model of a magnetically suspended ball different from other models?

A state-space model is different from other models because it takes into account the effects of both the state and input variables, as well as external disturbances, on the behavior of the system. It also allows for more accurate and flexible control of the system compared to traditional linear models.

3. What are the main applications of a state-space model of a magnetically suspended ball?

A state-space model of a magnetically suspended ball is commonly used in the design and control of magnetic levitation systems, such as in high-speed trains, magnetic bearings, and hoverboards. It is also used in research and development of new technologies involving magnetic suspension, such as flywheels and energy storage systems.

4. How is a state-space model of a magnetically suspended ball created?

A state-space model of a magnetically suspended ball is created using the principles of classical mechanics and control theory. The physical properties and dynamics of the ball are modeled using differential equations, and then converted into state-space form. The model parameters are then identified through experimentation or simulation.

5. What are the advantages of using a state-space model of a magnetically suspended ball?

Using a state-space model of a magnetically suspended ball allows for more accurate and efficient control of the system, as it takes into account the effects of disturbances and input signals. It also allows for easy integration with modern control techniques, such as optimal control and robust control, to improve the performance and stability of the system.

Similar threads

  • Astronomy and Astrophysics
Replies
2
Views
1K
  • DIY Projects
Replies
7
Views
307
  • Introductory Physics Homework Help
Replies
4
Views
327
  • Classical Physics
Replies
4
Views
978
  • DIY Projects
Replies
2
Views
2K
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
34
Views
667
  • Introductory Physics Homework Help
Replies
7
Views
769
  • Introductory Physics Homework Help
Replies
5
Views
1K
  • Quantum Physics
Replies
0
Views
193
Back
Top