spicelib/devices/{sw,csw}, #2/, bug fix, negative hysteresis

fix an aspect of commit:

> commit 0dae4607a0
> Date:   Wed Apr 25 18:28:20 2001 +0000
>
>     Added a patch to csw and sw from Jon Engelbert dealing with negative histeresys

which allowed negative hysteresis, but didn't fix the usage of hysteresis
in the trunc.c files accordingly.
This commit is contained in:
rlar 2018-03-10 10:56:34 +01:00
parent bc21f25fe7
commit 5bb08ea5c8
2 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ CSWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
ckt->CKTstate0[here->CSWctrlvalue] -
ckt->CKTstate1[here->CSWctrlvalue];
if (ckt->CKTstate0[here->CSWswitchstate] == 0) {
ref = model->CSWiThreshold + model->CSWiHysteresis;
ref = model->CSWiThreshold + fabs(model->CSWiHysteresis);
if (ckt->CKTstate0[here->CSWctrlvalue] < ref && lastChange > 0) {
maxChange =
(ref - ckt->CKTstate0[here->CSWctrlvalue]) * 0.75
@ -36,7 +36,7 @@ CSWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
*timeStep = maxStep;
}
} else {
ref = model->CSWiThreshold - model->CSWiHysteresis;
ref = model->CSWiThreshold - fabs(model->CSWiHysteresis);
if (ckt->CKTstate0[here->CSWctrlvalue] > ref && lastChange < 0) {
maxChange =
(ref - ckt->CKTstate0[here->CSWctrlvalue]) * 0.75

View File

@ -24,7 +24,7 @@ SWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
ckt->CKTstate0[here->SWctrlvalue] -
ckt->CKTstate1[here->SWctrlvalue];
if (ckt->CKTstate0[here->SWswitchstate] == 0) {
ref = model->SWvThreshold + model->SWvHysteresis;
ref = model->SWvThreshold + fabs(model->SWvHysteresis);
if (ckt->CKTstate0[here->SWctrlvalue] < ref && lastChange > 0) {
maxChange =
(ref - ckt->CKTstate0[here->SWctrlvalue]) * 0.75
@ -34,7 +34,7 @@ SWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
*timeStep = maxStep;
}
} else {
ref = model->SWvThreshold - model->SWvHysteresis;
ref = model->SWvThreshold - fabs(model->SWvHysteresis);
if (ckt->CKTstate0[here->SWctrlvalue] > ref && lastChange < 0) {
maxChange =
(ref - ckt->CKTstate0[here->SWctrlvalue]) * 0.75