From 50ad54e5345bf1a140ebe1be14cdd6225ca50c78 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 10 Mar 2018 13:46:02 +0100 Subject: [PATCH] spicelib/devices/{sw,csw}, #6/, bug fix, HYST_ON/OFF > commit 0dae4607a01e2bbf93a925f5c37385ad9ce232f2 > Date: Wed Apr 25 18:28:20 2001 +0000 > > Added a patch to csw and sw from Jon Engelbert dealing with negative histeresys This commit changed "state" from ranging over {0,1} to ranging over {0,1,2,3} trying to express the idea of a state transition from REALLY_ON/OFF into the hysteresis region, but got the HYST_ON/OFF wrong --- src/spicelib/devices/csw/cswload.c | 8 ++++---- src/spicelib/devices/sw/swload.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/spicelib/devices/csw/cswload.c b/src/spicelib/devices/csw/cswload.c index c63594ff1..5de4e4250 100644 --- a/src/spicelib/devices/csw/cswload.c +++ b/src/spicelib/devices/csw/cswload.c @@ -69,9 +69,9 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt) /* if previous state was in hysteresis, then don't change the state.. */ if (previous_state == HYST_OFF || previous_state == HYST_ON) current_state = previous_state; - else if (previous_state == REALLY_ON) - current_state = HYST_OFF; else if (previous_state == REALLY_OFF) + current_state = HYST_OFF; + else if (previous_state == REALLY_ON) current_state = HYST_ON; else internalerror("bad value for previous region in swload"); @@ -99,9 +99,9 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt) if (previous_state == HYST_OFF || previous_state == HYST_ON) current_state = previous_state; else if (previous_state == REALLY_ON) - current_state = HYST_OFF; - else if (previous_state == REALLY_OFF) current_state = HYST_ON; + else if (previous_state == REALLY_OFF) + current_state = HYST_OFF; else internalerror("bad value for previous region in cswload"); } diff --git a/src/spicelib/devices/sw/swload.c b/src/spicelib/devices/sw/swload.c index 0ac3e87b7..35df5a13b 100644 --- a/src/spicelib/devices/sw/swload.c +++ b/src/spicelib/devices/sw/swload.c @@ -74,9 +74,9 @@ SWload(GENmodel *inModel, CKTcircuit *ckt) if (previous_state == HYST_OFF || previous_state == HYST_ON) current_state = previous_state; else if (previous_state == REALLY_ON) - current_state = HYST_OFF; - else if (previous_state == REALLY_OFF) current_state = HYST_ON; + else if (previous_state == REALLY_OFF) + current_state = HYST_OFF; else internalerror("bad value for previous state in swload"); } @@ -99,9 +99,9 @@ SWload(GENmodel *inModel, CKTcircuit *ckt) if (previous_state == HYST_ON || previous_state == HYST_OFF) current_state = previous_state; else if (previous_state == REALLY_ON) - current_state = REALLY_OFF; + current_state = HYST_ON; else if (previous_state == REALLY_OFF) - current_state = REALLY_ON; + current_state = HYST_OFF; } }