Set new default values.

Restructure the code a bit.

Two parameters for AM are required (offset and amplitude). Even if this
sounds needless, changing it would require a major effort.
This commit is contained in:
Holger Vogt 2024-01-07 11:59:33 +01:00
parent 4d0e65b3b6
commit 5dbb25f667
2 changed files with 25 additions and 28 deletions

View File

@ -240,9 +240,20 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
case AM: { case AM: {
double VO, VA, FM, MD, FC, TD, PHASEM, PHASEC; double VO, VA, FM, MD, FC, TD, PHASEM, PHASEC;
double phasec; double phasec, phasem;
double phasem;
VO = here->ISRCcoeffs[0];
VA = here->ISRCcoeffs[1];
FM = here->ISRCfunctionOrder > 2
&& here->ISRCcoeffs[2]
? here->ISRCcoeffs[2] : (5. / ckt->CKTfinalTime);
MD = here->ISRCfunctionOrder > 3
? here->ISRCcoeffs[3] : 0.5;
FC = here->ISRCfunctionOrder > 4
? here->ISRCcoeffs[4] : (500. / ckt->CKTfinalTime);
TD = here->ISRCfunctionOrder > 5
&& here->ISRCcoeffs[5]
? here->ISRCcoeffs[5] : 0.0;
PHASEC = here->ISRCfunctionOrder > 6 PHASEC = here->ISRCfunctionOrder > 6
? here->ISRCcoeffs[6] : 0.0; ? here->ISRCcoeffs[6] : 0.0;
PHASEM = here->ISRCfunctionOrder > 7 PHASEM = here->ISRCfunctionOrder > 7
@ -252,19 +263,6 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
phasec = PHASEC * M_PI / 180.0; phasec = PHASEC * M_PI / 180.0;
phasem = PHASEM * M_PI / 180.0; phasem = PHASEM * M_PI / 180.0;
VO = here->ISRCcoeffs[0];
VA = here->ISRCcoeffs[1];
FM = here->ISRCfunctionOrder > 2
&& here->ISRCcoeffs[2]
? here->ISRCcoeffs[2] : (1/ckt->CKTfinalTime);
MD = here->ISRCfunctionOrder > 3
? here->ISRCcoeffs[3] : 0.5;
FC = here->ISRCfunctionOrder > 4
? here->ISRCcoeffs[4] : 0.0;
TD = here->ISRCfunctionOrder > 5
&& here->ISRCcoeffs[5]
? here->ISRCcoeffs[5] : 0.0;
/* limit the modulation depth */ /* limit the modulation depth */
if (MD > 1) if (MD > 1)
MD = 1; MD = 1;

View File

@ -265,6 +265,18 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt)
double phasec; double phasec;
double phasem; double phasem;
VO = here->VSRCcoeffs[0];
VA = here->VSRCcoeffs[1];
FM = here->VSRCfunctionOrder > 2
&& here->VSRCcoeffs[2]
? here->VSRCcoeffs[2] : (5. / ckt->CKTfinalTime);
MD = here->VSRCfunctionOrder > 3
? here->VSRCcoeffs[3] : 0.5;
FC = here->VSRCfunctionOrder > 4
? here->VSRCcoeffs[4] : (500. / ckt->CKTfinalTime);
TD = here->VSRCfunctionOrder > 5
&& here->VSRCcoeffs[5]
? here->VSRCcoeffs[5] : 0.0;
PHASEM = here->VSRCfunctionOrder > 6 PHASEM = here->VSRCfunctionOrder > 6
? here->VSRCcoeffs[6] : 0.0; ? here->VSRCcoeffs[6] : 0.0;
PHASEC = here->VSRCfunctionOrder > 7 PHASEC = here->VSRCfunctionOrder > 7
@ -274,19 +286,6 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt)
phasec = PHASEC * M_PI / 180.0; phasec = PHASEC * M_PI / 180.0;
phasem = PHASEM * M_PI / 180.0; phasem = PHASEM * M_PI / 180.0;
VO = here->VSRCcoeffs[0];
VA = here->VSRCcoeffs[1];
FM = here->VSRCfunctionOrder > 2
&& here->VSRCcoeffs[2]
? here->VSRCcoeffs[2] : (1/ckt->CKTfinalTime);
MD = here->VSRCfunctionOrder > 3
? here->VSRCcoeffs[3] : 0.5;
FC = here->VSRCfunctionOrder > 4
? here->VSRCcoeffs[4] : 0.0;
TD = here->VSRCfunctionOrder > 5
&& here->VSRCcoeffs[5]
? here->VSRCcoeffs[5] : 0.0;
/* limit the modulation depth */ /* limit the modulation depth */
if (MD > 1) if (MD > 1)
MD = 1; MD = 1;