Remove the XSPICE dependency of the phase parameter for the
independent voltage source.
This commit is contained in:
parent
52f3bd7900
commit
cbf4305ff8
|
|
@ -54,12 +54,10 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel)
|
||||||
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->VSRCfunctionOrder > 2
|
TD = here->VSRCfunctionOrder > 2
|
||||||
? here->VSRCcoeffs[2] : 0.0;
|
? here->VSRCcoeffs[2] : 0.0;
|
||||||
TR = here->VSRCfunctionOrder > 3
|
TR = here->VSRCfunctionOrder > 3
|
||||||
|
|
@ -74,15 +72,13 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel)
|
||||||
PER = here->VSRCfunctionOrder > 6
|
PER = here->VSRCfunctionOrder > 6
|
||||||
&& here->VSRCcoeffs[6] != 0.0
|
&& here->VSRCcoeffs[6] != 0.0
|
||||||
? here->VSRCcoeffs[6] : ckt->CKTfinalTime;
|
? here->VSRCcoeffs[6] : ckt->CKTfinalTime;
|
||||||
#ifdef XSPICE
|
|
||||||
PHASE = here->VSRCfunctionOrder > 7
|
PHASE = here->VSRCfunctionOrder > 7
|
||||||
? here->VSRCcoeffs[7] : 0.0;
|
? here->VSRCcoeffs[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 +88,6 @@ VSRCaccept(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 */
|
||||||
|
|
|
||||||
|
|
@ -69,11 +69,10 @@ VSRCload(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->VSRCcoeffs[0];
|
V1 = here->VSRCcoeffs[0];
|
||||||
V2 = here->VSRCcoeffs[1];
|
V2 = here->VSRCcoeffs[1];
|
||||||
TD = here->VSRCfunctionOrder > 2
|
TD = here->VSRCfunctionOrder > 2
|
||||||
|
|
@ -94,8 +93,6 @@ VSRCload(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->VSRCfunctionOrder > 7
|
PHASE = here->VSRCfunctionOrder > 7
|
||||||
? here->VSRCcoeffs[7] : 0.0;
|
? here->VSRCcoeffs[7] : 0.0;
|
||||||
|
|
||||||
|
|
@ -107,8 +104,7 @@ VSRCload(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 */
|
||||||
|
|
@ -130,8 +126,6 @@ VSRCload(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;
|
||||||
|
|
||||||
|
|
@ -140,7 +134,7 @@ VSRCload(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->VSRCcoeffs[0];
|
VO = here->VSRCcoeffs[0];
|
||||||
VA = here->VSRCcoeffs[1];
|
VA = here->VSRCcoeffs[1];
|
||||||
FREQ = here->VSRCfunctionOrder > 2
|
FREQ = here->VSRCfunctionOrder > 2
|
||||||
|
|
@ -153,18 +147,10 @@ VSRCload(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;
|
||||||
|
|
@ -201,8 +187,6 @@ VSRCload(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;
|
||||||
|
|
@ -215,7 +199,6 @@ VSRCload(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->VSRCcoeffs[0];
|
VO = here->VSRCcoeffs[0];
|
||||||
VA = here->VSRCcoeffs[1];
|
VA = here->VSRCcoeffs[1];
|
||||||
|
|
@ -228,26 +211,16 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
&& here->VSRCcoeffs[4]
|
&& here->VSRCcoeffs[4]
|
||||||
? here->VSRCcoeffs[4] : (1/ckt->CKTfinalTime);
|
? here->VSRCcoeffs[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;
|
||||||
|
|
@ -260,7 +233,6 @@ VSRCload(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->VSRCcoeffs[0];
|
VA = here->VSRCcoeffs[0];
|
||||||
VO = here->VSRCcoeffs[1];
|
VO = here->VSRCcoeffs[1];
|
||||||
|
|
@ -277,18 +249,10 @@ VSRCload(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