bugGNU Octave - Bugs: bug #59063, Event Handling different between...


bug #59063: Event Handling different between Ode-Solvers (especially ode15s)

Submitted by:  None
Submitted on:  Fri 04 Sep 2020 11:13:21 AM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Need Info Assigned to:  None
Originator Name:  Michael Erhard Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  dev
Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Tue 08 Sep 2020 08:17:08 AM UTC, comment #5: 

Thank you for the information and the submitted patch,
but I'm sorry, I would call me an "end user" only using the windows installer, infrequently looking in the maintainers/news blog, hopefully waiting for new releases with new features. Using Octave in a Matlab Simscape like manner is greatful (the stiff solvers ode12s/ode15i with event handling introduced in v4.4.1 brought the functionality to a new level), although there are some issues related to solver setup between stiff and nonstiff problems.

With the knowledge of these issues, making a probable working code is feasible for me. I'll waiting for a new release.

Tue 08 Sep 2020 03:09:13 AM UTC, comment #4: 

I won't be able to make much progress as I don't have access to a new enough version of SUNDIALS to work with Octave.  I took a stab at a patch for the zero-based indexing of the "ie" variable which is attached.  Perhaps you can apply it, compile, and see if it fixes the issue for you.

(file #49763)

Rik <rik5>
Project Administrator
Tue 08 Sep 2020 01:17:11 AM UTC, comment #3: 

A quick answer to your last question, ode23s will be a part of version 6.1 and it uses the same event handler function as ode23/ode45 so it should work properly.

Rik <rik5>
Project Administrator
Mon 07 Sep 2020 08:59:04 AM UTC, comment #2: 

Thanks for your quick response,
please find below a short (maybe physical meaningless) example of an oscillator with 2 events.
The first event is a state event (oscillator hits the ground-rebounding) and the second event is a time event (every second change in velocity).

The state event is no problem for all solvers, the only "bad" thing  is the change of index count (which is not documentated).
The time event isn't captured by ode15s, if the output step size is exactly an integer of the event time (here 1 s and 1.0e-2 s), here only ode23/ode45 works. Only if I change from 1.0e-2 s to 1.0001e-2 s ode15s gets the time events).

I think, that I read something about availability of ode23s in version 6.1. Is there an equal behaviour present?

Please find below a file with the requested example.

(file #49752)

Fri 04 Sep 2020 05:17:32 PM UTC, comment #1: 

Very likely true.  I worked on ode23/45 to have EventFcn work similarly to Matlab, but ode15i/15s have a different architecture and were written by a different author.

Do you have a simple test case for items #1 and #2?  That makes debugging easier and also allows verification once a fix is proposed.

Rik <rik5>
Project Administrator
Fri 04 Sep 2020 11:13:21 AM UTC, original submission:  

In cases using an event function, ode23/ode45 gives identical behaviour, whereas ode15s (ode15i not yet tested) behaves different.

Indices of triggered events in EventFcn are counted from 1,2,3... in ode23/ode45, whereas ode15s count from 0,1,..., if multiple constraints are used.

ode15s is not capable of detecting discrete time events, when the constraint time is a multiple of the output step size. ode23/ode45 doesn't have any problems with this

An example can be the bouncing ball problem by changing the event constraint from state to a discrete time before ball hits the ground or by adding an additional constraint for time.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #49763:  59063.ie_fix.cset added by rik5 (804B - application/octet-stream)
file #49752:  ODEwithEvents.m added by None (3KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-09-08 rik5 Attached File- => Added 59063.ie_fix.cset, #49763
    2020-09-07 None Attached File- => Added ODEwithEvents.m, #49752
    2020-09-04 rik5 Item GroupIncorrect Result => Matlab Compatibility
        StatusNone => Need Info
        Release5.2.0 => dev
        Operating SystemMicrosoft Windows => Any

    Back to the top

    Powered by Savane 3.5