Jspice3
ind.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  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "inddefs.h"
11 #include "uflags.h"
12 
13 static IFparm INDpTable[] = { /* parameters */
14  IOPAP("inductance",IND_IND, IF_REAL,"Inductance of inductor"),
15  IOPAU("ic", IND_IC, IF_REAL,"Initial current through inductor"),
16  OP( "flux", IND_FLUX, IF_REAL,"Flux through inductor"),
17  OP( "v", IND_VOLT, IF_REAL,"Terminal voltage of inductor"),
18  OPR( "volt", IND_VOLT, IF_REAL,"Terminal voltage of inductor"),
19  OP( "i", IND_CURRENT,IF_REAL,"Current through the inductor"),
20  OPR( "current", IND_CURRENT,IF_REAL,"Current through the inductor"),
21  OP( "p", IND_POWER, IF_REAL,
22  "instantaneous power stored by the inductor")
23 };
24 
25 /* model parameters */
26 /* static IFparm INDmPTable[] = { }; */
27 
28 static char *INDnames[] = {
29  "L+",
30  "L-"
31 };
32 
33 static IFkeys INDkeys[] = {
34  { 'l', NUMELEMS(INDnames), INDnames, 0, 0 },
35 };
36 
37 
38 static int INDkSize = NUMELEMS(INDkeys);
39 static int INDpTSize = NUMELEMS(INDpTable);
40 static int INDmPTSize = 0;
41 static int INDiSize = sizeof(INDinstance);
42 static int INDmSize = sizeof(INDmodel);
43 
45  {
46  "Inductor",
47  "Inductors",
48 
49  &INDkSize,
50  INDkeys,
51  1,
52  NULL,
53  INDparse,
54 
55  &INDpTSize,
56  INDpTable,
57 
58  0, /*&INDmPTSize*/
59  NULL /*INDmPTable*/
60  },
61 
62  INDparam,
63  NULL,
64  INDload,
65  INDsetup,
66  INDsetup,
67  NULL,
68  INDtrunc,
69  INDfindBr,
70  INDacLoad,
71  NULL,
72  GENdestroy,
73  GENmDelete,
74  GENdelete,
75  INDgetic,
76  INDask,
77  NULL,
78  INDpzLoad,
79  NULL,
80  NULL, /* DISTO */
81  NULL, /* NOISE */
82 
83  &INDiSize,
84  &INDmSize
85 };
86 
87 #ifdef MUTUAL
88 
89 static IFparm MUTpTable[] = { /* parameters */
90  IOPAP("k", MUT_COEFF,IF_REAL, "Mutual inductance"),
91  IOPR( "coefficient",MUT_COEFF,IF_REAL, "Mutual inductance"),
92  IOP( "inductor1", MUT_IND1, IF_INSTANCE, "First coupled inductor"),
93  IOP( "inductor2", MUT_IND2, IF_INSTANCE, "Second coupled inductor"),
94 };
95 
96 /* model parameters */
97 /* static IFparm MUTmPTable[] = { }; */
98 
99 static IFkeys MUTkeys[] = {
100  { 'k', 0, NULL, 0, 2 },
101 };
102 
103 
104 static int MUTkSize = NUMELEMS(MUTkeys);
105 static int MUTpTSize = NUMELEMS(MUTpTable);
106 static int MUTmPTSize = 0;
107 static int MUTiSize = sizeof(MUTinstance);
108 static int MUTmSize = sizeof(MUTmodel);
109 
110 SPICEdev MUTinfo = {
111  {
112  "mutual",
113  "Mutual inductors",
114 
115  &MUTkSize,
116  MUTkeys,
117  1,
118  NULL,
119  MUTparse,
120 
121  &MUTpTSize,
122  MUTpTable,
123 
124  0, /*&INDmPTSize*/
125  NULL /*MUTmPTable*/
126  },
127 
128  MUTparam,
129  NULL,
130  NULL,/* load handled by INDload */
131  NULL,
132  NULL,
133  NULL,
134  NULL,
135  NULL,
136  NULL,
137  NULL,
138  GENdestroy,
139  GENmDelete,
140  GENdelete,
141  NULL,
142  MUTask,
143  NULL,
144  NULL, /* PZ */
145  NULL,
146  NULL, /* DISTO */
147  NULL, /* NOISE */
148 
149  &MUTiSize,
150  &MUTmSize
151 };
152 
153 #endif /*MUTUAL*/
#define MUT_IND1
Definition: inddefs.h:212
#define IND_CURRENT
Definition: inddefs.h:116
struct sMUTmodel MUTmodel
static int INDpTSize
Definition: ind.c:39
struct sMUTinstance MUTinstance
#define IOP(a, b, c, d)
Definition: devdefs.h:120
#define IND_VOLT
Definition: inddefs.h:115
#define NUMELEMS(ARRAY)
Definition: spice.h:157
int INDask()
int INDfindBr()
int INDacLoad()
static IFparm INDpTable[]
Definition: ind.c:13
void MUTparse()
#define IOPR(a, b, c, d)
Definition: uflags.h:57
#define MUT_IND2
Definition: inddefs.h:213
#define IND_IND
Definition: inddefs.h:112
void INDparse()
static int INDmSize
Definition: ind.c:42
void GENdestroy()
static int INDkSize
Definition: ind.c:38
#define IF_INSTANCE
Definition: ifsim.h:112
static char * INDnames[]
Definition: ind.c:28
#define IOPAP(a, b, c, d)
Definition: uflags.h:52
int MUTparam()
int INDload()
int INDparam()
int INDpzLoad()
struct sINDinstance INDinstance
#define NULL
Definition: spdefs.h:121
#define IND_POWER
Definition: inddefs.h:117
#define IND_FLUX
Definition: inddefs.h:114
#define OPR(a, b, c, d)
Definition: uflags.h:66
Definition: ifsim.h:54
Definition: ifsim.h:267
#define IND_IC
Definition: inddefs.h:113
#define IF_REAL
Definition: ifsim.h:108
static int INDmPTSize
Definition: ind.c:40
int GENmDelete()
#define MUT_COEFF
Definition: inddefs.h:211
int GENdelete()
static IFkeys INDkeys[]
Definition: ind.c:33
int INDsetup()
#define IOPAU(a, b, c, d)
Definition: uflags.h:51
int INDtrunc()
SPICEdev INDinfo
Definition: ind.c:44
SPICEdev MUTinfo
#define OP(a, b, c, d)
Definition: devdefs.h:119
int INDgetic()
static int INDiSize
Definition: ind.c:41
int MUTask()
struct sINDmodel INDmodel