Cleaned up isrc and vsrc code and updated their status into DEVICE file.

This commit is contained in:
pnenzi 2004-01-26 19:51:11 +00:00
parent 7bfe6db9bf
commit 01bbb31d2e
28 changed files with 61 additions and 138 deletions

View File

@ -1,5 +1,10 @@
2004-01-26 Paolo Nenzi <p.nenzi@ieee.org> 2004-01-26 Paolo Nenzi <p.nenzi@ieee.org>
* DEVICES: updated isrc an vsrc status
* src/spicelib/devices{isrc,vsrc}: Cleaned up code
* tests/cider: Added example files for cider simulator. * tests/cider: Added example files for cider simulator.
2004-01-25 Paolo Nenzi <p.nenzi@ieee.org> 2004-01-25 Paolo Nenzi <p.nenzi@ieee.org>

35
DEVICES
View File

@ -168,6 +168,17 @@ CCVS - Current Controlled Voltage Source
Original spice model. Original spice model.
ISRC - Independent Current Source ISRC - Independent Current Source
Initial Release.
Ver: N/A
Class: I
Level: 1 (and only)
Status:
This is the original spice device improved by Alan Gillespie
with the following features:
- Source ramping
- Check for non-monotonic series in PWL
VCCS - Voltage Controlled Current Source VCCS - Voltage Controlled Current Source
@ -189,7 +200,17 @@ VCVS - Voltage Controlled Voltage Source
Original spice model. Original spice model.
VSRC - Independent Voltage Source VSRC - Independent Voltage Source
Initial Release Initial Release.
Ver: N/A
Class: V
Level: 1 (and only)
Status:
This is the original spice device improved by Alan Gillespie
with the following features:
- Source ramping
- Check for non-monotonic series in PWL
*************************************************************************** ***************************************************************************
@ -271,6 +292,18 @@ BJT2 - Bipolar Junction Transistor
- Temperature difference from circuit temperature - Temperature difference from circuit temperature
- Different area parameters for collector, base and emitter - Different area parameters for collector, base and emitter
VBIC - Bipolar Junction Transistor
Initial Release.
Ver: N/A
Class: Q
Level: 4
Status:
This is the VBIC model. Colin mcAndrews ert al.
Spice 3 porting Dietmar Warning
only 3 terminals
no xcess pahse
no other
*************************************************************************** ***************************************************************************
***************************** FET Devices *************************** ***************************** FET Devices ***************************

View File

@ -4,7 +4,6 @@ Author: 1987 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "ifsim.h" #include "ifsim.h"
#include "devdefs.h" #include "devdefs.h"
#include "isrcdefs.h" #include "isrcdefs.h"

View File

