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

Go to the source code of this file.

Functions

int SWacLoad (GENmodel *inModel, CKTcircuit *ckt)
 

Function Documentation

int SWacLoad ( GENmodel inModel,
CKTcircuit ckt 
)

Definition at line 15 of file swacload.c.

23 {
24  SWmodel *model = (SWmodel *)inModel;
25  SWinstance *here;
26  double g_now;
27  int current_state;
28 
29  /* loop through all the switch models */
30  for ( ; model != NULL; model = model->SWnextModel) {
31 
32  /* loop through all the instances of the model */
33  for (here = model->SWinstances; here != NULL;
34  here = here->SWnextInstance) {
35 
36  /* In AC analysis, just propogate the state... */
37 
38  current_state = (int)*(ckt->CKTstate0 + here->SWstate);
39 
40  g_now = current_state?(model->SWonConduct):(model->SWoffConduct);
41 
42  *(here->SWposPosptr) += g_now;
43  *(here->SWposNegptr) -= g_now;
44  *(here->SWnegPosptr) -= g_now;
45  *(here->SWnegNegptr) += g_now;
46  }
47  }
48  return (OK);
49 }
#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