ThummeTo / FMISensitivity.jl

Unfortunately, FMUs (fmi-standard.org) are not differentiable by design. To enable their full potential inside Julia, FMISensitivity.jl makes FMUs fully differentiable, regarding to: states and derivatives | inputs, outputs and other observable variables | parameters | event indicators | explicit time | state change sensitivity by event
MIT License
6 stars 1 forks source link

Dangerous type piracy #2

Open ChrisRackauckas opened 11 months ago

ChrisRackauckas commented 11 months ago

https://github.com/ThummeTo/FMISensitivity.jl/blob/main/src/FMISensitivity.jl#L40-L42 that's not great.

ThummeTo commented 11 months ago

Yep, you got me :) Is there a reason why increment_deriv! is not defined for a ZeroTangent-increase? In my head incrementing a TrackedReal by ZeroTangent shoud be defined, but just be a no-op.

If not, I need to dig deeper and prevent this call from happening...

ChrisRackauckas commented 11 months ago

If this is needed then upstream it?

ZeroTangent though is from ChainRules.jl, which ReverseDiff doesn't integrate with. This seems like however you did some chainrules thing forgot to handle this case.

ThummeTo commented 11 months ago

you are right, I will check for that... maybe the @grad_from_chainrules macro

ThummeTo commented 11 months ago

you are right, I will check for that... maybe the @grad_from_chainrules macro