spicelib/devices/{sw,csw}, #6/, bug fix, HYST_ON/OFF

> 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

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
This commit is contained in:
rlar 2018-03-10 13:46:02 +01:00
parent d0599517de
commit 50ad54e534
2 changed files with 8 additions and 8 deletions

View File

@ -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");
}

View File

@ -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;
}
}