Jspice3
Main Page
Data Structures
Files
File List
Globals
swpzload.c
Go to the documentation of this file.
1
/***************************************************************************
2
JSPICE3 adaptation of Spice3e2 - Copyright (c) Stephen R. Whiteley 1992
3
Copyright 1990 Regents of the University of California. All rights reserved.
4
Authors: 1985 Gordon M. Jacobs
5
1992 Stephen R. Whiteley
6
****************************************************************************/
7
8
#include "
spice.h
"
9
#include <stdio.h>
10
#include "
swdefs.h
"
11
#include "
sperror.h
"
12
13
14
/* ARGSUSED */
15
int
16
SWpzLoad
(inModel,ckt,
s
)
17
18
GENmodel
*inModel;
19
CKTcircuit
*ckt;
20
SPcomplex
*
s
;
21
/* load the current values into the
22
* sparse matrix previously provided
23
* during AC analysis.
24
*/
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
}
s
Definition:
cddefs.h:119
CKTcircuit
Definition:
cktdefs.h:62
sSWinstance
Definition:
swdefs.h:18
swdefs.h
OK
#define OK
Definition:
iferrmsg.h:17
sSWinstance::SWposNegptr
double * SWposNegptr
Definition:
swdefs.h:36
sSWmodel
Definition:
swdefs.h:58
sperror.h
NULL
#define NULL
Definition:
spdefs.h:121
sSWmodel::SWonConduct
double SWonConduct
Definition:
swdefs.h:72
sSWinstance::SWnextInstance
struct sSWinstance * SWnextInstance
Definition:
swdefs.h:20
sSWinstance::SWstate
int SWstate
Definition:
swdefs.h:23
sSWinstance::SWnegPosptr
double * SWnegPosptr
Definition:
swdefs.h:34
spice.h
sGENmodel
Definition:
gendefs.h:39
sSWinstance::SWnegNegptr
double * SWnegNegptr
Definition:
swdefs.h:38
model
static char model[32]
Definition:
subckt.c:76
sSWmodel::SWinstances
SWinstance * SWinstances
Definition:
swdefs.h:62
sSWinstance::SWposPosptr
double * SWposPosptr
Definition:
swdefs.h:32
SPcomplex
Definition:
complex.h:12
sSWmodel::SWoffConduct
double SWoffConduct
Definition:
swdefs.h:73
SWpzLoad
int SWpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
Definition:
swpzload.c:16
sSWmodel::SWnextModel
struct sSWmodel * SWnextModel
Definition:
swdefs.h:60
src
lib
dev
sw
swpzload.c
Generated by
1.8.11