mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 13:57:32 +02:00
Correct handling of adms 5 terminal models
This commit is contained in:
+12
-13
@@ -5,7 +5,6 @@ Modified: 2001 Paolo Nenzi (Cider Integration)
|
|||||||
**********/
|
**********/
|
||||||
|
|
||||||
#include "ngspice.h"
|
#include "ngspice.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include "ifsim.h"
|
#include "ifsim.h"
|
||||||
#include "inpdefs.h"
|
#include "inpdefs.h"
|
||||||
#include "inpmacs.h"
|
#include "inpmacs.h"
|
||||||
@@ -121,7 +120,9 @@ void INP2Q(void *ckt, INPtables * tab, card * current, void *gnode)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef ADMS
|
#ifdef ADMS
|
||||||
if (nodeflag && (thismodel->INPmodType != INPtypelook("hicum2")))
|
if ((nodeflag && (thismodel->INPmodType != INPtypelook("hicum0")))
|
||||||
|
&& (nodeflag && (thismodel->INPmodType != INPtypelook("hicum2")))
|
||||||
|
&& (nodeflag && (thismodel->INPmodType != INPtypelook("mextram"))))
|
||||||
{
|
{
|
||||||
LITERR("Too much nodes for this model type")
|
LITERR("Too much nodes for this model type")
|
||||||
return;
|
return;
|
||||||
@@ -151,12 +152,10 @@ void INP2Q(void *ckt, INPtables * tab, card * current, void *gnode)
|
|||||||
IFC(bindNode, (ckt, fast, 4, node4));
|
IFC(bindNode, (ckt, fast, 4, node4));
|
||||||
|
|
||||||
#ifdef ADMS
|
#ifdef ADMS
|
||||||
if ((type == INPtypelook ("hicum0")) ||
|
if (type) /* the type is set above - must be for adms models something like 57-59 */
|
||||||
(type == INPtypelook ("hicum2")) ||
|
{
|
||||||
(type == INPtypelook ("mextram")) )
|
if (nodeflag) { /* was the string a node ? */
|
||||||
{
|
IFC(bindNode, (ckt, fast, 5, node5));
|
||||||
if (nodeflag) {
|
|
||||||
IFC(bindNode, (ckt, fast, 5, node5));
|
|
||||||
} else {
|
} else {
|
||||||
((GENinstance *) fast)->GENnode5 = -1;
|
((GENinstance *) fast)->GENnode5 = -1;
|
||||||
}
|
}
|
||||||
@@ -165,13 +164,13 @@ void INP2Q(void *ckt, INPtables * tab, card * current, void *gnode)
|
|||||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab));
|
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab));
|
||||||
if (waslead) {
|
if (waslead) {
|
||||||
#ifdef CIDER
|
#ifdef CIDER
|
||||||
if( type == INPtypelook("NBJT2") ) {
|
if( type == INPtypelook("NBJT2") ) {
|
||||||
LITERR(" error: no unlabeled parameter permitted on NBJT2\n")
|
LITERR(" error: no unlabeled parameter permitted on NBJT2\n")
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
ptemp.rValue = leadval;
|
ptemp.rValue = leadval;
|
||||||
GCA(INPpName, ("area", &ptemp, ckt, type, fast));
|
GCA(INPpName, ("area", &ptemp, ckt, type, fast));
|
||||||
}
|
}
|
||||||
#ifdef CIDER
|
#ifdef CIDER
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ $Id$
|
|||||||
**********/
|
**********/
|
||||||
|
|
||||||
#include "ngspice.h"
|
#include "ngspice.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include "inpdefs.h"
|
#include "inpdefs.h"
|
||||||
#include "ifsim.h"
|
#include "ifsim.h"
|
||||||
#include "cpstd.h"
|
#include "cpstd.h"
|
||||||
@@ -171,7 +170,6 @@ parse_line( char* line, char* tokens[], int num_tokens, double values[], bool fo
|
|||||||
static bool
|
static bool
|
||||||
is_equal( double result, double expectedResult )
|
is_equal( double result, double expectedResult )
|
||||||
{
|
{
|
||||||
//if (fabs(result - expectedResult) < 0.00001) return TRUE;
|
|
||||||
if (fabs(result - expectedResult) < 1e-15) return TRUE;
|
if (fabs(result - expectedResult) < 1e-15) return TRUE;
|
||||||
else return FALSE;
|
else return FALSE;
|
||||||
}
|
}
|
||||||
@@ -247,10 +245,10 @@ char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
|
|||||||
|
|
||||||
#ifdef TRACE
|
#ifdef TRACE
|
||||||
/* SDB debug statement */
|
/* SDB debug statement */
|
||||||
printf("In INPgetMod, comparing against stored model %s . . . \n", (modtmp)->INPmodName);
|
printf("In INPgetMod, comparing %s against stored model %s . . . \n", name, (modtmp)->INPmodName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (strcmp((modtmp)->INPmodName, name) == 0) {
|
if (strstr((modtmp)->INPmodName, name) >= 0) {
|
||||||
/* found the model in question - now instantiate if necessary */
|
/* found the model in question - now instantiate if necessary */
|
||||||
/* and return an appropriate pointer to it */
|
/* and return an appropriate pointer to it */
|
||||||
|
|
||||||
@@ -269,8 +267,8 @@ char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
|
|||||||
} /* end of checking for illegal model */
|
} /* end of checking for illegal model */
|
||||||
|
|
||||||
if (!((modtmp)->INPmodUsed)) { /* Check if model is already defined */
|
if (!((modtmp)->INPmodUsed)) { /* Check if model is already defined */
|
||||||
error = create_model( ckt, modtmp, tab );
|
error = create_model( ckt, modtmp, tab );
|
||||||
if ( error ) return INPerror(error);
|
if ( error ) return INPerror(error);
|
||||||
}
|
}
|
||||||
*model = modtmp;
|
*model = modtmp;
|
||||||
return ((char *) NULL);
|
return ((char *) NULL);
|
||||||
@@ -279,7 +277,7 @@ char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
|
|||||||
/* didn't find model - ERROR - return model */
|
/* didn't find model - ERROR - return model */
|
||||||
*model = (INPmodel *) NULL;
|
*model = (INPmodel *) NULL;
|
||||||
err = (char *) MALLOC((60 + strlen(name)) * sizeof(char));
|
err = (char *) MALLOC((60 + strlen(name)) * sizeof(char));
|
||||||
(void) sprintf(err," unable to find definition of model %s - default assumed \n", name);
|
(void) sprintf(err, "Unable to find definition of model %s - default assumed \n", name);
|
||||||
|
|
||||||
#ifdef TRACE
|
#ifdef TRACE
|
||||||
/* SDB debug statement */
|
/* SDB debug statement */
|
||||||
|
|||||||
Reference in New Issue
Block a user