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 "dctdefs.h"
12 #include "jobdefs.h"
13 #include "iferrmsg.h"
14 #include "util.h"
15 
16 
17 /* ARGSUSED */
18 int
DCTsetParm(cktp,anal,which,value)19 DCTsetParm(cktp,anal,which,value)
20 
21 GENERIC *cktp;
22 GENERIC *anal;
23 int which;
24 IFvalue *value;
25 {
26     DCTAN *job = (DCTAN *) anal;
27 
28     if (DCTsetp(&job->DC,which,value) == OK)
29         return (OK);
30     return (E_BADPARM);
31 }
32 
33 
34 int
DCTsetp(dc,which,value)35 DCTsetp(dc,which,value)
36 
37 struct sDCTprms *dc;
38 int which;
39 IFvalue *value;
40 {
41     switch (which) {
42 
43         case DC_NAME1:
44             dc->nestLevel = 0;
45             dc->eltName[0] = value->uValue;
46             break;
47 
48         case DC_START1:
49             dc->vstart[0] = value->rValue;
50             break;
51 
52         case DC_STOP1:
53             dc->vstop[0] = value->rValue;
54             break;
55 
56         case DC_STEP1:
57             dc->vstep[0] = value->rValue;
58             break;
59 
60         case DC_NAME2:
61             dc->eltName[1] = value->uValue;
62             break;
63 
64         case DC_START2:
65             dc->vstart[1] = value->rValue;
66             break;
67 
68         case DC_STOP2:
69             dc->vstop[1] = value->rValue;
70             break;
71 
72         case DC_STEP2:
73             dc->vstep[1] = value->rValue;
74             dc->nestLevel = 1;
75             break;
76 
77         default:
78             return (E_BADPARM);
79     }
80     return (OK);
81 }
82 
83 
84 static IFparm DCTparms[] = {
85  { "name1",  DC_NAME1,  IFP|IF_INSTANCE, "name of source to step" },
86  { "start1", DC_START1, IFP|IF_REAL,     "starting voltage/current"},
87  { "stop1",  DC_STOP1,  IFP|IF_REAL,     "ending voltage/current" },
88  { "step1",  DC_STEP1,  IFP|IF_REAL,     "voltage/current step" },
89  { "name2",  DC_NAME2,  IFP|IF_INSTANCE, "name of source to step" },
90  { "start2", DC_START2, IFP|IF_REAL,     "starting voltage/current"},
91  { "stop2",  DC_STOP2,  IFP|IF_REAL,     "ending voltage/current" },
92  { "step2",  DC_STEP2,  IFP|IF_REAL,     "voltage/current step" }
93 };
94 
95 
96 SPICEanalysis DCTinfo  = {
97     {
98         "DCTransfer",
99         "D.C. Transfer curve analysis",
100 
101         sizeof(DCTparms)/sizeof(IFparm),
102         DCTparms
103     },
104     sizeof(DCTAN),
105     SWEEPDOMAIN,
106     DCTparse,
107     DCTsetParm,
108     DCTaskQuest,
109     DCTan
110 };
111