-
Notifications
You must be signed in to change notification settings - Fork 85
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
More LQG updates #467
base: master
Are you sure you want to change the base?
More LQG updates #467
Conversation
Codecov Report
@@ Coverage Diff @@
## master #467 +/- ##
==========================================
- Coverage 85.28% 85.25% -0.04%
==========================================
Files 31 32 +1
Lines 3092 3180 +88
==========================================
+ Hits 2637 2711 +74
- Misses 455 469 +14
Continue to review full report at Codecov.
|
""" | ||
add_disturbance(sys::AbstractStateSpace{Continuous}, Ad::AbstractMatrix, Cd::AbstractMatrix) | ||
|
||
See CCS pp. 144 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the description should be a bit better here, I could not figure out what the function was doing without reading the code. Maybe the expression for the new system matrix is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that you probably use this to introduce disturbances, but it seems that it could be called something more general, like 'augment_system'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, all augmentation functions require better docstrings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, your first comment probably got eaten up by autocorrect ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that was tough to read, fixed now.
ss(Ae,Be,Ce,De) | ||
end | ||
|
||
function add_measurement_disturbance(sys::AbstractStateSpace{Continuous}, Ad::AbstractMatrix, Cd::AbstractMatrix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a docstring if we export. Same for the rest
|
||
# Extract interesting values | ||
if G.integrator # Augment with disturbance model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer stored in the struct, instead the extended statespace object syse
is stored. adding an integrator is just a special case of adding disturbance models, corresponding to a low-frequency input disturbance
# Arguments: | ||
- `sys`: System to augment | ||
- `Ad`: The dynamics of the disturbance | ||
- `Cd`: How the disturbance states affect the states of `sys`. This matrix as the shape (sys.nx, size(Ad, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matrix has the shape...
We have been lacking a simple way of augmenting systems with disturbance/noise models, so it is good that something is finally happening!
Perhaps you have some examples/use cases? Would be easier to discuss around something a bit more concrete. If I have the time, I will try to put something together as well. And I guess there should be plenty of examples in the literature, any suggestions? |
It's not handled yet, maybe allowing the user to pass another parameter that is taking the place of the
Yes, if it's a known disturbance. The augmentation so far only handles unknown disturbances for which the B-matrix is only extended with zeros.
The
I've been thinking a bit about this and I don't think we need to implement a new system type. It could probably be solved by making the matrices have named components, e.g., through ComponentArrays.jl. I've used this strategy elsewhere and it works quite nicely. The
I agree, I don't like the design all that much. Maybe it would be better to just break it completely and redesign it so that the structure only contains computed results that are generally useful, and all other results (that are now properties) are just implemented as regular functions instead. The purpose of defining functions is that it might be hard to remember the exact formulations for input/output sensitivity for MIMO systems if you don't have a reference book or pen and paper nearby. Having them as functions prevent you from making simple errors. Getting exactly the same realisation out as matlab also required some gymnastics, at least for
Double-mass model (4 states) augmented with constant input disturbance (1 state) and resonant measurement disturbance (2 states) to reduce sensitivity at select frequencies. Motor-side states are measured, while references are provided for load-side states (C and M matrices are different) while noise acts on the two velocity states as well as the input-disturbance state. I'll put together some code soon. |
This PR adds tests for LQG and makes sure it conforms to Glad Ljung