Skip to content

add docs for sampled-data systems #2410

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

Merged
merged 7 commits into from
Mar 18, 2024
Merged

add docs for sampled-data systems #2410

merged 7 commits into from
Mar 18, 2024

Conversation

baggepinnen
Copy link
Contributor

Work in progress

Comment on lines 38 to 42
function discrete_step(x, u)
y = x # y is assigned the old value of x
x = 0.5x + u # x is updated to a new value
return x, y # The state x now refers to x at the next time step, while y refers to x at the current time step
end
Copy link
Member

@AayushSabharwal AayushSabharwal Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this make y lag x by one timestep? This would then imply that y(k+1) ~ x(k) which is not what the equation above says.

Basically, if x, y, u = [1.0, 1.0, 2.0] would the timeseries be[[1.0, 1.0, 2.0], [2.5, 1.0, 2.0], [3.75, 2.5, 2.0]] or [[1.0, 1.0, 2.0], [2.5, 2.5, 2.0], [3.75, 3.75, 2.0]]

I'm not very familiar with discrete-time modeling, so this may be some common misunderstanding I'm unaware of 😅

EDIT: If there's some tutorial/book for these kind of models I can go through that would be helpful, since the below examples also don't quite make sense to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this make y lag x by one timestep?

Yes, the output x of this function is one step ahead of the output y, but y(k) does not lag x(k). Note how the comment mentions

The state x now refers to x at the next time step, while y refers to x at the current time step

Where next in x at the next time step is key. The returned value of the manually implemented function discrete_step is thus to be interpreted as the tuple

(state in next time step, current time output)

I'll commit a change to the comment to hopefully make this more clear

My goto book is usually "Computer-controlled systems" by KJ Åström, but I'm not sure if it would be particularly useful as a reference here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this commit clarifies further? cbd9f59

@ChrisRackauckas
Copy link
Member

@baggepinnen can something of this form be merged by the end of the day? It can continue to improve but we need something to go with the v9.

@baggepinnen
Copy link
Contributor Author

baggepinnen commented Feb 14, 2024

This documents functionality that is not yet existing, in particular, the user interface for simulation is almost 100% missing and the MTK compiler is broken, JuliaSimCompiler is required, so I'd rather not merge any of it yet.

@ChrisRackauckas
Copy link
Member

Okay then we'll v9 without this.

@ChrisRackauckas
Copy link
Member

Build failed.

@baggepinnen baggepinnen marked this pull request as ready for review March 17, 2024 14:20
@baggepinnen baggepinnen reopened this Mar 17, 2024
@ChrisRackauckas ChrisRackauckas merged commit a29b41e into master Mar 18, 2024
@ChrisRackauckas ChrisRackauckas deleted the discretedocs branch March 18, 2024 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants