Jspice3
diopzld.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1985 Thomas L. Quarles
5  1992 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "diodefs.h"
11 #include "sperror.h"
12 
13 
14 int
15 DIOpzLoad(inModel,ckt,s)
16 
17 GENmodel *inModel;
18 CKTcircuit *ckt;
19 SPcomplex *s;
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 }
int DIOpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
Definition: diopzld.c:15
double DIOgd
Definition: diodefs.h:61
Definition: cddefs.h:119
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