diff --git a/src/spicelib/analysis/cktmkcurKCL.c b/src/spicelib/analysis/cktmkcurKCL.c new file mode 100644 index 000000000..4506af60c --- /dev/null +++ b/src/spicelib/analysis/cktmkcurKCL.c @@ -0,0 +1,21 @@ +/********** +Author: 2013 Francesco Lannutti +**********/ + +#include "ngspice/ngspice.h" +#include "ngspice/sperror.h" +#include "ngspice/cktdefs.h" + +int +CKTmkCurKCL (CKTcircuit *ckt, int i, double **node) +{ + CKTmkCurKCLnode *tempNode ; + + tempNode = TMALLOC (CKTmkCurKCLnode, 1) ; + tempNode->KCLcurrent = 0.0 ; + tempNode->next = ckt->CKTmkCurKCLarray [i] ; + ckt->CKTmkCurKCLarray [i] = tempNode ; + *node = &(tempNode->KCLcurrent) ; + + return (OK) ; +} diff --git a/src/spicelib/devices/ind/indnode.c b/src/spicelib/devices/ind/indnode.c new file mode 100644 index 000000000..bb1203981 --- /dev/null +++ b/src/spicelib/devices/ind/indnode.c @@ -0,0 +1,29 @@ +/********** +Author: 2013 Francesco Lannutti +**********/ + +#include "ngspice/ngspice.h" +#include "ngspice/cktdefs.h" +#include "inddefs.h" +#include "ngspice/sperror.h" + +int +INDnodeIsNonLinear (GENmodel *inModel, CKTcircuit *ckt) +{ + INDmodel *model = (INDmodel *)inModel ; + INDinstance *here ; + int error ; + + /* loop through all the IND models */ + for ( ; model != NULL ; model = model->INDnextModel) + { + /* loop through all the instances of the model */ + for (here = model->INDinstances ; here != NULL ; here = here->INDnextInstance) + { + error = CKTmkCurKCL (ckt, here->INDposNode, &(here->KCLcurrentPos)) ; + error = CKTmkCurKCL (ckt, here->INDnegNode, &(here->KCLcurrentNeg)) ; + } + } + + return (OK) ; +} diff --git a/src/spicelib/devices/vsrc/vsrcnode.c b/src/spicelib/devices/vsrc/vsrcnode.c new file mode 100644 index 000000000..fe733593c --- /dev/null +++ b/src/spicelib/devices/vsrc/vsrcnode.c @@ -0,0 +1,29 @@ +/********** +Author: 2013 Francesco Lannutti +**********/ + +#include "ngspice/ngspice.h" +#include "ngspice/cktdefs.h" +#include "vsrcdefs.h" +#include "ngspice/sperror.h" + +int +VSRCnodeIsNonLinear (GENmodel *inModel, CKTcircuit *ckt) +{ + VSRCmodel *model = (VSRCmodel *)inModel ; + VSRCinstance *here ; + int error ; + + /* loop through all the VSRC models */ + for ( ; model != NULL ; model = model->VSRCnextModel) + { + /* loop through all the instances of the model */ + for (here = model->VSRCinstances ; here != NULL ; here = here->VSRCnextInstance) + { + error = CKTmkCurKCL (ckt, here->VSRCposNode, &(here->KCLcurrentPos)) ; + error = CKTmkCurKCL (ckt, here->VSRCnegNode, &(here->KCLcurrentNeg)) ; + } + } + + return (OK) ; +}