Browse Source

Fixed bug in time computation for vsrc and isrc with xspice extensions.

pre-master-46
pnenzi 17 years ago
parent
commit
aa93968573
  1. 5
      ChangeLog
  2. 16
      src/spicelib/devices/isrc/isrcacct.c
  3. 12
      src/spicelib/devices/vsrc/vsrcacct.c

5
ChangeLog

@ -1,3 +1,8 @@
2009-12-19 Paolo Nenzi
* src/spicelib/devices/isrc/isrcacct.c, src/spicelib/devices/vsrc/vsrcacct.c:
fixed bug reported by Holger. "time" value in accept routine was incorrectly
computed when xspice extensions were compiled in.
2009-12-19 Holger Vogt
* main.c, inpcom.c: source file path added as additional search path for
opening .include files (MS Windows only).

16
src/spicelib/devices/isrc/isrcacct.c

@ -44,7 +44,7 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel)
/* gtri - begin - wbk - add PHASE parameter */
#ifdef XSPICE
double PHASE;
double PHASE;
double phase;
double deltat;
double basephase;
@ -69,7 +69,16 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel)
#ifdef XSPICE
PHASE = here->ISRCfunctionOrder > 8
? here->ISRCcoeffs[7] : 0.0;
#endif
/* offset time by delay and limit to zero */
time = ckt->CKTtime - TD;
#ifdef XSPICE
if(time < 0.0)
time = 0.0;
#endif
#ifdef XSPICE
/* normalize phase to 0 - 2PI */
phase = PHASE * M_PI / 180.0;
basephase = 2 * M_PI * floor(phase / (2 * M_PI));
@ -81,8 +90,7 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel)
#endif
/* gtri - end - wbk - add PHASE parameter */
/* offset time by delay */
time = ckt->CKTtime - TD;

12
src/spicelib/devices/vsrc/vsrcacct.c

@ -70,7 +70,15 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel)
#ifdef XSPICE
PHASE = here->VSRCfunctionOrder > 8
? here->VSRCcoeffs[7] : 0.0;
#endif
/* offset time by delay and limit to zero */
time = ckt->CKTtime - TD;
#ifdef XSPICE
if(time < 0.0)
time = 0.0;
#endif
#ifdef XSPICE
/* normalize phase to 0 - 2PI */
phase = PHASE * M_PI / 180.0;
basephase = 2 * M_PI * floor(phase / (2 * M_PI));
@ -82,7 +90,7 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel)
#endif
/* gtri - end - wbk - add PHASE parameter */
time = ckt->CKTtime - TD;
if(time >= PER) {
/* repeating signal - figure out where we are */

Loading…
Cancel
Save