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) .



_______________________________________________
Help-gnucap mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnucap

Reply via email to