Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement stability constraints #251

Open
moorepants opened this issue Sep 24, 2024 · 9 comments
Open

Implement stability constraints #251

moorepants opened this issue Sep 24, 2024 · 9 comments

Comments

@moorepants
Copy link
Member

It is common in parameter identification problem (or even dual parameter id + trajectories) to find solutions that give unstable systems, even when the measurement data comes from a stable system. If the system can be represented as a linear system about an equilibrium point, you could make constraints that enforce the real parts of the eigenvalues < 0. This would add new constraints and we'd need to find their Jacobian, which isn't so suitable for a symbolic method when the system order is high. Another option is to calculate the Routh table for the linear system, which effectively gives a set of inequality constraints that would guarantee stability. That may work for high order systems, even if the symbolic expressions get large. These are a couple of ideas for a subclass of parameter id problems for systems that are linearly stable. More ideas would be needed for nonlinear systems.

@Peter230655
Copy link
Contributor

It is common in parameter identification problem (or even dual parameter id + trajectories) to find solutions that give unstable systems, even when the measurement data comes from a stable system. If the system can be represented as a linear system about an equilibrium point, you could make constraints that enforce the real parts of the eigenvalues < 0. This would add new constraints and we'd need to find their Jacobian, which isn't so suitable for a symbolic method when the system order is high. Another option is to calculate the Routh table for the linear system, which effectively gives a set of inequality constraints that would guarantee stability. That may work for high order systems, even if the symbolic expressions get large. These are a couple of ideas for a subclass of parameter id problems for systems that are linearly stable. More ideas would be needed for nonlinear systems.

for my understanding: if solutions are found which give unstable solutions even though the system is stable, this means the solutions are wrong (e.g. wrong spring constant, wrong dampening...)?
To my knowledge, opty cannot handle inequalities, yet?

@tvdbogert
Copy link
Member

Preventing unstable systems was one motivation for adding the noise to the plant model. If one feedback controller can produce good tracking for all episodes, which all have different noise signals, you have a better chance of finding a stable solution. But it's no guarantee. The intuition is that the number of episodes must be large compared to the number of parameters identified. Otherwise, you may end up with a controller that is too "specialized" and only works when the noise is exactly the pattern that was simulated. We learned this by trying.

During one of Huawei's committee meetings, my colleague Hanz Richter mentioned that there are ways to constrain the solution to be stable, by eigenvalues, as Jason already alluded to. You would need the derivatives of the eigenvalues with respect to the unknown parameters and he said that could be done. For a 2-link inverted pendulum, it may be possible symbolically.

@tvdbogert
Copy link
Member

This may or may not be helpful, but just in case... I have been dabbling in solid mechanics recently. When strain energy density is specified in terms of the principal stretches (eigenvalues of the deformation gradient matrix), first and second derivatives of the eigenvalues are needed for the stress and stiffness calculation. I tried and failed to do it symbolically, even for a 2D triangle element, but spectral decomposition apparently makes it simple. The math is a bit much for me, but I copied the equations from Bonet's book and they worked correctly as verified by numerical differentiation.

@Peter230655
Copy link
Contributor

Peter230655 commented Sep 25, 2024

Preventing unstable systems was one motivation for adding the noise to the plant model. If one feedback controller can produce good tracking for all episodes, which all have different noise signals, you have a better chance of finding a stable solution. But it's no guarantee. The intuition is that the number of episodes must be large compared to the number of parameters identified. Otherwise, you may end up with a controller that is too "specialized" and only works when the noise is exactly the pattern that was simulated. We learned this by trying.

The way I visualized it yesterday was this: You want to get the $K_{i, j}$ of eq(1) or eq(2) in the paper to optimally react to the given disturbance. By adding the $n_s(0, \sigma)$ you let random forces act on the body. A good controller should handle these random forces, too. Is this 'picture' about right?

During one of Huawei's committee meetings, my colleague Hanz Richter mentioned that there are ways to constrain the solution to be stable, by eigenvalues, as Jason already alluded to. You would need the derivatives of the eigenvalues with respect to the unknown parameters and he said that could be done. For a 2-link inverted pendulum, it may be possible symbolically.

I studied control theory in Stuttgart some 45 years ago, so this is no longer fresh in my mind. :-(

@Peter230655
Copy link
Contributor

This may or may not be helpful, but just in case... I have been dabbling in solid mechanics recently. When strain energy density is specified in terms of the principal stretches (eigenvalues of the deformation gradient matrix), first and second derivatives of the eigenvalues are needed for the stress and stiffness calculation. I tried and failed to do it symbolically, even for a 2D triangle element, but spectral decomposition apparently makes it simple. The math is a bit much for me, but I copied the equations from Bonet's book and they worked correctly as verified by numerical differentiation.

When I studied in the USA, in California, I had one course of solid mechanic - but again too long ago. :-(
(since I did a lot of multi body systems in Stuttgart, this came relatively easy for me when I discovered sympy mechanics.)

@tvdbogert
Copy link
Member

I never had a course in solid mechanics. We had 3 weeks of multibody dynamics in my physics program, which I mostly missed due to sickness and could never catch up. As I get older, I seem to get better at learning new things. And now I am retired and have time!

@moorepants
Copy link
Member Author

moorepants commented Sep 25, 2024

There are two ways I can think of to get derivatives of the eigenvalues:

  1. Calculate Routh's stability criteria and get a set of symbolic constraints, the derivatives can be calculated symbolically.
  2. Use automatic differentiation. For example, Jax has the eig() function and it is thus differentiable.

@tvdbogert
Copy link
Member

Those are probably the first directions to go in (in that order). I had never heard of Routh stability criteria (another gap in my education), so I read the Wikipedia article. This is probably what Hanz was talking about and it seems doable.

@Peter230655
Copy link
Contributor

Peter230655 commented Sep 25, 2024

I never had a course in solid mechanics. We had 3 weeks of multibody dynamics in my physics program, which I mostly missed due to sickness and could never catch up. As I get older, I seem to get better at learning new things. And now I am retired and have time!

Lucky you!! I am also retired and have time - but learning new things comes hard to me! :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants