If compatmode PS is set, translate vswitch and iswitch to pswitch.

This reverts commit 025a9fe59 ("Partially undo commit [ab778d] : revert to aswitch as vswitch replacement", 2020-11-22)
Successful OpAmp tests vote for pswitch.
Enable iswitch.
This commit is contained in:
Holger Vogt 2021-05-30 00:06:36 +02:00
parent f12592871a
commit c46676d06e
1 changed files with 11 additions and 8 deletions

View File

@ -8533,11 +8533,10 @@ static struct card *pspice_compat(struct card *oldcard)
tfree(card->line); tfree(card->line);
rep_spar(modpar); rep_spar(modpar);
card->line = tprintf( card->line = tprintf(
".model a%s aswitch(%s %s %s %s log=TRUE limit=TRUE)", modname, // ".model a%s aswitch(%s %s %s %s log=TRUE limit=TRUE)", modname,
modpar[0], modpar[1], modpar[2], modpar[3]);
// card->line = tprintf(
// ".model a%s pswitch(%s %s %s %s log=TRUE)", modname,
// modpar[0], modpar[1], modpar[2], modpar[3]); // modpar[0], modpar[1], modpar[2], modpar[3]);
".model a%s pswitch(%s %s %s %s log=TRUE)", modname,
modpar[0], modpar[1], modpar[2], modpar[3]);
} }
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
tfree(modpar[i]); tfree(modpar[i]);
@ -8552,11 +8551,11 @@ static struct card *pspice_compat(struct card *oldcard)
/* no need to continue if no vswitch is found */ /* no need to continue if no vswitch is found */
if (!modelsfound) if (!modelsfound)
return newcard; goto iswi;
/* no need to change the switch instances if switch sw is used */ /* no need to change the switch instances if switch sw is used */
if (have_vh && have_vt) if (have_vh && have_vt)
return newcard; goto iswi;
/* second scan: find the switch instances s calling a vswitch model and /* second scan: find the switch instances s calling a vswitch model and
* transform them */ * transform them */
@ -8613,6 +8612,8 @@ static struct card *pspice_compat(struct card *oldcard)
del_models(modelsfound); del_models(modelsfound);
modelsfound = NULL; modelsfound = NULL;
iswi:;
/* if iswitch part s, replace /* if iswitch part s, replace
* W1 D S VC SWN * W1 D S VC SWN
* .MODEL SWN ISWITCH ( ION = {0.55} IOFF = {0.49} * .MODEL SWN ISWITCH ( ION = {0.55} IOFF = {0.49}
@ -8717,7 +8718,9 @@ static struct card *pspice_compat(struct card *oldcard)
tfree(card->line); tfree(card->line);
rep_spar(modpar); rep_spar(modpar);
card->line = tprintf( card->line = tprintf(
".model a%s aswitch(%s %s %s %s log=TRUE limit=TRUE)", modname, // ".model a%s aswitch(%s %s %s %s log=TRUE limit=TRUE)", modname,
// modpar[0], modpar[1], modpar[2], modpar[3]);
".model a%s pswitch(%s %s %s %s log=TRUE)", modname,
modpar[0], modpar[1], modpar[2], modpar[3]); modpar[0], modpar[1], modpar[2], modpar[3]);
} }
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -8731,7 +8734,7 @@ static struct card *pspice_compat(struct card *oldcard)
} }
} }
/* no need to continue if no vswitch is found */ /* no need to continue if no iswitch is found */
if (!modelsfound) if (!modelsfound)
return newcard; return newcard;