Understanding Digital State Space Control to Sensors and Actuators"

Click For Summary

Discussion Overview

The discussion revolves around the implementation of digital state space control for a system involving an inverted pendulum on a cart and a DC motor actuator. Participants explore the relationships between state variables, sensor measurements, and actuator inputs within the context of state space models.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant seeks clarification on the roles of the state space variables, specifically how sensor measurements relate to outputs and actuator inputs.
  • Another participant references a flow diagram that outlines the capabilities required for real-time processing in state space control.
  • A participant describes a proposed algorithm for implementing state feedback using sensor measurements and a gain matrix.
  • Concerns are raised about whether the process model includes the dynamics of the actuator, which could affect the expected input to the system.
  • One participant expresses a desire to combine the state space models of the inverted pendulum and the DC motor, noting the differences in dimensions and state variables.
  • Another participant suggests that state space models can be combined by including interconnections as internal state information.
  • Discussion continues on how to augment state vectors to incorporate both the motor and pendulum dynamics, with varying suggestions on which states to include.
  • Participants explore the relationship between motor torque, current, and the force applied to the cart, questioning how to express these relationships in the combined model.
  • There is a focus on the need to clarify the connections between the motor and the cart, particularly regarding the angular velocity and its impact on the system's dynamics.

Areas of Agreement / Disagreement

Participants do not reach a consensus on how to combine the state space models or the specific relationships between the variables. Multiple competing views and approaches are presented throughout the discussion.

Contextual Notes

Participants express uncertainty regarding the interconnections between the motor and cart, the assumptions about rigid connections, and how to properly formulate the combined state space model. There are unresolved mathematical steps in deriving the relationships between the variables.

NeuralNet
Messages
24
Reaction score
0
I am trying to implement a digital state space control and am confused about something. The system has the standard state space form:
x(k+1) = Ax(k) + Bu(k)
y(k) = Cx(k)

The vector y(k) comes from the sensors measurements and u(k) is what is sent to the actuator, right?
 
Engineering news on Phys.org
I am confused because I am reading the following in a book that uses standard state space notation:

o8w387.png

The flow diagram assumes that the real-time processor provides the following capabilities.

"A real-time clock enabling execution of the update loop at integer multiples of the sampling interval h.

Input devices for reading the plant sensors.

Output devices that enable the controller to drive the plant actuators."
 
If you are talking about a diagram like this:

StateSpaceTutorial_ControlDesign_BlockDiagram.png


then Y is your output and U is the input into the system.

Your sensor measurement would happen somewhere after Y and feedback through a controller that would generate U. Remember, the state space diagram is a model of the system you are trying to control and does not include the controller.
 
That block diagram is what we are trying to implement.

So we are measuring two out of four of the states. The system is fully controllable and observable. We want to implement state feedback, and have generated a gain matrix K. So we would like to implement the following algorithm:

1. Get values from sensors, store in y.
2. Estimate the state, store in x.
3. Calculate u=-Kx.
4. Send u to the actuator.
5. Repeat.

Is my logic correct?
 
Sure, if your closed-loop estimator and process poles are placed right.

Does your process model include the dynamics of your actuator though? Otherwise you might not be feeding your process the input you're expecting.
 
No I am not. The system is an inverted pendulum on a cart. The actuator is a DC motor. The value produced for u is the force that is supposed to be applied to the cart to move it.

I would like to just combine the models. How do I do that because the matrices describing the dynamics of the inverted pendulum and the motor are different dimension and also have different state variables.

How do I combine state space models? Here are the models I am using:

Inverted Pendulum:
http://ctms.engin.umich.edu/CTMS/index.php?example=InvertedPendulum&section=ControlStateSpace

Motor:
http://ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition&section=ControlStateSpace
 
Last edited:
You generally combine state space models by including their interconnections as internal state information instead.

Here's your 'DC Motor Position' state space model split into electrical and mechanical subsystems:

<br /> \frac{\mathrm{d}}{\mathrm{dt}}i = -\frac{R}{L}i +<br /> \begin{bmatrix}<br /> \frac{1}{L} &amp; -\frac{K}{L}<br /> \end{bmatrix}<br /> \begin{bmatrix}<br /> V\\<br /> \dot{\theta}<br /> \end{bmatrix}<br />

<br /> \frac{\mathrm{d}}{\mathrm{dt}}<br /> \begin{bmatrix}<br /> \theta\\<br /> \dot{\theta}<br /> \end{bmatrix} =<br /> \begin{bmatrix}<br /> 0 &amp; 1\\<br /> 0 &amp; -\frac{b}{J}<br /> \end{bmatrix}<br /> \begin{bmatrix}<br /> \theta\\<br /> \dot{\theta}<br /> \end{bmatrix} +<br /> \begin{bmatrix}<br /> 0\\<br /> \frac{K}{J}<br /> \end{bmatrix}i<br />

