# How to consider gravity for the state space modeling

I'm trying to find the state-space model of the following ball-in-tube system. I designed the SISO system, with the h(ball height), w(angular velocity of propeller), and I(current) as the system states. I tried to find out the stat-space model by using the state-space model of DC-motor and dh/dt = Kw - v0 (experimentally obtained, where K is constant, v0 is an intercept). The question is how I can deal with v0 to obtain the state-space model form of dx/dt = Ax+Bu, y = Cx +Du.

• The motion equation $\dot{h}=K \cdot w-v_0$ has no physical meaning, at least for working points close to $w=0$. We know that for $w=0$ the ball shall fall subject to gravity (and possibly viscous friction), therefore its velocity cannot be constant and equal to $-v_0$. You should rethink your experiment. Dec 10 '20 at 23:00
• Start off with the physical description of the motion of the ball: $m \cdot \ddot{h} = T - mg$ (neglecting the viscous friction), where $T$ is the thrust generated by the propeller. $T$ is somehow linked to $w$, which in turn is determined by the DC motor input voltage $u$ according to the transfer function $w/u = A / (\tau \cdot s +1)$. Dec 10 '20 at 23:35
• Can you state the actual equations? Dec 20 '20 at 12:05

As Ugo Pattacini said, the experiment must be rethought taking into account the dynamics of the ball. In this case, your system will have 4 states: current $$j$$, angular velocity $$\omega$$, ball height $$h$$, and ball speed $$s=\dot{h}$$.

As pointed out, the dynamics of $$s$$, neglecting viscous friction and other aerodynamic effects, can be modeled as $$\dot{s}={T\over m}-{g\over m}$$. The last term (gravity) can be seen as a disturbance $$\delta=[0\;0\;0\;{g\over m}]^T$$ in your system that you can reject using your control loop.

You can rewrite your state-space model using $$\dot{x}=Ax+Bu+\delta.$$

You can estimate the thrust $$T$$ running an experiment where the ball gets balanced at multiple heights.

Make gravity a state that doesn't change, like:

$$\left[ \begin{matrix} \dot{x}\\ 0 \end{matrix}\right] = \left[\begin{matrix} A & 0 \\ 0 & 0 \end{matrix}\right]\left[\begin{matrix} x \\ g \end{matrix}\right] + \left[\begin{matrix} B \\ 0 \end{matrix}\right]u$$

Then gravity is a state and you can include it with whatever coefficients you need. You of course won't be able to control the system, because there is no path back to manipulate the gravity state, but you can go for the lesser "stabilizable" system and control the states that actually matter.

• Gravity is perfectly known so state augmentation is not a good option here, I think. Also, the state-space model above looks kind of weird to me: the first raw of the dynamic matrix cannot be [A 0] otherwise $g$ won't have any effect on $\dot{x}$. It should be rather something like [A b], but then b is right what the OP is asking for. Dec 10 '20 at 23:30