Skip to content

fix: handle derivatives of time-dependent parameters #3493

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AayushSabharwal
Copy link
Member

Close #3480

@ChrisRackauckas
Copy link
Member

But also test that the derivative of say a datainterpolation is non-zero still.

@ChrisRackauckas
Copy link
Member

Was this found to be okay / safe?

@AayushSabharwal
Copy link
Member Author

Not completely. We don't always want the derivative of a discrete parameter to be zero. One such example is CoSimulation FMUs. The spec enables getting derivatives of outputs, and sometimes MTK needs this information (e.g. if the output of an FMU is in an equation that pantelides differentiates). I think the solution is to allow D(p(t)) ~ ... equations where p is a time-dependent parameter and use that in the mapping added to this PR.

@@ -2,7 +2,7 @@ using ModelingToolkit, OrdinaryDiffEq, Test
using ModelingToolkit: t_nounits as t, D_nounits as D

sts = @variables x1(t) x2(t) x3(t) x4(t)
params = @parameters u1(t) u2(t) u3(t) u4(t)
Copy link
Member

Choose a reason for hiding this comment

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

hehe

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.

Code generation contains Differential when equations contain variable time parameter
3 participants