You can see how they're easily combined by adding more states to account for their interconnections.
 
Last edited:
The variable \theta is what relates the motor to the inverted pendulum system. This is because the torque the motor exerts is converted to the linear force applied to the cart through a pulley gear system.

But I still don't see how I combine their state space models. Do I augment the matrices together - resulting in a higher order system, or do I combine them in some other sense?
 
Last edited:
I used the state space model on the page you have linked to, 'DC Motor Position', as a simple example. I have split it into two state space models (I do not include the output equation for each) so you can see how they're combined to form the model on the 'DC Motor Position' page.

First model has current, i, as state and motor terminal voltage and angular velocity as inputs, V and theta_dot, respectively.

Second model has angular position and angular velocity as states, theta and theta_dot, respectively and current, i, as input.

Can you try to make a combined model of these two? Start with states:
<br /> \begin{bmatrix}<br /> \theta\\<br /> \dot{\theta}\\<br /> i<br /> \end{bmatrix}<br />
 
  • #10
Okay, so would the states be augmented like this:

<br /> \begin{bmatrix}<br /> \theta\\<br /> \dot{\theta}\\<br /> i\\<br /> x\\<br /> \dot{x}\\<br /> \phi\\<br /> \dot{\phi}<br /> \end{bmatrix}
 
Last edited:
  • #11
The variable θ is what relates the motor to the inverted pendulum system. This is because the torque the motor exerts is converted to the linear force applied to the cart through a pulley gear system.

The input for your cart-pendulum model is a force. The DC motor produces torque K*i, so the force applied to the cart will only be a function of current, i. You don't need theta, theta_dot. States could be:

<br /> \begin{bmatrix}<br /> x\\<br /> \dot{x}\\<br /> \phi\\<br /> \dot{\phi}\\<br /> i<br /> \end{bmatrix}<br />
 
  • #12
Well, from your equations that separate the electrical and mechanical description of the motor:
<br /> \frac{\mathrm{d}}{\mathrm{dt}}i = -\frac{R}{L}i +<br /> \begin{bmatrix}<br /> \frac{1}{L} &amp; -\frac{K}{L}<br /> \end{bmatrix}<br /> \begin{bmatrix}<br /> V\\<br /> \dot{\theta}<br /> \end{bmatrix}<br />

<br /> \frac{\mathrm{d}}{\mathrm{dt}}<br /> \begin{bmatrix}<br /> \theta\\<br /> \dot{\theta}<br /> \end{bmatrix} =<br /> \begin{bmatrix}<br /> 0 &amp; 1\\<br /> 0 &amp; -\frac{b}{J}<br /> \end{bmatrix}<br /> \begin{bmatrix}<br /> \theta\\<br /> \dot{\theta}<br /> \end{bmatrix} +<br /> \begin{bmatrix}<br /> 0\\<br /> \frac{K}{J}<br /> \end{bmatrix}i<br />The equations written out of matrix notation are:
<br /> \frac{d}{dt}i=-\frac{R}{L}i + \frac{1}{L}V -\frac{K}{L}\dot{\theta}\\<br /> \frac{d}{dt} \dot{\theta} = -\frac{b}{J} \dot{\theta}+\frac{K}{J}i<br />

But I need to separate i from the variables V and \theta in order to put in in the matrix equation with the state vector you wrote:
<br /> \begin{bmatrix}<br /> x\\<br /> \dot{x}\\<br /> \phi\\<br /> \dot{\phi}\\<br /> i<br /> \end{bmatrix}<br />

But I can't figure out how to do that. Where is my logic going wrong?
 
Last edited:
  • #13
You need to know the angular velocity of the motor shaft in order to calculate the back-emf, but if you assume the motor shaft to be connected to the cart through rigid interconnects, then the cart velocity, x_dot, is also a measure of the angular velocity of the motor shaft.

Edit: The motor terminal voltage, V, is still an input to the combined model.
 
  • #14
Okay, I will walk through what I have done to try to figure out i in terms of V:

<br /> \frac{d}{dt}i=-\frac{R}{L}i + \frac{1}{L}V -\frac{K}{L}\dot{\theta}\\<br /> \frac{d}{dt} \dot{\theta} = -\frac{b}{J} \dot{\theta}+\frac{K}{J}i<br />Solve the first equation for \dot{\theta}:
<br /> \dot{\theta}=-\frac{L}{K} \dot{i} - \frac{R}{K}i +\frac{1}{K}V<br />

Differentiate:
<br /> \frac{d}{dt}\dot{\theta}=-\frac{L}{K}\frac{d}{dt} \dot{i} - \frac{R}{K}\frac{d}{dt}i +\frac{1}{K}\frac{d}{dt}V<br />