@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "isrcdefs.h" #include "isrcdefs.h"
#include "trandefs.h" #include "trandefs.h"
@ -12,9 +11,7 @@ Author: 1985 Thomas L. Quarles
#include "suffix.h" #include "suffix.h"
int int
ISRCaccept(ckt,inModel) ISRCaccept(CKTcircuit *ckt, GENmodel *inModel)
CKTcircuit *ckt;
GENmodel *inModel;
/* set up the breakpoint table. */ /* set up the breakpoint table. */
{ {
ISRCmodel *model = (ISRCmodel*)inModel; ISRCmodel *model = (ISRCmodel*)inModel;

View File

@ -4,16 +4,13 @@ Author: 1985 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "isrcdefs.h" #include "isrcdefs.h"
#include "sperror.h" #include "sperror.h"
#include "suffix.h" #include "suffix.h"
int int
ISRCacLoad(inModel,ckt) ISRCacLoad(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
ISRCmodel *model = (ISRCmodel*)inModel; ISRCmodel *model = (ISRCmodel*)inModel;
ISRCinstance *here; ISRCinstance *here;

View File

@ -11,7 +11,6 @@ Author: 1988 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "devdefs.h" #include "devdefs.h"
#include "ifsim.h" #include "ifsim.h"
@ -22,12 +21,7 @@ Author: 1988 Thomas L. Quarles
/* ARGSUSED */ /* ARGSUSED */
int int
ISRCask(ckt,inst,which,value,select) ISRCask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *select)
CKTcircuit *ckt;
GENinstance *inst;
int which;
IFvalue *value;
IFvalue *select;
{ {
ISRCinstance *here = (ISRCinstance*)inst; ISRCinstance *here = (ISRCinstance*)inst;
static char *msg = "Current and power not available in ac analysis"; static char *msg = "Current and power not available in ac analysis";

View File

@ -6,17 +6,13 @@ Author: 1985 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "isrcdefs.h" #include "isrcdefs.h"
#include "sperror.h" #include "sperror.h"
#include "suffix.h" #include "suffix.h"
int int
ISRCdelete(inModel,name,inst) ISRCdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
GENmodel *inModel;
IFuid name;
GENinstance **inst;
{ {
ISRCmodel *model = (ISRCmodel*)inModel; ISRCmodel *model = (ISRCmodel*)inModel;
ISRCinstance **fast = (ISRCinstance**)inst; ISRCinstance **fast = (ISRCinstance**)inst;

View File

@ -6,14 +6,12 @@ Author: 1985 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "isrcdefs.h" #include "isrcdefs.h"
#include "suffix.h" #include "suffix.h"
void void
ISRCdestroy(inModel) ISRCdestroy(GENmodel **inModel)
GENmodel **inModel;
{ {
ISRCmodel **model = (ISRCmodel**)inModel; ISRCmodel **model = (ISRCmodel**)inModel;
ISRCinstance *here; ISRCinstance *here;

View File

@ -3,7 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
#ifdef __STDC__
extern int ISRCaccept(CKTcircuit*,GENmodel*); extern int ISRCaccept(CKTcircuit*,GENmodel*);
extern int ISRCacLoad(GENmodel*,CKTcircuit*); extern int ISRCacLoad(GENmodel*,CKTcircuit*);
extern int ISRCask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*); extern int ISRCask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
@ -14,15 +13,3 @@ extern int ISRCmDelete(GENmodel**,IFuid,GENmodel*);
extern int ISRCparam(int,IFvalue*,GENinstance*,IFvalue*); extern int ISRCparam(int,IFvalue*,GENinstance*,IFvalue*);
extern int ISRCpzLoad(GENmodel*,CKTcircuit*,SPcomplex*); extern int ISRCpzLoad(GENmodel*,CKTcircuit*,SPcomplex*);
extern int ISRCtemp(GENmodel*,CKTcircuit*); extern int ISRCtemp(GENmodel*,CKTcircuit*);
#else /* stdc */
extern int ISRCaccept();
extern int ISRCacLoad();
extern int ISRCask();
extern int ISRCdelete();
extern void ISRCdestroy();
extern int ISRCload();
extern int ISRCmDelete();
extern int ISRCparam();
extern int ISRCpzLoad();
extern int ISRCtemp();
#endif /* stdc */

View File

@ -5,7 +5,6 @@ Modified: 2000 Alansfixes
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "isrcdefs.h" #include "isrcdefs.h"
#include "trandefs.h" #include "trandefs.h"
@ -13,9 +12,7 @@ Modified: 2000 Alansfixes
#include "suffix.h" #include "suffix.h"
int int
ISRCload(inModel,ckt) ISRCload(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
/* actually load the current current value into the /* actually load the current current value into the
* sparse matrix previously provided * sparse matrix previously provided
*/ */

View File

@ -6,17 +6,13 @@ Author: 1985 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "isrcdefs.h" #include "isrcdefs.h"
#include "sperror.h" #include "sperror.h"
#include "suffix.h" #include "suffix.h"
int int
ISRCmDelete(inModel,modname,kill) ISRCmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
GENmodel **inModel;
IFuid modname;
GENmodel *kill;
{ {
ISRCmodel **model = (ISRCmodel**)inModel; ISRCmodel **model = (ISRCmodel**)inModel;
ISRCmodel *modfast = (ISRCmodel*)kill; ISRCmodel *modfast = (ISRCmodel*)kill;

View File

@ -7,7 +7,6 @@ Modified: 2000 AlansFixes
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "ifsim.h" #include "ifsim.h"
#include "isrcdefs.h" #include "isrcdefs.h"
#include "sperror.h" #include "sperror.h"
@ -16,11 +15,7 @@ Modified: 2000 AlansFixes
/* ARGSUSED */ /* ARGSUSED */
int int
ISRCparam(param,value,inst,select) ISRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
int param;
IFvalue *value;
GENinstance *inst;
IFvalue *select;
{ {
int i; int i;

View File

@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "smpdefs.h" #include "smpdefs.h"
#include "cktdefs.h" #include "cktdefs.h"
#include "isrcdefs.h" #include "isrcdefs.h"
@ -13,9 +12,7 @@ Author: 1985 Thomas L. Quarles
/*ARGSUSED*/ /*ARGSUSED*/
int int
ISRCtemp(inModel,ckt) ISRCtemp(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
ISRCmodel *model = (ISRCmodel*)inModel; ISRCmodel *model = (ISRCmodel*)inModel;
ISRCinstance *here; ISRCinstance *here;

View File

@ -4,7 +4,6 @@ Author: 1987 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "devdefs.h" #include "devdefs.h"
#include "ifsim.h" #include "ifsim.h"
#include "vsrcdefs.h" #include "vsrcdefs.h"

View File

@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "vsrcdefs.h" #include "vsrcdefs.h"
#include "trandefs.h" #include "trandefs.h"
@ -12,9 +11,7 @@ Author: 1985 Thomas L. Quarles
#include "suffix.h" #include "suffix.h"
int int
VSRCaccept(ckt,inModel) VSRCaccept(CKTcircuit *ckt, GENmodel *inModel)
CKTcircuit *ckt;
GENmodel *inModel;
/* set up the breakpoint table. /* set up the breakpoint table.
*/ */
{ {

View File

@ -6,7 +6,6 @@ Author: 1985 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "vsrcdefs.h" #include "vsrcdefs.h"
#include "sperror.h" #include "sperror.h"
@ -14,9 +13,7 @@ Author: 1985 Thomas L. Quarles
int int
VSRCacLoad(inModel,ckt) VSRCacLoad(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
VSRCmodel *model = (VSRCmodel *)inModel; VSRCmodel *model = (VSRCmodel *)inModel;
VSRCinstance *here; VSRCinstance *here;

View File

@ -11,7 +11,6 @@ Author: 1987 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "devdefs.h" #include "devdefs.h"
#include "ifsim.h" #include "ifsim.h"
@ -22,12 +21,7 @@ Author: 1987 Thomas L. Quarles
/* ARGSUSED */ /* ARGSUSED */
int int
VSRCask(ckt,inst,which,value,select) VSRCask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *select)
CKTcircuit *ckt;
GENinstance *inst;
int which;
IFvalue *value;
IFvalue *select;
{ {
VSRCinstance *here = (VSRCinstance*)inst; VSRCinstance *here = (VSRCinstance*)inst;
int temp; int temp;

View File

@ -6,17 +6,13 @@ Author: 1985 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "vsrcdefs.h" #include "vsrcdefs.h"
#include "sperror.h" #include "sperror.h"
#include "suffix.h" #include "suffix.h"
int int
VSRCdelete(inModel,name,inst) VSRCdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
GENmodel *inModel;
IFuid name;
GENinstance **inst;
{ {
VSRCmodel *model = (VSRCmodel *)inModel; VSRCmodel *model = (VSRCmodel *)inModel;
VSRCinstance **fast = (VSRCinstance**)inst; VSRCinstance **fast = (VSRCinstance**)inst;

View File

@ -6,14 +6,12 @@ Author: 1985 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "vsrcdefs.h" #include "vsrcdefs.h"
#include "suffix.h" #include "suffix.h"
void void
VSRCdestroy(inModel) VSRCdestroy(GENmodel **inModel)
GENmodel **inModel;
{ {
VSRCmodel **model = (VSRCmodel**)inModel; VSRCmodel **model = (VSRCmodel**)inModel;
VSRCinstance *here; VSRCinstance *here;

View File

@ -3,7 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
#ifdef __STDC__
extern int VSRCacLoad(GENmodel*,CKTcircuit*); extern int VSRCacLoad(GENmodel*,CKTcircuit*);
extern int VSRCaccept(CKTcircuit*,GENmodel *); extern int VSRCaccept(CKTcircuit*,GENmodel *);
extern int VSRCask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*); extern int VSRCask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
@ -19,20 +18,3 @@ extern int VSRCsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
extern int VSRCunsetup(GENmodel*,CKTcircuit*); extern int VSRCunsetup(GENmodel*,CKTcircuit*);
extern int VSRCpzSetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*); extern int VSRCpzSetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
extern int VSRCtemp(GENmodel*,CKTcircuit*); extern int VSRCtemp(GENmodel*,CKTcircuit*);
#else /* stdc */
extern int VSRCacLoad();
extern int VSRCaccept();
extern int VSRCask();
extern int VSRCdelete();
extern void VSRCdestroy();
extern int VSRCfindBr();
extern int VSRCload();
extern int VSRCmAsk();
extern int VSRCmDelete();
extern int VSRCparam();
extern int VSRCpzLoad();
extern int VSRCsetup();
extern int VSRCunsetup();
extern int VSRCpzSetup();
extern int VSRCtemp();
#endif /* stdc */

View File

@ -6,7 +6,6 @@ Author: 1985 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "vsrcdefs.h" #include "vsrcdefs.h"
#include "sperror.h" #include "sperror.h"
@ -14,10 +13,7 @@ Author: 1985 Thomas L. Quarles
int int
VSRCfindBr(ckt,inModel,name) VSRCfindBr(CKTcircuit *ckt, GENmodel *inModel, IFuid name)
CKTcircuit *ckt;
GENmodel *inModel;
IFuid name;
{ {
VSRCmodel *model = (VSRCmodel *)inModel; VSRCmodel *model = (VSRCmodel *)inModel;
VSRCinstance *here; VSRCinstance *here;

View File

@ -5,7 +5,6 @@ Modified: 2000 AlansFixes
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "vsrcdefs.h" #include "vsrcdefs.h"
#include "trandefs.h" #include "trandefs.h"
@ -13,9 +12,7 @@ Modified: 2000 AlansFixes
#include "suffix.h" #include "suffix.h"
int int
VSRCload(inModel,ckt) VSRCload(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
/* actually load the current voltage value into the /* actually load the current voltage value into the
* sparse matrix previously provided * sparse matrix previously provided
*/ */

View File

@ -6,17 +6,13 @@ Author: 1985 Thomas L. Quarles
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "vsrcdefs.h" #include "vsrcdefs.h"
#include "sperror.h" #include "sperror.h"
#include "suffix.h" #include "suffix.h"
int int
VSRCmDelete(inModel,modname,fast) VSRCmDelete(GENmodel **inModel, IFuid modname, GENmodel *fast)
GENmodel **inModel;
IFuid modname;
GENmodel *fast;
{ {
VSRCmodel **model = (VSRCmodel **)inModel; VSRCmodel **model = (VSRCmodel **)inModel;
VSRCmodel *modfast = (VSRCmodel *)fast; VSRCmodel *modfast = (VSRCmodel *)fast;

View File

@ -7,7 +7,6 @@ Modified: 2000 AlansFixes
*/ */
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "vsrcdefs.h" #include "vsrcdefs.h"
#include "ifsim.h" #include "ifsim.h"
#include "sperror.h" #include "sperror.h"
@ -16,11 +15,7 @@ Modified: 2000 AlansFixes
/* ARGSUSED */ /* ARGSUSED */
int int
VSRCparam(param,value,inst,select) VSRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
int param;
IFvalue *value;
GENinstance *inst;
IFvalue *select;
{ {
int i; int i;
VSRCinstance *here = (VSRCinstance *)inst; VSRCinstance *here = (VSRCinstance *)inst;

View File

@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h" #include "cktdefs.h"
#include "complex.h" #include "complex.h"
#include "sperror.h" #include "sperror.h"
@ -13,10 +12,7 @@ Author: 1985 Thomas L. Quarles
/* ARGSUSED */ /* ARGSUSED */
int int
VSRCpzLoad(inModel,ckt,s) VSRCpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
GENmodel *inModel;
CKTcircuit *ckt;
SPcomplex *s;
{ {
VSRCmodel *model = (VSRCmodel *)inModel; VSRCmodel *model = (VSRCmodel *)inModel;
VSRCinstance *here; VSRCinstance *here;

View File

@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "smpdefs.h" #include "smpdefs.h"
#include "cktdefs.h" #include "cktdefs.h"
#include "vsrcdefs.h" #include "vsrcdefs.h"

View File

@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "smpdefs.h" #include "smpdefs.h"
#include "cktdefs.h" #include "cktdefs.h"
#include "vsrcdefs.h" #include "vsrcdefs.h"
@ -13,11 +12,7 @@ Author: 1985 Thomas L. Quarles
/* ARGSUSED */ /* ARGSUSED */
int int
VSRCsetup(matrix,inModel,ckt,state) VSRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state)
SMPmatrix *matrix;
GENmodel *inModel;
CKTcircuit *ckt;
int *state;
/* load the voltage source structure with those pointers needed later /* load the voltage source structure with those pointers needed later
* for fast matrix loading * for fast matrix loading
*/ */
@ -56,9 +51,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\
} }
int int
VSRCunsetup(inModel,ckt) VSRCunsetup(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
VSRCmodel *model; VSRCmodel *model;
VSRCinstance *here; VSRCinstance *here;

View File

@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "smpdefs.h" #include "smpdefs.h"
#include "cktdefs.h" #include "cktdefs.h"
#include "vsrcdefs.h" #include "vsrcdefs.h"
@ -13,9 +12,7 @@ Author: 1985 Thomas L. Quarles
/* ARGSUSED */ /* ARGSUSED */
int int
VSRCtemp(inModel,ckt) VSRCtemp(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
/* Pre-process voltage source parameters /* Pre-process voltage source parameters
*/ */
{ {