spicelib/devices/{sw,csw}, #13/, improve SW/CSWtrunc()
shrink the timesteps down to CKTdelmin when aproaching a switchpoint, but not any further. fixme, thats not entirely save, consider lastChange==0 too ! Thanks to Alan Gillespie for pointing to this place.
This commit is contained in:
parent
624c523ad3
commit
21c4003dda
|
|
@ -27,9 +27,10 @@ CSWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
|
|||
ref = model->CSWiThreshold + fabs(model->CSWiHysteresis);
|
||||
if (ckt->CKTstate0[here->CSWctrlvalue] < ref && lastChange > 0) {
|
||||
maxChange =
|
||||
(ref - ckt->CKTstate0[here->CSWctrlvalue]) * 0.75
|
||||
+ 0.00005;
|
||||
(ref - ckt->CKTstate0[here->CSWctrlvalue]) * 0.75;
|
||||
maxStep = maxChange / lastChange * ckt->CKTdeltaOld[0];
|
||||
if (maxStep < ckt->CKTdelmin)
|
||||
maxStep = ckt->CKTdelmin;
|
||||
if (*timeStep > maxStep)
|
||||
*timeStep = maxStep;
|
||||
}
|
||||
|
|
@ -37,9 +38,10 @@ CSWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
|
|||
ref = model->CSWiThreshold - fabs(model->CSWiHysteresis);
|
||||
if (ckt->CKTstate0[here->CSWctrlvalue] > ref && lastChange < 0) {
|
||||
maxChange =
|
||||
(ref - ckt->CKTstate0[here->CSWctrlvalue]) * 0.75
|
||||
- 0.00005;
|
||||
(ref - ckt->CKTstate0[here->CSWctrlvalue]) * 0.75;
|
||||
maxStep = maxChange / lastChange * ckt->CKTdeltaOld[0];
|
||||
if (maxStep < ckt->CKTdelmin)
|
||||
maxStep = ckt->CKTdelmin;
|
||||
if (*timeStep > maxStep)
|
||||
*timeStep = maxStep;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,10 @@ SWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
|
|||
ref = model->SWvThreshold + fabs(model->SWvHysteresis);
|
||||
if (ckt->CKTstate0[here->SWctrlvalue] < ref && lastChange > 0) {
|
||||
maxChange =
|
||||
(ref - ckt->CKTstate0[here->SWctrlvalue]) * 0.75
|
||||
+ 0.05;
|
||||
(ref - ckt->CKTstate0[here->SWctrlvalue]) * 0.75;
|
||||
maxStep = maxChange / lastChange * ckt->CKTdeltaOld[0];
|
||||
if (maxStep < ckt->CKTdelmin)
|
||||
maxStep = ckt->CKTdelmin;
|
||||
if (*timeStep > maxStep)
|
||||
*timeStep = maxStep;
|
||||
}
|
||||
|
|
@ -37,9 +38,10 @@ SWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
|
|||
ref = model->SWvThreshold - fabs(model->SWvHysteresis);
|
||||
if (ckt->CKTstate0[here->SWctrlvalue] > ref && lastChange < 0) {
|
||||
maxChange =
|
||||
(ref - ckt->CKTstate0[here->SWctrlvalue]) * 0.75
|
||||
- 0.05;
|
||||
(ref - ckt->CKTstate0[here->SWctrlvalue]) * 0.75;
|
||||
maxStep = maxChange / lastChange * ckt->CKTdeltaOld[0];
|
||||
if (maxStep < ckt->CKTdelmin)
|
||||
maxStep = ckt->CKTdelmin;
|
||||
if (*timeStep > maxStep)
|
||||
*timeStep = maxStep;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue