Remove the XSPICE dependency of the phase parameter for the
independent current source.
This commit is contained in:
parent
fc6f41ae9b
commit
52f3bd7900
|
|
@ -53,13 +53,10 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel)
|
||||||
double tshift;
|
double tshift;
|
||||||
double time = 0.;
|
double time = 0.;
|
||||||
double basetime = 0;
|
double basetime = 0;
|
||||||
|
|
||||||
/* gtri - begin - wbk - add PHASE parameter */
|
|
||||||
#ifdef XSPICE
|
|
||||||
double PHASE;
|
double PHASE;
|
||||||
double phase;
|
double phase;
|
||||||
double deltat;
|
double deltat;
|
||||||
#endif
|
|
||||||
TD = here->ISRCfunctionOrder > 2
|
TD = here->ISRCfunctionOrder > 2
|
||||||
? here->ISRCcoeffs[2] : 0.0;
|
? here->ISRCcoeffs[2] : 0.0;
|
||||||
TR = here->ISRCfunctionOrder > 3
|
TR = here->ISRCfunctionOrder > 3
|
||||||
|
|
@ -74,15 +71,13 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel)
|
||||||
PER = here->ISRCfunctionOrder > 6
|
PER = here->ISRCfunctionOrder > 6
|
||||||
&& here->ISRCcoeffs[6] != 0.0
|
&& here->ISRCcoeffs[6] != 0.0
|
||||||
? here->ISRCcoeffs[6] : ckt->CKTfinalTime;
|
? here->ISRCcoeffs[6] : ckt->CKTfinalTime;
|
||||||
#ifdef XSPICE
|
|
||||||
PHASE = here->ISRCfunctionOrder > 7
|
PHASE = here->ISRCfunctionOrder > 7
|
||||||
? here->ISRCcoeffs[7] : 0.0;
|
? here->ISRCcoeffs[7] : 0.0;
|
||||||
#endif
|
|
||||||
/* offset time by delay */
|
/* offset time by delay */
|
||||||
time = ckt->CKTtime - TD;
|
time = ckt->CKTtime - TD;
|
||||||
tshift = TD;
|
tshift = TD;
|
||||||
|
|
||||||
#ifdef XSPICE
|
|
||||||
/* normalize phase to 0 - 360° */
|
/* normalize phase to 0 - 360° */
|
||||||
/* normalize phase to cycles */
|
/* normalize phase to cycles */
|
||||||
phase = PHASE / 360.0;
|
phase = PHASE / 360.0;
|
||||||
|
|
@ -92,8 +87,6 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel)
|
||||||
deltat -= PER;
|
deltat -= PER;
|
||||||
time += deltat;
|
time += deltat;
|
||||||
tshift = TD - deltat;
|
tshift = TD - deltat;
|
||||||
#endif
|
|
||||||
/* gtri - end - wbk - add PHASE parameter */
|
|
||||||
|
|
||||||
if(time >= PER) {
|
if(time >= PER) {
|
||||||
/* repeating signal - figure out where we are */
|
/* repeating signal - figure out where we are */
|
||||||
|
|
|
||||||
|
|
@ -72,11 +72,10 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
case PULSE: {
|
case PULSE: {
|
||||||
double V1, V2, TD, TR, TF, PW, PER;
|
double V1, V2, TD, TR, TF, PW, PER;
|
||||||
double basetime = 0;
|
double basetime = 0;
|
||||||
#ifdef XSPICE
|
|
||||||
double PHASE;
|
double PHASE;
|
||||||
double phase;
|
double phase;
|
||||||
double deltat;
|
double deltat;
|
||||||
#endif
|
|
||||||
V1 = here->ISRCcoeffs[0];
|
V1 = here->ISRCcoeffs[0];
|
||||||
V2 = here->ISRCcoeffs[1];
|
V2 = here->ISRCcoeffs[1];
|
||||||
TD = here->ISRCfunctionOrder > 2
|
TD = here->ISRCfunctionOrder > 2
|
||||||
|
|
@ -97,8 +96,6 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
/* shift time by delay time TD */
|
/* shift time by delay time TD */
|
||||||
time -= TD;
|
time -= TD;
|
||||||
|
|
||||||
#ifdef XSPICE
|
|
||||||
/* gtri - begin - wbk - add PHASE parameter */
|
|
||||||
PHASE = here->ISRCfunctionOrder > 7
|
PHASE = here->ISRCfunctionOrder > 7
|
||||||
? here->ISRCcoeffs[7] : 0.0;
|
? here->ISRCcoeffs[7] : 0.0;
|
||||||
|
|
||||||
|
|
@ -110,8 +107,7 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
deltat -= PER;
|
deltat -= PER;
|
||||||
/* shift time by pase (neg. for pos. phase value) */
|
/* shift time by pase (neg. for pos. phase value) */
|
||||||
time += deltat;
|
time += deltat;
|
||||||
/* gtri - end - wbk - add PHASE parameter */
|
|
||||||
#endif
|
|
||||||
if(time > PER) {
|
if(time > PER) {
|
||||||
/* repeating signal - figure out where we are */
|
/* repeating signal - figure out where we are */
|
||||||
/* in period */
|
/* in period */
|
||||||
|
|
@ -133,8 +129,6 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
case SINE: {
|
case SINE: {
|
||||||
|
|
||||||
double VO, VA, FREQ, TD, THETA;
|
double VO, VA, FREQ, TD, THETA;
|
||||||
/* gtri - begin - wbk - add PHASE parameter */
|
|
||||||
#ifdef XSPICE
|
|
||||||
double PHASE;
|
double PHASE;
|
||||||
double phase;
|
double phase;
|
||||||
|
|
||||||
|
|
@ -143,7 +137,7 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
|
|
||||||
/* compute phase in radians */
|
/* compute phase in radians */
|
||||||
phase = PHASE * M_PI / 180.0;
|
phase = PHASE * M_PI / 180.0;
|
||||||
#endif
|
|
||||||
VO = here->ISRCcoeffs[0];
|
VO = here->ISRCcoeffs[0];
|
||||||
VA = here->ISRCcoeffs[1];
|
VA = here->ISRCcoeffs[1];
|
||||||
FREQ = here->ISRCfunctionOrder > 2
|
FREQ = here->ISRCfunctionOrder > 2
|
||||||
|
|
@ -156,18 +150,11 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
|
|
||||||
time -= TD;
|
time -= TD;
|
||||||
if (time <= 0) {
|
if (time <= 0) {
|
||||||
#ifdef XSPICE
|
|
||||||
value = VO + VA * sin(phase);
|
value = VO + VA * sin(phase);
|
||||||
} else {
|
} else {
|
||||||
value = VO + VA * sin(FREQ*time * 2.0 * M_PI + phase) *
|
value = VO + VA * sin(FREQ*time * 2.0 * M_PI + phase) *
|
||||||
exp(-time*THETA);
|
exp(-time*THETA);
|
||||||
#else
|
|
||||||
value = VO;
|
|
||||||
} else {
|
|
||||||
value = VO + VA * sin(FREQ * time * 2.0 * M_PI) *
|
|
||||||
exp(-time*THETA);
|
|
||||||
#endif
|
|
||||||
/* gtri - end - wbk - add PHASE parameter */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -204,8 +191,6 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
case SFFM: {
|
case SFFM: {
|
||||||
|
|
||||||
double VO, VA, FC, MDI, FS;
|
double VO, VA, FC, MDI, FS;
|
||||||
/* gtri - begin - wbk - add PHASE parameters */
|
|
||||||
#ifdef XSPICE
|
|
||||||
double PHASEC, PHASES;
|
double PHASEC, PHASES;
|
||||||
double phasec;
|
double phasec;
|
||||||
double phases;
|
double phases;
|
||||||
|
|
@ -218,7 +203,6 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
/* compute phases in radians */
|
/* compute phases in radians */
|
||||||
phasec = PHASEC * M_PI / 180.0;
|
phasec = PHASEC * M_PI / 180.0;
|
||||||
phases = PHASES * M_PI / 180.0;
|
phases = PHASES * M_PI / 180.0;
|
||||||
#endif
|
|
||||||
|
|
||||||
VO = here->ISRCcoeffs[0];
|
VO = here->ISRCcoeffs[0];
|
||||||
VA = here->ISRCcoeffs[1];
|
VA = here->ISRCcoeffs[1];
|
||||||
|
|
@ -231,26 +215,16 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
&& here->ISRCcoeffs[4]
|
&& here->ISRCcoeffs[4]
|
||||||
? here->ISRCcoeffs[4] : (1/ckt->CKTfinalTime);
|
? here->ISRCcoeffs[4] : (1/ckt->CKTfinalTime);
|
||||||
|
|
||||||
#ifdef XSPICE
|
|
||||||
/* compute waveform value */
|
/* compute waveform value */
|
||||||
value = VO + VA *
|
value = VO + VA *
|
||||||
sin((2.0 * M_PI * FC * time + phasec) +
|
sin((2.0 * M_PI * FC * time + phasec) +
|
||||||
MDI * sin(2.0 * M_PI * FS * time + phases));
|
MDI * sin(2.0 * M_PI * FS * time + phases));
|
||||||
#else
|
|
||||||
value = VO + VA *
|
|
||||||
sin((2.0 * M_PI * FC * time) +
|
|
||||||
MDI * sin(2.0 * M_PI * FS * time));
|
|
||||||
#endif
|
|
||||||
/* gtri - end - wbk - add PHASE parameters */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AM: {
|
case AM: {
|
||||||
|
|
||||||
double VA, FC, MF, VO, TD;
|
double VA, FC, MF, VO, TD;
|
||||||
/* gtri - begin - wbk - add PHASE parameters */
|
|
||||||
#ifdef XSPICE
|
|
||||||
double PHASEC, PHASES;
|
double PHASEC, PHASES;
|
||||||
double phasec;
|
double phasec;
|
||||||
double phases;
|
double phases;
|
||||||
|
|
@ -263,7 +237,6 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
/* compute phases in radians */
|
/* compute phases in radians */
|
||||||
phasec = PHASEC * M_PI / 180.0;
|
phasec = PHASEC * M_PI / 180.0;
|
||||||
phases = PHASES * M_PI / 180.0;
|
phases = PHASES * M_PI / 180.0;
|
||||||
#endif
|
|
||||||
|
|
||||||
VA = here->ISRCcoeffs[0];
|
VA = here->ISRCcoeffs[0];
|
||||||
VO = here->ISRCcoeffs[1];
|
VO = here->ISRCcoeffs[1];
|
||||||
|
|
@ -280,18 +253,10 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
if (time <= 0) {
|
if (time <= 0) {
|
||||||
value = 0;
|
value = 0;
|
||||||
} else {
|
} else {
|
||||||
#ifdef XSPICE
|
|
||||||
/* compute waveform value */
|
/* compute waveform value */
|
||||||
value = VA * (VO + sin(2.0 * M_PI * MF * time + phases )) *
|
value = VA * (VO + sin(2.0 * M_PI * MF * time + phases )) *
|
||||||
sin(2.0 * M_PI * FC * time + phases);
|
sin(2.0 * M_PI * FC * time + phases);
|
||||||
|
|
||||||
#else
|
|
||||||
value = VA * (VO + sin(2.0 * M_PI * MF * time)) *
|
|
||||||
sin(2.0 * M_PI * FC * time);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gtri - end - wbk - add PHASE parameters */
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue