Jspice3
diopzld.c File Reference
#include "spice.h"
#include <stdio.h>
#include "diodefs.h"
#include "sperror.h"
Include dependency graph for diopzld.c:

Go to the source code of this file.

Functions

int DIOpzLoad (GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
 

Function Documentation

int DIOpzLoad ( GENmodel inModel,
CKTcircuit ckt,
SPcomplex s 
)

Definition at line 15 of file diopzld.c.

20 {
21  DIOmodel *model = (DIOmodel*)inModel;
22  double gspr;
23  double geq;
24  double xceq;
25  DIOinstance *here;
26 
27  /* loop through all the diode models */
28  for ( ; model != NULL; model = model->DIOnextModel) {
29 
30  /* loop through all the instances of the model */
31  for (here = model->DIOinstances; here != NULL;
32  here = here->DIOnextInstance) {
33 
34  gspr = model->DIOresist*here->DIOarea;
35  geq = here->DIOgd;
36  xceq = here->DIOcap;
37 
38  *(here->DIOposPosPtr ) += gspr;
39  *(here->DIOnegNegPtr ) += geq + xceq*s->real;
40  *(here->DIOnegNegPtr+1) += xceq*s->imag;
41  *(here->DIOposPrimePosPrimePtr ) += geq + gspr + xceq*s->real;
42  *(here->DIOposPrimePosPrimePtr+1) += xceq*s->imag;
43  *(here->DIOposPosPrimePtr ) -= gspr;
44  *(here->DIOnegPosPrimePtr ) -= geq + xceq*s->real;
45  *(here->DIOnegPosPrimePtr+1) -= xceq*s->imag;
46  *(here->DIOposPrimePosPtr ) -= gspr;
47  *(here->DIOposPrimeNegPtr ) -= geq + xceq*s->real;
48  *(here->DIOposPrimeNegPtr+1) -= xceq*s->imag;
49  }
50  }
51  return (OK);
52 }
double DIOgd
Definition: diodefs.h:61
struct sDIOinstance * DIOnextInstance
Definition: diodefs.h:20
double real
Definition: complex.h:13
double * DIOposPosPtr
Definition: diodefs.h:35
double * DIOposPosPrimePtr
Definition: diodefs.h:27
double * DIOposPrimePosPrimePtr
Definition: diodefs.h:39
double * DIOposPrimePosPtr
Definition: diodefs.h:31
#define OK
Definition: iferrmsg.h:17
double * DIOnegPosPrimePtr
Definition: diodefs.h:29
DIOinstance * DIOinstances
Definition: diodefs.h:121
#define NULL
Definition: spdefs.h:121
double * DIOposPrimeNegPtr
Definition: diodefs.h:33
double * DIOnegNegPtr
Definition: diodefs.h:37
struct sDIOmodel * DIOnextModel
Definition: diodefs.h:119
static char model[32]
Definition: subckt.c:76
double DIOcap
Definition: diodefs.h:62
double imag
Definition: complex.h:14
double DIOarea
Definition: diodefs.h:48
double DIOresist
Definition: diodefs.h:142