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

add docs for input-output handling #2918

Merged
merged 15 commits into from
Aug 2, 2024
Merged

add docs for input-output handling #2918

merged 15 commits into from
Aug 2, 2024

Conversation

baggepinnen
Copy link
Contributor

addresses #2852

ChrisRackauckas and others added 7 commits August 2, 2024 08:31
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
docs/src/basics/InputOutput.md Outdated Show resolved Hide resolved
docs/src/basics/InputOutput.md Outdated Show resolved Hide resolved
docs/src/basics/InputOutput.md Outdated Show resolved Hide resolved
docs/src/basics/Linearization.md Outdated Show resolved Hide resolved
docs/src/basics/Linearization.md Outdated Show resolved Hide resolved
ChrisRackauckas and others added 5 commits August 2, 2024 08:34
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@ChrisRackauckas ChrisRackauckas merged commit 84643a2 into master Aug 2, 2024
3 checks passed
@ChrisRackauckas ChrisRackauckas deleted the io_docs branch August 2, 2024 12:35
@cstjean
Copy link

cstjean commented Aug 5, 2024

image

The generate_control_function links are also broken


ModelingToolkit can generate the dynamics of a system, the function ``M\dot X = f(x, u, p, t)`` above, such that the user can pass not only the state ``x`` and parameters ``p`` but also an external input ``u``. To this end, the function [`generate_control_function`](@ref) exists.

This function takes a vector of variables that are to be considered inputs, i.e., part of the vector ``u``. Alongside returning the function ``f``, [`generate_control_function`](@ref) also returns the chosen state realization of the system after simplification. This vector specifies the order of the state variables ``x``, while the user-specified vector `u` specifies the order of the input variables ``u``.
Copy link

Choose a reason for hiding this comment

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

returns the chosen state realization of the system after simplification. This vector specifies the order of the state variables x, while the user-specified vector u specifies the order of the input variables u.

Maybe I'm not the intended audience for this, but I've been reading and studying and rereading and I'm still completely lost on this bit. What does "chosen state realization" mean? What is the order of a state variable, why does it matter?

A simple example of generate_control_function usage would help tremendously.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What does "chosen state realization" mean?

In a simple scenario, an MTK model may contain 100's of variables, but MTK chooses only position, velocity to be part of the state $x$ for simulation. You need to know that MTK chose position, velocity as the state, and that they appear in that order, so that you can pass numerical values

x = [
    0.4 # Position of car
    0.7 # Velocity of car
]
f(x, u, p, t)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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