Jspice3
acsetp.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 "cktdefs.h"
11 #include "acdefs.h"
12 #include "jobdefs.h"
13 #include "iferrmsg.h"
14 
15 
16 /* ARGSUSED */
17 int
18 ACsetParm(cktp,anal,which,value)
19 
20 GENERIC *cktp;
21 GENERIC *anal;
22 int which;
23 IFvalue *value;
24 {
25  ACAN *job = (ACAN *) anal;
26 
27  if (ACsetp(&job->AC,which,value) == OK)
28  return (OK);
29  if (DCTsetp(&job->DC,which,value) == OK)
30  return (OK);
31  return (E_BADPARM);
32 }
33 
34 
35 int
36 ACsetp(ac,which,value)
37 
38 struct sACprms *ac;
39 int which;
40 IFvalue *value;
41 {
42  switch (which) {
43 
44  case AC_START:
45  ac->fstart = value->rValue;
46  break;
47 
48  case AC_STOP:
49  ac->fstop = value->rValue;
50  break;
51 
52  case AC_STEPS:
53  ac->numSteps = value->iValue;
54  break;
55 
56  case AC_DEC:
57  if (value->iValue) {
58  ac->stepType = DECADE;
59  }
60  else {
61  if (ac->stepType == DECADE) {
62  ac->stepType = 0;
63  }
64  }
65  break;
66 
67  case AC_OCT:
68  if (value->iValue) {
69  ac->stepType = OCTAVE;
70  }
71  else {
72  if (ac->stepType == OCTAVE) {
73  ac->stepType = 0;
74  }
75  }
76  break;
77 
78  case AC_LIN:
79  if (value->iValue) {
80  ac->stepType = LINEAR;
81  }
82  else {
83  if (ac->stepType == LINEAR) {
84  ac->stepType = 0;
85  }
86  }
87  break;
88 
89  default:
90  return (E_BADPARM);
91  }
92  return (OK);
93 }
94 
95 
96 
97 static IFparm ACparms[] = {
98  { "start", AC_START, IFP|IF_REAL, "starting frequency" },
99  { "stop", AC_STOP, IFP|IF_REAL, "ending frequency" },
100  { "numsteps", AC_STEPS, IFP|IF_INTEGER, "number of frequencies"},
101  { "dec", AC_DEC, IFP|IF_FLAG, "step by decades" },
102  { "oct", AC_OCT, IFP|IF_FLAG, "step by octaves" },
103  { "lin", AC_LIN, IFP|IF_FLAG, "step linearly" },
104  { "name1", DC_NAME1, IFP|IF_INSTANCE, "name of source to step" },
105  { "start1", DC_START1, IFP|IF_REAL, "starting voltage/current"},
106  { "stop1", DC_STOP1, IFP|IF_REAL, "ending voltage/current" },
107  { "step1", DC_STEP1, IFP|IF_REAL, "voltage/current step" },
108  { "name2", DC_NAME2, IFP|IF_INSTANCE, "name of source to step" },
109  { "start2", DC_START2, IFP|IF_REAL, "starting voltage/current"},
110  { "stop2", DC_STOP2, IFP|IF_REAL, "ending voltage/current" },
111  { "step2", DC_STEP2, IFP|IF_REAL, "voltage/current step" }
112 };
113 
115  {
116  "AC",
117  "A.C. Small signal analysis",
118 
119  sizeof(ACparms)/sizeof(IFparm),
120  ACparms
121  },
122  sizeof(ACAN),
124  ACparse,
125  ACsetParm,
126  ACaskQuest,
127  ACan
128 };
#define AC_STOP
Definition: analysis.h:56
#define AC_START
Definition: analysis.h:55
int ACaskQuest()
#define DC_STOP1
Definition: analysis.h:19
struct sACprms AC
Definition: acdefs.h:20
int ACparse()
#define DC_START1
Definition: analysis.h:18
struct sDCTprms DC
Definition: acdefs.h:21
#define AC_OCT
Definition: analysis.h:53
#define E_BADPARM
Definition: iferrmsg.h:26
int ACan()
#define OCTAVE
Definition: analysis.h:48
#define IF_INSTANCE
Definition: ifsim.h:112
int iValue
Definition: ifsim.h:232
double rValue
Definition: ifsim.h:233
#define AC_LIN
Definition: analysis.h:54
static IFparm ACparms[]
Definition: acsetp.c:97
#define DC_NAME2
Definition: analysis.h:21
#define OK
Definition: iferrmsg.h:17
#define AC_STEPS
Definition: analysis.h:57
#define IFP
Definition: analysis.h:10
#define DC_STEP1
Definition: analysis.h:20
#define IF_INTEGER
Definition: ifsim.h:107
#define LINEAR
Definition: analysis.h:49
int ACsetParm(GENERIC *cktp, GENERIC *anal, int which, IFvalue *value)
Definition: acsetp.c:18
Definition: acdefs.h:15
#define DC_NAME1
Definition: analysis.h:17
Definition: ifsim.h:54
#define IF_REAL
Definition: ifsim.h:108
#define FREQUENCYDOMAIN
Definition: jobdefs.h:34
#define IF_FLAG
Definition: ifsim.h:106
#define AC_DEC
Definition: analysis.h:52
int ACsetp(struct sACprms *ac, int which, IFvalue *value)
Definition: acsetp.c:36
#define DECADE
Definition: analysis.h:47
#define DC_START2
Definition: analysis.h:22
#define DC_STOP2
Definition: analysis.h:23
#define DC_STEP2
Definition: analysis.h:24
SPICEanalysis ACinfo
Definition: acsetp.c:114
char GENERIC
Definition: ifsim.h:27
int DCTsetp()