From cbf4305ff8550a9a98779ae6a247d2ffb6888d16 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Mon, 7 Dec 2020 14:39:52 +0100 Subject: [PATCH] Remove the XSPICE dependency of the phase parameter for the independent voltage source. --- src/spicelib/devices/vsrc/vsrcacct.c | 10 ++----- src/spicelib/devices/vsrc/vsrcload.c | 42 ++-------------------------- 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/src/spicelib/devices/vsrc/vsrcacct.c b/src/spicelib/devices/vsrc/vsrcacct.c index 1c265ef4b..85ad3e3fd 100644 --- a/src/spicelib/devices/vsrc/vsrcacct.c +++ b/src/spicelib/devices/vsrc/vsrcacct.c @@ -54,12 +54,10 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) double time = 0.; double basetime = 0; -/* gtri - begin - wbk - add PHASE parameter */ -#ifdef XSPICE double PHASE; double phase; double deltat; -#endif + TD = here->VSRCfunctionOrder > 2 ? here->VSRCcoeffs[2] : 0.0; TR = here->VSRCfunctionOrder > 3 @@ -74,15 +72,13 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) PER = here->VSRCfunctionOrder > 6 && here->VSRCcoeffs[6] != 0.0 ? here->VSRCcoeffs[6] : ckt->CKTfinalTime; -#ifdef XSPICE PHASE = here->VSRCfunctionOrder > 7 ? here->VSRCcoeffs[7] : 0.0; -#endif + /* offset time by delay */ time = ckt->CKTtime - TD; tshift = TD; -#ifdef XSPICE /* normalize phase to 0 - 360° */ /* normalize phase to cycles */ phase = PHASE / 360.0; @@ -92,8 +88,6 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) deltat -= PER; time += deltat; tshift = TD - deltat; -#endif -/* gtri - end - wbk - add PHASE parameter */ if(time >= PER) { /* repeating signal - figure out where we are */ diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index f71bc5c43..0987219c2 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -69,11 +69,10 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) case PULSE: { double V1, V2, TD, TR, TF, PW, PER; double basetime = 0; -#ifdef XSPICE double PHASE; double phase; double deltat; -#endif + V1 = here->VSRCcoeffs[0]; V2 = here->VSRCcoeffs[1]; TD = here->VSRCfunctionOrder > 2 @@ -94,8 +93,6 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) /* shift time by delay time TD */ time -= TD; -#ifdef XSPICE -/* gtri - begin - wbk - add PHASE parameter */ PHASE = here->VSRCfunctionOrder > 7 ? here->VSRCcoeffs[7] : 0.0; @@ -107,8 +104,7 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) deltat -= PER; /* shift time by pase (neg. for pos. phase value) */ time += deltat; -/* gtri - end - wbk - add PHASE parameter */ -#endif + if(time > PER) { /* repeating signal - figure out where we are */ /* in period */ @@ -130,8 +126,6 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) case SINE: { double VO, VA, FREQ, TD, THETA; -/* gtri - begin - wbk - add PHASE parameter */ -#ifdef XSPICE double PHASE; double phase; @@ -140,7 +134,7 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) /* compute phase in radians */ phase = PHASE * M_PI / 180.0; -#endif + VO = here->VSRCcoeffs[0]; VA = here->VSRCcoeffs[1]; FREQ = here->VSRCfunctionOrder > 2 @@ -153,18 +147,10 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) time -= TD; if (time <= 0) { -#ifdef XSPICE value = VO + VA * sin(phase); } else { value = VO + VA * sin(FREQ*time * 2.0 * M_PI + phase) * 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; @@ -201,8 +187,6 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) case SFFM: { double VO, VA, FC, MDI, FS; -/* gtri - begin - wbk - add PHASE parameters */ -#ifdef XSPICE double PHASEC, PHASES; double phasec; double phases; @@ -215,7 +199,6 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) /* compute phases in radians */ phasec = PHASEC * M_PI / 180.0; phases = PHASES * M_PI / 180.0; -#endif VO = here->VSRCcoeffs[0]; VA = here->VSRCcoeffs[1]; @@ -228,26 +211,16 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) && here->VSRCcoeffs[4] ? here->VSRCcoeffs[4] : (1/ckt->CKTfinalTime); -#ifdef XSPICE /* compute waveform value */ value = VO + VA * sin((2.0 * M_PI * FC * time + phasec) + 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; case AM: { double VA, FC, MF, VO, TD; -/* gtri - begin - wbk - add PHASE parameters */ -#ifdef XSPICE double PHASEC, PHASES; double phasec; double phases; @@ -260,7 +233,6 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) /* compute phases in radians */ phasec = PHASEC * M_PI / 180.0; phases = PHASES * M_PI / 180.0; -#endif VA = here->VSRCcoeffs[0]; VO = here->VSRCcoeffs[1]; @@ -277,18 +249,10 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) if (time <= 0) { value = 0; } else { -#ifdef XSPICE /* compute waveform value */ value = VA * (VO + sin(2.0 * M_PI * MF * 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;