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

Go to the source code of this file.

Functions

int DIOsetup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
 

Function Documentation

int DIOsetup ( SMPmatrix matrix,
GENmodel inModel,
CKTcircuit ckt,
int *  states 
)

Definition at line 21 of file diosetup.c.

27 {
28  DIOmodel *model = (DIOmodel*)inModel;
29  DIOinstance *here;
30  int error;
31  CKTnode *tmp;
32 
33  /* loop through all the diode models */
34  for ( ; model != NULL; model = model->DIOnextModel) {
35 
36  if (!model->DIOemissionCoeffGiven) {
37  model->DIOemissionCoeff = 1;
38  }
39  if (!model->DIOsatCurGiven) {
40  model->DIOsatCur = 1e-14;
41  }
42  if (!model->DIObreakdownCurrentGiven) {
43  model->DIObreakdownCurrent = 1e-3;
44  }
45  if (!model->DIOjunctionPotGiven){
46  model->DIOjunctionPot = 1;
47  }
48  if (!model->DIOgradingCoeffGiven) {
49  model->DIOgradingCoeff = .5;
50  }
51  if (!model->DIOdepletionCapCoeffGiven) {
52  model->DIOdepletionCapCoeff = .5;
53  }
54  if (!model->DIOtransitTimeGiven) {
55  model->DIOtransitTime = 0;
56  }
57  if (!model->DIOjunctionCapGiven) {
58  model->DIOjunctionCap = 0;
59  }
60  if (!model->DIOactivationEnergyGiven) {
61  model->DIOactivationEnergy = 1.11;
62  }
63  if (!model->DIOsaturationCurrentExpGiven) {
64  model->DIOsaturationCurrentExp = 3;
65  }
66  if (!model->DIOfNcoefGiven) {
67  model->DIOfNcoef = 0.0;
68  }
69  if (!model->DIOfNexpGiven) {
70  model->DIOfNexp = 1.0;
71  }
72 
73  /* loop through all the instances of the model */
74  for (here = model->DIOinstances; here != NULL;
75  here = here->DIOnextInstance) {
76 
77  if (!here->DIOareaGiven) {
78  here->DIOarea = 1;
79  }
80  if (model->DIOresist == 0) {
81  here->DIOposPrimeNode = here->DIOposNode;
82  }
83  else if (here->DIOposPrimeNode == 0) {
84  error = CKTmkVolt(ckt,&tmp,here->DIOname,"internal");
85  if (error) return (error);
86  here->DIOposPrimeNode = tmp->number;
87  }
88 
89  here->DIOstate = *states;
90  *states += DIOnumStates;
91 
92  TSTALLOC(DIOposPosPrimePtr,DIOposNode,DIOposPrimeNode)
93  TSTALLOC(DIOnegPosPrimePtr,DIOnegNode,DIOposPrimeNode)
94  TSTALLOC(DIOposPrimePosPtr,DIOposPrimeNode,DIOposNode)
95  TSTALLOC(DIOposPrimeNegPtr,DIOposPrimeNode,DIOnegNode)
96  TSTALLOC(DIOposPosPtr,DIOposNode,DIOposNode)
97  TSTALLOC(DIOnegNegPtr,DIOnegNode,DIOnegNode)
98  TSTALLOC(DIOposPrimePosPrimePtr,DIOposPrimeNode,DIOposPrimeNode)
99  }
100  }
101  return (OK);
102 }
double DIOactivationEnergy
Definition: diodefs.h:149
unsigned DIOdepletionCapCoeffGiven
Definition: diodefs.h:134
unsigned DIOfNcoefGiven
Definition: diodefs.h:138
double DIOfNcoef
Definition: diodefs.h:157
unsigned DIOjunctionPotGiven
Definition: diodefs.h:130
struct sDIOinstance * DIOnextInstance
Definition: diodefs.h:20
static double e
Definition: vectors.c:17
unsigned DIOgradingCoeffGiven
Definition: diodefs.h:131
double DIOtransitTime
Definition: diodefs.h:145
double DIOjunctionCap
Definition: diodefs.h:146
#define TSTALLOC(ptr, first, second)
Definition: devdefs.h:124
double DIOdepletionCapCoeff
Definition: diodefs.h:151
#define OK
Definition: iferrmsg.h:17
unsigned DIOsatCurGiven
Definition: diodefs.h:125
unsigned DIOareaGiven
Definition: diodefs.h:43
DIOinstance * DIOinstances
Definition: diodefs.h:121
double DIOsaturationCurrentExp
Definition: diodefs.h:150
unsigned DIOfNexpGiven
Definition: diodefs.h:139
#define NULL
Definition: spdefs.h:121
double DIOfNexp
Definition: diodefs.h:158
double DIOemissionCoeff
Definition: diodefs.h:144
int number
Definition: cktdefs.h:39
int DIOposPrimeNode
Definition: diodefs.h:26
struct sDIOmodel * DIOnextModel
Definition: diodefs.h:119
unsigned DIOemissionCoeffGiven
Definition: diodefs.h:127
unsigned DIOsaturationCurrentExpGiven
Definition: diodefs.h:133
static char model[32]
Definition: subckt.c:76
unsigned DIOtransitTimeGiven
Definition: diodefs.h:128
return(True)
unsigned DIObreakdownCurrentGiven
Definition: diodefs.h:136
#define DIOnumStates
Definition: diodefs.h:113
double DIObreakdownCurrent
Definition: diodefs.h:153
IFuid DIOname
Definition: diodefs.h:22
int DIOstate
Definition: diodefs.h:23
int DIOposNode
Definition: diodefs.h:24
double DIOjunctionPot
Definition: diodefs.h:147
double DIOarea
Definition: diodefs.h:48
int CKTmkVolt()
unsigned DIOactivationEnergyGiven
Definition: diodefs.h:132
double DIOsatCur
Definition: diodefs.h:141
double DIOresist
Definition: diodefs.h:142
double DIOgradingCoeff
Definition: diodefs.h:148
unsigned DIOjunctionCapGiven
Definition: diodefs.h:129