help-gnucap
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gnucap] Time step control


From: al davis
Subject: Re: [Help-gnucap] Time step control
Date: Mon, 3 Dec 2007 02:11:54 -0500
User-agent: KMail/1.9.7

On Saturday 01 December 2007, al davis wrote:
> I will look at it in the next few days.

Try this .....

If you have the development snapshot you can do it without recompiling
the whole simulator.  Otherwise you need to recompile.

Copy the file bm_pulse.cc to a place where you can play with it.

In the file "bm_pulse.cc" ... replace this function:
/*--------------------------------------------------------------------------*/
void EVAL_BM_PULSE::tr_eval(ELEMENT* d)const
{
  double time = SIM::time0;
  if (0 < _period && _period < BIGBIG) {
    time = fmod(time,_period);
  }
  double time_offset = SIM::time0 - time;
  
  double ev = 0; // effective value
  if (time >= _delay+_rise+_width+_fall) {      /* past pulse   */
    ev = _iv;
    SIM::new_event(_period + time_offset);
  }else if (time >= _delay+_rise+_width) {      /* falling      */
    double interp = (time - (_delay+_rise+_width)) / _fall;
    ev = _pv + interp * (_iv - _pv);
    SIM::new_event(_delay + _rise + _width + _fall + time_offset);
  }else if (time >= _delay + _rise) {           /* pulse val    */
    ev = _pv;
    SIM::new_event(_delay + _rise + _width + time_offset);
  }else if (time >= _delay) {                   /* rising       */
    double interp = (time - _delay) / _rise;
    ev = _iv + interp * (_pv - _iv);
    SIM::new_event(_delay + _rise + time_offset);
  }else{                                        /* init val     */
    ev = _iv;
    SIM::new_event(_delay + time_offset);
  }

  tr_finish_tdv(d, ev);
}
/*--------------------------------------------------------------------------*/

Now, compile this file .....

g++ -fPIC --shared -I <path_to_gnucap_source> bm_pulse.cc -o bm_pulse.so

Now, bm_pulse.o is a plugin that should fix your problem.

You can manually attach it:

gnucap>  attach ./bm_pulse.so

or ..  if you are running in batch mode, you can do it on the command line:

$$ gnucap -a ./bm_pulse.so -b .......

Try it!!


This is not the "permanent" fix, but it should help for now.

You can manually force a time step any time by calling
the function SIM::new_event(time_of_event) .





reply via email to

[Prev in Thread] Current Thread [Next in Thread]