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

Handle dummy derivatives in linearization_function #2361

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

baggepinnen
Copy link
Contributor

@baggepinnen baggepinnen commented Nov 23, 2023

The issue here is that the homogenous parameter PR that was merged broke linearization_function, which led to a further PR that broke the user interface to linearization_function such that the user now needs to provide an "example input" that encodes the types that the generated function would eventually be called with.

I find this a very bad design and a quite unfortunate breaking change. The fundamental problem is that state and parameter types are important, but the modeling language does not allow the user to encode this information in the model, instead we now ask the users to provide the type information in the form of an example input.

This PR mitigates the effect of the breakage slightly be setting missing variables to 0.0, a floating point type. This should be okay since dummy derivatives are always floats. The value is not important here, only the type.

Several tests are added that tests a common workflow in control engineering, the use of an inverse-based
feedforward model. Such a model differentiates "inputs", exercising the dummy-derivative functionality of ModelingToolkit. I also test linearization and computation of sensitivity functions for such models (the thing this PR fixes)

The issue here is that the homogenous parameter PR that was merged broke `linearization_function`, which led to a further PR that broke the user interface to `linearization_function` such that the user now needs to provide an "example input" that encodes the types that the generated function would eventually be called with.

I find this a very bad design and a quite unfortunate breaking change. The fundamental problem is that state and parameter types are important, but the modeling language does not allow the user to encode this information in the model, instead we now ask the users to provide the type information in the form of an example input.
@baggepinnen baggepinnen marked this pull request as ready for review November 23, 2023 09:25
@baggepinnen baggepinnen merged commit 32654d6 into master Nov 27, 2023
18 of 20 checks passed
@baggepinnen baggepinnen deleted the baggepinnen-patch-4 branch November 27, 2023 06:07
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.

1 participant