Menu

Simulating impulse train using Hybrid Models

Help
2016-01-11
2016-01-14
  • Evgenij Gr.

    Evgenij Gr. - 2016-01-11

    Hello everyone!

    I was trying to simulate behaviour of system of ODEs subject to periodic delta-impulse. I've analyzed sample IF_model_test.py and came up with this solution:

    http://nbviewer.ipython.org/gist/Evgenij-Gr/e9e1bee413d186577ab1

    However, this doesn't work the way it was planned: trajectory isn't continued after the first event. In my understanding, after this event model should evaluate epmapping function, then check the state of the system an understand that the first (and the only one) submodel can continue the trajectory from this state.

    I feel that either I overlooked something obvious or I have some deep misunderstanding of how Hybrid Models work in PyDSTool. Any help or advices are appreciated and thanks beforehand!

     
  • Rob Clewley

    Rob Clewley - 2016-01-12

    Hi. You defined the end of your hybrid trajectory to be 'time' not your actual time-based event, which you called 'period'. So you're just letting it compute to the end integration time, which it was going to do anyway! Just replace 'time' with 'period' and it works for me.

     
    • Evgenij Gr.

      Evgenij Gr. - 2016-01-12

      Hello, Rob!

      Thanks for the help! I think I got it better now: I thought the reason (using terminology from makeModelInfoEntry) was a sort of comment string, not a reference to some event's name. However, what I still don't understand is why time event hadn't worked the same way as period. Is it because period event (at t=10) happens before time event (which should happen at t = 30), it is terminal event and it is not used for "routing" between submodels of hybrid model, so everything just stops? Is makeModelInfoEntry responsible for declaring what events are used for this "routing" ?

       
  • Rob Clewley

    Rob Clewley - 2016-01-12

    Yes, primarily because it's set for t=30 which is also the end of the integration time. But if you'd set 'tdomain' in the DS arguments to [0,10] and used 'time' as the switching reason, this would also work without the event. That might be a little quicker too.

     
  • Evgenij Gr.

    Evgenij Gr. - 2016-01-12

    Thanks again for your help, it works!

    Still there are few moments that I want to clarify if it's possible (and sorry if I overlooked answers for some of them in documentation):

    1. Did I get right the reason why period event 'interrupts' further trajectory calculation?
      This was because period is a termianl event that wasn't 'registered' in makeModelInfoEntry and hence it stopped calculation.
    2. In order to simulate hybrid systems correctly all terminal events should be 'registered' in makeModelInfoEntry, right?
    3. Do models generate an event when trajectory goes out of xdomain ? I tried to change xdomain such that trajectory leaves it somewhere before the stopping time, but no event occurred. I guess that for such situations there's no default event like time (and it would duplicate ZeroCrossingEvent functionality if it had existed), right?
    4. What is the meaning of tdata in embed(Generator.Vode_ODEsystem(base_args), icdict=ics, tdata=[0, 1.0]) ? As far as I've understood, it defines the start and the end time of integration for trajectories, but it had no effect on calculations in my example.
     

    Last edit: Evgenij Gr. 2016-01-12
    • Rob Clewley

      Rob Clewley - 2016-01-13

      1) & 2) Yes, makeModelInfoEntry is where that declaration happens, which is necessary for its use in a hybrid sim.

      3) There are no built-in events just because of xdomain being defined. If checklevel is high enough then out-of-bounds variables will cause an error, not an event. The ModelConstructor class helps you auto-build domain events, using its withStdEvts option. See examples\CIN.py, but basically every variable will get a domain endpoint event and a zero derivative event. You have to activate them (they are not active by default). But see the integrate-and-fire example in the same directory to see how domain end time can trigger the hybrid model shift (for the sub-model 'spike').

      4) tdata is optional there, and just gives a default integration time duration. It's overidden when you apply it again at the time you call compute.

       

      Last edit: Rob Clewley 2016-01-13
      • Evgenij Gr.

        Evgenij Gr. - 2016-01-13

        Thank you very much, this helped a lot :) I think I there's only one important question left: is it possible to perform bifurcation analysis of stroboscopic mapping for this system (fixed/periodic points, their stability, invariant curves bifurcations) or I should take completely differend approach? I had taken a look at PyCont_Logistic.py, but mapping in this sample is defined via explicit formula whilst mine requires some numeric computation beforehand.

         
  • Rob Clewley

    Rob Clewley - 2016-01-14

    You can perform fixed point analysis and related continuation with PyCont for a discrete map if you set it up as such. See the SLIP examples and the embedding example to see how to transform the continuous system into a discrete PyDSTool Generator object. Depending on how complex the mapping is, and how accurate you need the results, you could maybe fit a nonlinear function to the numerically determined data or have the numerics determine parameters in an equation that you may be able to analyze explicitly. I'm really not certain that makes sense here but I'm not very familiar with your problem.

     

Log in to post a comment.