Plug these two equations into the second of the first two equations:
<br /> (-\frac{L}{K}\frac{d}{dt} \dot{i} - \frac{R}{K}\frac{d}{dt}i +\frac{1}{K}\frac{d}{dt}V) = -\frac{b}{J} (-\frac{L}{K} \dot{i} - \frac{R}{K}i +\frac{1}{K}V)+\frac{K}{J}i<br />

But the terms with the derivatives of i don't fit into the equation with the state vector:
<br /> \begin{bmatrix}<br /> x\\<br /> \dot{x}\\<br /> \phi\\<br /> \dot{\phi}\\<br /> i<br /> \end{bmatrix}<br />

What am I doing wrong here?
 
Last edited:
  • #15
You need to fill this out:

<br /> \frac{\mathrm{d}}{\mathrm{dt}}<br /> \begin{bmatrix}<br /> x\\<br /> \dot{x}\\<br /> \phi\\<br /> \dot{\phi}\\<br /> i<br /> \end{bmatrix} =<br /> \begin{bmatrix}<br /> ? &amp; ? &amp; ? &amp; ? &amp; ?\\<br /> ? &amp; ? &amp; ? &amp; ? &amp; ?\\<br /> ? &amp; ? &amp; ? &amp; ? &amp; ?\\<br /> ? &amp; ? &amp; ? &amp; ? &amp; ?\\<br /> ? &amp; ? &amp; ? &amp; ? &amp; ?<br /> \end{bmatrix}<br /> \begin{bmatrix}<br /> x\\<br /> \dot{x}\\<br /> \phi\\<br /> \dot{\phi}\\<br /> i<br /> \end{bmatrix} +<br /> \begin{bmatrix}<br /> ?\\<br /> ?\\<br /> ?\\<br /> ?\\<br /> ?<br /> \end{bmatrix}V<br />

I can not do it for you because I do not know the details of what connects the motor shaft to the cart (I have assumed rigid interconnects). Here are some things you need to get straight before you proceed if you decide to use the state vector I have suggested:

- How is the force applied to the cart related to the motor armature current, i?
- How is the angular velocity of the motor shaft related to the linear velocity of the cart, x_dot?
 
  • #16
Okay, so referring to my previous post, I am getting to this point:
<br /> (-\frac{L}{K}\frac{d}{dt} \dot{i} - \frac{R}{K}\frac{d}{dt}i +\frac{1}{K}\frac{d}{dt}V) = -\frac{b}{J} (-\frac{L}{K} \dot{i} - \frac{R}{K}i +\frac{1}{K}V)+\frac{K}{J}i<br />

I can simplify this further to get the last row of the state space equation, but you can already see that the derivatives of i don't fit into the equation:
<br /> \frac{\mathrm{d}}{\mathrm{dt}}<br /> \begin{bmatrix}<br /> x\\<br /> \dot{x}\\<br /> \phi\\<br /> \dot{\phi}\\<br /> i<br /> \end{bmatrix} =<br /> \begin{bmatrix}<br /> 0 &amp; 1 &amp; 0 &amp; 0 &amp; 0 \\<br /> 0 &amp; \frac{-(I+ml^2)b}{(M+m)I+Mml^2} &amp; \frac{m^2gl^2}{(M+m)I+Mml^2} &amp; 0 &amp; 0\\<br /> 0 &amp; 0 &amp; 0 &amp; 1 &amp; 0\\<br /> 0 &amp; \frac{-mlb}{(M+m)I+Mml^2} &amp; \frac{(M+m)mgl}{(M+m)I+Mml^2} &amp; 0 &amp; 0\\<br /> ? &amp; ? &amp; ? &amp; ? &amp; ?<br /> \end{bmatrix}<br /> \begin{bmatrix}<br /> x\\<br /> \dot{x}\\<br /> \phi\\<br /> \dot{\phi}\\<br /> i<br /> \end{bmatrix} +<br /> \begin{bmatrix}<br /> 0\\<br /> 0\\<br /> 0\\<br /> 0\\<br /> ?<br /> \end{bmatrix}V<br />
 
Last edited:
  • #17
I'm not sure what it is you want from that equation.

As I see it, this:
<br /> \frac{\mathrm{d}}{\mathrm{dt}}i = -\frac{R}{L}i +<br /> \begin{bmatrix}<br /> \frac{1}{L} &amp; -\frac{K}{L}<br /> \end{bmatrix}<br /> \begin{bmatrix}<br /> V\\<br /> \dot{\theta}<br /> \end{bmatrix}<br />

fits perfectly well into the last row if you can express the angular velocity, theta_dot, as a function of the linear velocity, x_dot.

Also, shouldn't the force applied to the cart affect its acceleration?
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
2K
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K