Correct handling of adms 5 terminal models

This commit is contained in:
dwarning 2009-02-22 11:58:33 +00:00
parent 9c7e45b1d7
commit 00a141073f
2 changed files with 17 additions and 20 deletions

View File

@ -5,7 +5,6 @@ Modified: 2001 Paolo Nenzi (Cider Integration)
**********/
#include "ngspice.h"
#include <stdio.h>
#include "ifsim.h"
#include "inpdefs.h"
#include "inpmacs.h"
@ -121,7 +120,9 @@ void INP2Q(void *ckt, INPtables * tab, card * current, void *gnode)
return;
}
#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")
return;
@ -151,12 +152,10 @@ void INP2Q(void *ckt, INPtables * tab, card * current, void *gnode)
IFC(bindNode, (ckt, fast, 4, node4));
#ifdef ADMS
if ((type == INPtypelook ("hicum0")) ||
(type == INPtypelook ("hicum2")) ||
(type == INPtypelook ("mextram")) )
{
if (nodeflag) {
IFC(bindNode, (ckt, fast, 5, node5));
if (type) /* the type is set above - must be for adms models something like 57-59 */
{
if (nodeflag) { /* was the string a node ? */
IFC(bindNode, (ckt, fast, 5, node5));
} else {
((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));
if (waslead) {
#ifdef CIDER
if( type == INPtypelook("NBJT2") ) {
if( type == INPtypelook("NBJT2") ) {
LITERR(" error: no unlabeled parameter permitted on NBJT2\n")
} else {
} else {
#endif
ptemp.rValue = leadval;
GCA(INPpName, ("area", &ptemp, ckt, type, fast));
}
ptemp.rValue = leadval;
GCA(INPpName, ("area", &ptemp, ckt, type, fast));
}
#ifdef CIDER
}
#endif

View File

@ -6,7 +6,6 @@ $Id$
**********/
#include "ngspice.h"
#include <stdio.h>
#include "inpdefs.h"
#include "ifsim.h"
#include "cpstd.h"
@ -171,7 +170,6 @@ parse_line( char* line, char* tokens[], int num_tokens, double values[], bool fo
static bool
is_equal( double result, double expectedResult )
{
//if (fabs(result - expectedResult) < 0.00001) return TRUE;
if (fabs(result - expectedResult) < 1e-15) return TRUE;
else return FALSE;
}
@ -247,10 +245,10 @@ char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
#ifdef TRACE
/* 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
if (strcmp((modtmp)->INPmodName, name) == 0) {
if (strstr((modtmp)->INPmodName, name) >= 0) {
/* found the model in question - now instantiate if necessary */
/* 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 */
if (!((modtmp)->INPmodUsed)) { /* Check if model is already defined */
error = create_model( ckt, modtmp, tab );
if ( error ) return INPerror(error);
error = create_model( ckt, modtmp, tab );
if ( error ) return INPerror(error);
}
*model = modtmp;
return ((char *) NULL);
@ -279,7 +277,7 @@ char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
/* didn't find model - ERROR - return model */
*model = (INPmodel *) NULL;
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
/* SDB debug statement */