element instantiation e.g. r=50
This commit is contained in:
parent
897d11bf48
commit
865eaed5ab
|
|
@ -37,6 +37,10 @@ void INP2C(void *ckt, INPtables * tab, card * current)
|
||||||
double leadval; /* actual value of unlabeled number */
|
double leadval; /* actual value of unlabeled number */
|
||||||
IFuid uid; /* uid for default cap model */
|
IFuid uid; /* uid for default cap model */
|
||||||
|
|
||||||
|
#ifdef TRACE
|
||||||
|
printf("In INP2C, Current line: %s\n", current->line);
|
||||||
|
#endif
|
||||||
|
|
||||||
mytype = INPtypelook("Capacitor");
|
mytype = INPtypelook("Capacitor");
|
||||||
if (mytype < 0) {
|
if (mytype < 0) {
|
||||||
LITERR("Device type Capacitor not supported by this binary\n");
|
LITERR("Device type Capacitor not supported by this binary\n");
|
||||||
|
|
@ -55,7 +59,7 @@ void INP2C(void *ckt, INPtables * tab, card * current)
|
||||||
|
|
||||||
INPgetTok(&line, &model, 1);
|
INPgetTok(&line, &model, 1);
|
||||||
|
|
||||||
if (*model) {
|
if (*model && (strcmp(model, "c") != 0)) {
|
||||||
/* token isn't null */
|
/* token isn't null */
|
||||||
if (INPlookMod(model)) {
|
if (INPlookMod(model)) {
|
||||||
/* If this is a valid model connect it */
|
/* If this is a valid model connect it */
|
||||||
|
|
@ -94,6 +98,12 @@ void INP2C(void *ckt, INPtables * tab, card * current)
|
||||||
IFC(newModel, (ckt, type, &(tab->defCmod), uid));
|
IFC(newModel, (ckt, type, &(tab->defCmod), uid));
|
||||||
}
|
}
|
||||||
IFC(newInstance, (ckt, tab->defCmod, &fast, name));
|
IFC(newInstance, (ckt, tab->defCmod, &fast, name));
|
||||||
|
if (error1 == 1) { /* was a c=val construction */
|
||||||
|
val = INPevaluate(&line, &error1, 1); /* [<val>] */
|
||||||
|
#ifdef TRACE
|
||||||
|
printf ("In INP2C, C=val construction: val=%g\n", val);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error1 == 0) { /* Looks like a number */
|
if (error1 == 0) { /* Looks like a number */
|
||||||
|
|
@ -108,5 +118,6 @@ void INP2C(void *ckt, INPtables * tab, card * current)
|
||||||
ptemp.rValue = leadval;
|
ptemp.rValue = leadval;
|
||||||
GCA(INPpName, ("capacitance", &ptemp, ckt, type, fast));
|
GCA(INPpName, ("capacitance", &ptemp, ckt, type, fast));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@ void INP2L(void *ckt, INPtables * tab, card * current)
|
||||||
double leadval; /* actual value of unlabeled number */
|
double leadval; /* actual value of unlabeled number */
|
||||||
IFuid uid; /* uid for default cap model */
|
IFuid uid; /* uid for default cap model */
|
||||||
|
|
||||||
|
#ifdef TRACE
|
||||||
|
printf("In INP2L, Current line: %s\n", current->line);
|
||||||
|
#endif
|
||||||
|
|
||||||
mytype = INPtypelook("Inductor");
|
mytype = INPtypelook("Inductor");
|
||||||
if (mytype < 0) {
|
if (mytype < 0) {
|
||||||
LITERR("Device type Inductor not supported by this binary\n");
|
LITERR("Device type Inductor not supported by this binary\n");
|
||||||
|
|
@ -55,7 +59,7 @@ void INP2L(void *ckt, INPtables * tab, card * current)
|
||||||
|
|
||||||
INPgetTok(&line, &model, 1);
|
INPgetTok(&line, &model, 1);
|
||||||
|
|
||||||
if (*model) {
|
if (*model && (strcmp(model, "l") != 0)) {
|
||||||
/* token isn't null */
|
/* token isn't null */
|
||||||
if (INPlookMod(model)) {
|
if (INPlookMod(model)) {
|
||||||
/* If this is a valid model connect it */
|
/* If this is a valid model connect it */
|
||||||
|
|
@ -85,7 +89,7 @@ void INP2L(void *ckt, INPtables * tab, card * current)
|
||||||
IFC(newInstance, (ckt, mdfast, &fast, name));
|
IFC(newInstance, (ckt, mdfast, &fast, name));
|
||||||
} else {
|
} else {
|
||||||
tfree(model);
|
tfree(model);
|
||||||
/* The token is null and a default model will be created */
|
/* The token is null or we have l=val - a default model will be created */
|
||||||
type = mytype;
|
type = mytype;
|
||||||
if (!tab->defLmod) {
|
if (!tab->defLmod) {
|
||||||
/* create default L model */
|
/* create default L model */
|
||||||
|
|
@ -94,6 +98,12 @@ void INP2L(void *ckt, INPtables * tab, card * current)
|
||||||
IFC(newModel, (ckt, type, &(tab->defLmod), uid));
|
IFC(newModel, (ckt, type, &(tab->defLmod), uid));
|
||||||
}
|
}
|
||||||
IFC(newInstance, (ckt, tab->defLmod, &fast, name));
|
IFC(newInstance, (ckt, tab->defLmod, &fast, name));
|
||||||
|
if (error1 == 1) { /* was a l=val construction */
|
||||||
|
val = INPevaluate(&line, &error1, 1); /* [<val>] */
|
||||||
|
#ifdef TRACE
|
||||||
|
printf ("In INP2L, L=val construction: val=%g\n", val);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error1 == 0) { /* Looks like a number */
|
if (error1 == 0) { /* Looks like a number */
|
||||||
|
|
@ -108,5 +118,6 @@ void INP2L(void *ckt, INPtables * tab, card * current)
|
||||||
ptemp.rValue = leadval;
|
ptemp.rValue = leadval;
|
||||||
GCA(INPpName, ("inductance", &ptemp, ckt, type, fast));
|
GCA(INPpName, ("inductance", &ptemp, ckt, type, fast));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ Remarks: This code is based on a version written by Serban Popescu which
|
||||||
**********/
|
**********/
|
||||||
|
|
||||||
#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"
|
||||||
|
|
@ -48,8 +47,7 @@ void INP2R(void *ckt, INPtables * tab, card * current)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef TRACE
|
#ifdef TRACE
|
||||||
printf("In INP2R()\n");
|
printf("In INP2R, Current line: %s\n", current->line);
|
||||||
printf(" Current line: %s\n",current->line);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mytype = INPtypelook("Resistor");
|
mytype = INPtypelook("Resistor");
|
||||||
|
|
@ -72,12 +70,12 @@ void INP2R(void *ckt, INPtables * tab, card * current)
|
||||||
|
|
||||||
saveline = line; /* save then old pointer */
|
saveline = line; /* save then old pointer */
|
||||||
|
|
||||||
|
if (strstr( line, "tc=" )) { /* looking for tc= there are no spaces between */
|
||||||
#ifdef TRACE
|
#ifdef TRACE
|
||||||
printf("Begining tc=xxx yyyy search and translation in '%s'\n", line);
|
printf("Begining tc=xxx yyyy search and translation in '%s'\n", line);
|
||||||
#endif /* TRACE */
|
#endif /* TRACE */
|
||||||
|
|
||||||
/* This routine translates "tc=xxx yyy" to "tc=xxx tc2=yyy".
|
/* This routine translates "tc=xxx yyy" to "tc=xxx tc2=yyy".
|
||||||
This is a re-write of the routine originally proposed by Hitoshi tanaka.
|
This is a re-write of the routine originally proposed by Hitoshi Tanaka.
|
||||||
In my version we simply look for the first occurence of 'tc' followed
|
In my version we simply look for the first occurence of 'tc' followed
|
||||||
by '=' followed by two numbers. If we find it then we splice in "tc2=".
|
by '=' followed by two numbers. If we find it then we splice in "tc2=".
|
||||||
sjb - 2005-05-09 */
|
sjb - 2005-05-09 */
|
||||||
|
|
@ -154,17 +152,20 @@ void INP2R(void *ckt, INPtables * tab, card * current)
|
||||||
current->line = line;
|
current->line = line;
|
||||||
line = saveline;
|
line = saveline;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRACE
|
#ifdef TRACE
|
||||||
printf("(Translated) Res line: %s\n",current->line);
|
printf("(Translated) Resistor line: %s\n", current->line);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
INPgetTok(&line, &model, 1);
|
INPgetTok(&line, &model, 1);
|
||||||
|
|
||||||
if (*model) {
|
if (*model && (strcmp(model, "r") != 0)) {
|
||||||
/* token isn't null */
|
/* token isn't null */
|
||||||
if (INPlookMod(model)) {
|
if (INPlookMod(model)) {
|
||||||
/* If this is a valid model connect it */
|
/* If this is a valid model connect it */
|
||||||
|
#ifdef TRACE
|
||||||
|
printf("In INP2R, Valid R Model: %s\n", model);
|
||||||
|
#endif
|
||||||
INPinsert(&model, tab);
|
INPinsert(&model, tab);
|
||||||
thismodel = (INPmodel *) NULL;
|
thismodel = (INPmodel *) NULL;
|
||||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||||
|
|
@ -191,7 +192,7 @@ void INP2R(void *ckt, INPtables * tab, card * current)
|
||||||
IFC(newInstance, (ckt, mdfast, &fast, name));
|
IFC(newInstance, (ckt, mdfast, &fast, name));
|
||||||
} else {
|
} else {
|
||||||
tfree(model);
|
tfree(model);
|
||||||
/* The token is null and a default model will be created */
|
/* The token is null or we have r=val - a default model will be created */
|
||||||
type = mytype;
|
type = mytype;
|
||||||
if (!tab->defRmod) {
|
if (!tab->defRmod) {
|
||||||
/* create default R model */
|
/* create default R model */
|
||||||
|
|
@ -200,6 +201,12 @@ void INP2R(void *ckt, INPtables * tab, card * current)
|
||||||
IFC(newModel, (ckt, type, &(tab->defRmod), uid));
|
IFC(newModel, (ckt, type, &(tab->defRmod), uid));
|
||||||
}
|
}
|
||||||
IFC(newInstance, (ckt, tab->defRmod, &fast, name));
|
IFC(newInstance, (ckt, tab->defRmod, &fast, name));
|
||||||
|
if (error1 == 1) { /* was a r=val construction */
|
||||||
|
val = INPevaluate(&line, &error1, 1); /* [<val>] */
|
||||||
|
#ifdef TRACE
|
||||||
|
printf ("In INP2R, R=val construction: val=%g\n", val);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error1 == 0) { /* got a resistance above */
|
if (error1 == 0) { /* got a resistance above */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue