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

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 16 of file swpzload.c.

25 {
26  SWmodel *model = (SWmodel *)inModel;
27  SWinstance *here;
28  double g_now;
29  int current_state;
30 
31  /* loop through all the switch models */
32  for ( ; model != NULL; model = model->SWnextModel) {
33 
34  /* loop through all the instances of the model */
35  for (here = model->SWinstances; here != NULL;
36  here = here->SWnextInstance) {
37 
38  /* In AC analysis, just propogate the state... */
39 
40  current_state = (int)*(ckt->CKTstate0 + here->SWstate);
41 
42  g_now = current_state?(model->SWonConduct):(model->SWoffConduct);
43 
44  *(here->SWposPosptr) += g_now;
45  *(here->SWposNegptr) -= g_now;
46  *(here->SWnegPosptr) -= g_now;
47  *(here->SWnegNegptr) += g_now;
48  }
49  }
50  return (OK);
51 }
#define OK
Definition: iferrmsg.h:17
double * SWposNegptr
Definition: swdefs.h:36
#define NULL
Definition: spdefs.h:121
double SWonConduct
Definition: swdefs.h:72
struct sSWinstance * SWnextInstance
Definition: swdefs.h:20
int SWstate
Definition: swdefs.h:23
double * SWnegPosptr
Definition: swdefs.h:34
double * SWnegNegptr
Definition: swdefs.h:38
static char model[32]
Definition: subckt.c:76
SWinstance * SWinstances
Definition: swdefs.h:62
double * SWposPosptr
Definition: swdefs.h:32
double SWoffConduct
Definition: swdefs.h:73
struct sSWmodel * SWnextModel
Definition: swdefs.h:60