-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
No documented way to set rootfind=RightRootFind in continuous Event. #2351
Comments
Good point, we should add that. It wouldn't be hard. |
Generally the symbolic events are missing a lot of the normal event features. There is another issue about directionality for continuous events that @paulflang wanted for SBML model support, and for discrete events it would be nice to have a way to include symbolic |
Inspired of your "good first issue" tag, I have a first working example for this issue. In this I only give the to parameters I need to the continous event: continuous_events = [ (([ϕ1-ϕ2~0] => (affect!, [ϕ1,ϕ2,ϕ3,ϕ4],[Rd1,Rd2,Rd3,Rd4], 1)) =>[SciMLBase.RightRootFind,20])
(([ϕ4-ϕ2~0] => (affect!, [ϕ1,ϕ2,ϕ3,ϕ4],[Rd1,Rd2,Rd3,Rd4], 2)) =>[SciMLBase.RightRootFind,20])
(([-ϕ1~0] => (affect!, [ϕ1,ϕ2,ϕ3,ϕ4],[Rd1,Rd2,Rd3,Rd4], 3)) =>[SciMLBase.RightRootFind,20])
(([-ϕ4~0] => (affect!, [ϕ1,ϕ2,ϕ3,ϕ4],[Rd1,Rd2,Rd3,Rd4], 4)) =>[SciMLBase.RightRootFind,20])] Which is the rootfind-option and the interp_points-option. Since the options are only given once to the VectorContinuousCallback function, it makes of course no sense to give the options for every single callback. So this in mind and to have a more general solution, the question is now, what to do. Maybe something like this: continuous_events = [ ([ϕ1-ϕ2~0] => (affect!, [ϕ1,ϕ2,ϕ3,ϕ4],[Rd1,Rd2,Rd3,Rd4], 1))
([ϕ4-ϕ2~0] => (affect!, [ϕ1,ϕ2,ϕ3,ϕ4],[Rd1,Rd2,Rd3,Rd4], 2))
([-ϕ1~0] => (affect!, [ϕ1,ϕ2,ϕ3,ϕ4],[Rd1,Rd2,Rd3,Rd4], 3))
([-ϕ4~0] => (affect!, [ϕ1,ϕ2,ϕ3,ϕ4],[Rd1,Rd2,Rd3,Rd4], 4))] =>["rootfind"=>SciMLBase.RightRootFind,"interp_points"=>20] Or are there better possibilities? PS.: Another question rised on the way. I use want to use a discrete event that fires at a time which is set by the continous events resp. the affect! function. In the differentialequations.jl implementation I used a global variable to handover the time and then call the same affect! function. But since I can't define a condition function manually for the discrete event, I can't do that anymore. And I can also not mix a differentialequations.jl discrete callback with continous events since the affect! wont work anymore because of the missing symbolic definitions. PPS.: What I described last doesn't really matter because I can do want I want with another way. But maybe it is interesting despite that to have a alternative way to define the condition function manually. |
This seems like it ended up being a more difficult issue than I imagined. |
#2225 is related. |
#2911 should handle this now? |
It should, yes. |
In DifferentialEquations.jl one can specify the rootfind option:
In ModelingToolkit.jl it is not obvious how to do the same. Now I'm using the workaround, that I use the differentialequations.jl callback interface for setting rootfind=RightRootFind. But it would be nice to use the symbolic interface from ModelingToolkit.jl.
The text was updated successfully, but these errors were encountered: