From 598b4c6b83b7af013f1c28bd023bdabefe334906 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 27 Feb 2011 20:39:03 +0000 Subject: [PATCH] vsrc, isrc, cleanup aiming for more similarity --- ChangeLog | 5 ++++ src/spicelib/devices/isrc/isrcacct.c | 24 +++++---------- src/spicelib/devices/isrc/isrcask.c | 3 +- src/spicelib/devices/isrc/isrcdefs.h | 16 +++++----- src/spicelib/devices/isrc/isrcload.c | 44 +++++++++++++++------------- src/spicelib/devices/isrc/isrcmdel.c | 4 +-- src/spicelib/devices/isrc/isrcpar.c | 6 ++-- src/spicelib/devices/isrc/isrctemp.c | 7 +++-- src/spicelib/devices/vsrc/vsrcacct.c | 7 ++--- src/spicelib/devices/vsrc/vsrcacld.c | 2 -- src/spicelib/devices/vsrc/vsrcask.c | 5 ++-- src/spicelib/devices/vsrc/vsrcdefs.h | 10 +++---- src/spicelib/devices/vsrc/vsrcext.h | 2 +- src/spicelib/devices/vsrc/vsrcitf.h | 2 +- src/spicelib/devices/vsrc/vsrcload.c | 39 ++++++++++++------------ src/spicelib/devices/vsrc/vsrcpar.c | 5 ++-- 16 files changed, 90 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ad945389..d5f36d743 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-02-27 Robert Larice + * src/spicelib/devices/isrc/* , + * src/spicelib/devices/vsrc/* : + vsrc, isrc, cleanup aiming for more similarity + 2011-02-27 Robert Larice * src/spicelib/devices/isrc/isrc.c , * src/spicelib/devices/vsrc/vsrc.c : diff --git a/src/spicelib/devices/isrc/isrcacct.c b/src/spicelib/devices/isrc/isrcacct.c index 76f64f5eb..511c8de7f 100644 --- a/src/spicelib/devices/isrc/isrcacct.c +++ b/src/spicelib/devices/isrc/isrcacct.c @@ -17,6 +17,9 @@ extern void fftFree(void); extern void rffts(float *data, long M, long Rows); extern double exprand(double); +#define SAMETIME(a,b) (fabs((a)-(b))<= TIMETOL * PW) +#define TIMETOL 1e-7 + int ISRCaccept(CKTcircuit *ckt, GENmodel *inModel) /* set up the breakpoint table. */ @@ -44,9 +47,6 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel) case PULSE: { -#define SAMETIME(a,b) (fabs((a)-(b))<= TIMETOL * PW) -#define TIMETOL 1e-7 - double TD, TR, TF, PW, PER; /* gtri - begin - wbk - add PHASE parameter */ @@ -106,49 +106,39 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel) if( time <= 0.0 || time >= TR + PW + TF) { if(ckt->CKTbreak && SAMETIME(time,0.0)) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + TR + TD); if(error) return(error); } else if(ckt->CKTbreak && SAMETIME(TR+PW+TF,time) ) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + PER + TD); if(error) return(error); } else if (ckt->CKTbreak && (time == -TD) ) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + TD); if(error) return(error); } else if (ckt->CKTbreak && SAMETIME(PER,time) ) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + TD + TR + PER); if(error) return(error); } } else if ( time >= TR && time <= TR + PW) { if(ckt->CKTbreak && SAMETIME(time,TR) ) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + TD+TR + PW); if(error) return(error); } else if(ckt->CKTbreak && SAMETIME(TR+PW,time) ) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + TD+TR + PW + TF); if(error) return(error); } } else if (time > 0 && time < TR) { if(ckt->CKTbreak && SAMETIME(time,0) ) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + TD+TR); if(error) return(error); } else if(ckt->CKTbreak && SAMETIME(time,TR)) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + TD+TR + PW); if(error) return(error); } } else { /* time > TR + PW && < TR + PW + TF */ if(ckt->CKTbreak && SAMETIME(time,TR+PW) ) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + TD+TR + PW +TF); if(error) return(error); } else if(ckt->CKTbreak && SAMETIME(time,TR+PW+TF) ) { - /* set next breakpoint */ error = CKTsetBreak(ckt,basetime + TD+PER); if(error) return(error); } @@ -273,10 +263,10 @@ INoi1 1 0 DC 0 TRNOISE(0n 0.5n 1 10n) : generate 1/f noise } break; - } - } + } // switch + } // if ... else bkptset: ; - } - } + } // for + } // for return(OK); } diff --git a/src/spicelib/devices/isrc/isrcask.c b/src/spicelib/devices/isrc/isrcask.c index 13e3f870f..1eb35cc31 100644 --- a/src/spicelib/devices/isrc/isrcask.c +++ b/src/spicelib/devices/isrc/isrcask.c @@ -49,8 +49,7 @@ ISRCask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * case ISRC_TRNOISE: case ISRC_FCN_COEFFS: temp = value->v.numValue = here->ISRCfunctionOrder; - value->v.vec.rVec = TMALLOC(double, here->ISRCfunctionOrder); - v = value->v.vec.rVec; + v = value->v.vec.rVec = TMALLOC(double, here->ISRCfunctionOrder); w = here->ISRCcoeffs; while (temp--) *v++ = *w++; diff --git a/src/spicelib/devices/isrc/isrcdefs.h b/src/spicelib/devices/isrc/isrcdefs.h index 459eae473..e9a62d988 100644 --- a/src/spicelib/devices/isrc/isrcdefs.h +++ b/src/spicelib/devices/isrc/isrcdefs.h @@ -7,14 +7,16 @@ Author: 1985 Thomas L. Quarles #define ISRC #include "ifsim.h" -#include "complex.h" #include "cktdefs.h" #include "gendefs.h" +#include "complex.h" - /* structures used to describe current sources */ +/* + * structures to describe independent current sources + */ -/* information needed per source instance */ +/* information needed for each instance */ typedef struct sISRCinstance { struct sISRCmodel *ISRCmodPtr; /* backpointer to model */ @@ -24,8 +26,8 @@ typedef struct sISRCinstance { int ISRCowner; /* number of owner process */ int ISRCstate; /* not used */ - int ISRCnegNode; /* number of negative node of source */ int ISRCposNode; /* number of positive node of source */ + int ISRCnegNode; /* number of negative node of source */ int ISRCfunctionType; /* code number of function type for source */ int ISRCfunctionOrder; /* order of the function for the source */ @@ -34,8 +36,8 @@ typedef struct sISRCinstance { double ISRCdcValue; /* DC and TRANSIENT value of source */ double ISRCacPhase; /* AC phase angle */ double ISRCacMag; /* AC magnitude */ - double ISRCacReal; /* AC real part */ - double ISRCacImag; /* AC imaginary */ + double ISRCacReal; /* AC real component */ + double ISRCacImag; /* AC imaginary component */ double ISRCdF1mag; /* distortion f1 magnitude */ double ISRCdF2mag; /* distortion f2 magnitude */ @@ -65,7 +67,7 @@ typedef struct sISRCinstance { /* per model data */ -typedef struct sISRCmodel { /* model structure for a resistor */ +typedef struct sISRCmodel { int ISRCmodType; /* type index of this device type */ struct sISRCmodel *ISRCnextModel; /* pointer to next possible model *in linked list */ diff --git a/src/spicelib/devices/isrc/isrcload.c b/src/spicelib/devices/isrc/isrcload.c index fc0a61d3d..7b2a04129 100644 --- a/src/spicelib/devices/isrc/isrcload.c +++ b/src/spicelib/devices/isrc/isrcload.c @@ -14,13 +14,15 @@ $Id$ #include "1-f-code.h" #ifdef XSPICE_EXP +/* gtri - begin - wbk - modify for supply ramping option */ #include "cmproto.h" +/* gtri - end - wbk - modify for supply ramping option */ #endif int ISRCload(GENmodel *inModel, CKTcircuit *ckt) - /* actually load the current current value into the - * sparse matrix previously provided + /* actually load the current value into the + * sparse matrix previously provided */ { ISRCmodel *model = (ISRCmodel*)inModel; @@ -28,7 +30,7 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) double value; double time; - /* loop through all the current source models */ + /* loop through all the source models */ for( ; model != NULL; model = model->ISRCnextModel ) { /* loop through all the instances of the model */ @@ -51,9 +53,16 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) } else { time = ckt->CKTtime; } - /* use transient function */ + /* use the transient functions */ switch(here->ISRCfunctionType) { + default: +#ifdef XSPICE_EXP + value = here->ISRCdcValue; +#else + value = here->ISRCdcValue * ckt->CKTsrcFact; +#endif + break; case PULSE: { double V1, V2, TD, TR, TF, PW, PER; double basetime = 0; @@ -221,11 +230,11 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) value = VO + VA * sin((2.0 * M_PI * FC * time + phasec) + MDI * sin(2.0 * M_PI * FS * time + phases)); -#else /* XSPICE */ +#else value = VO + VA * sin((2.0 * M_PI * FC * time) + MDI * sin(2.0 * M_PI * FS * time)); -#endif /* XSPICE */ +#endif /* gtri - end - wbk - add PHASE parameters */ } @@ -270,11 +279,11 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) #ifdef XSPICE /* compute waveform value */ value = VA * (VO + sin(2.0 * M_PI * MF * time + phases )) * - sin(2 * M_PI * FC * time + phases); + sin(2.0 * M_PI * FC * time + phases); -#else /* XSPICE */ +#else value = VA * (VO + sin(2.0 * M_PI * MF * time)) * - sin(2 * M_PI * FC * time); + sin(2.0 * M_PI * FC * time); #endif } @@ -282,14 +291,6 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) } break; - default: -#ifdef XSPICE_EXP - value = here->ISRCdcValue; -#else - value = here->ISRCdcValue * ckt->CKTsrcFact; -#endif - break; - case PWL: { int i; if(time< *(here->ISRCcoeffs)) { @@ -352,7 +353,7 @@ INoi1 1 0 DC 0 TRNOISE(0n 0.5n 1 10n) : generate 1/f noise /* DC value */ if(here -> ISRCdcGiven) value += here->ISRCdcValue; - } // case + } break; } // switch @@ -365,7 +366,8 @@ loadDone: value *= cm_analog_ramp_factor(); #else - if (ckt->CKTmode & MODETRANOP) value *= ckt->CKTsrcFact; + if (ckt->CKTmode & MODETRANOP) + value *= ckt->CKTsrcFact; #endif /* gtri - end - wbk - modify for supply ramping option */ @@ -379,7 +381,7 @@ loadDone: here->ISRCcurrent = value; /* gtri - end - wbk - record value so it can be output if requested */ #endif - } - } + } // for loop instances + } // for loop models return(OK); } diff --git a/src/spicelib/devices/isrc/isrcmdel.c b/src/spicelib/devices/isrc/isrcmdel.c index bcdad1451..2e0d60539 100644 --- a/src/spicelib/devices/isrc/isrcmdel.c +++ b/src/spicelib/devices/isrc/isrcmdel.c @@ -12,10 +12,10 @@ Author: 1985 Thomas L. Quarles int -ISRCmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) +ISRCmDelete(GENmodel **inModel, IFuid modname, GENmodel *fast) { ISRCmodel **model = (ISRCmodel**)inModel; - ISRCmodel *modfast = (ISRCmodel*)kill; + ISRCmodel *modfast = (ISRCmodel *) fast; ISRCinstance *here; ISRCinstance *prev = NULL; ISRCmodel **oldmod; diff --git a/src/spicelib/devices/isrc/isrcpar.c b/src/spicelib/devices/isrc/isrcpar.c index 37c0e3aec..42cc809cd 100644 --- a/src/spicelib/devices/isrc/isrcpar.c +++ b/src/spicelib/devices/isrc/isrcpar.c @@ -94,7 +94,7 @@ ISRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select) here->ISRCfuncTGiven = TRUE; copy_coeffs(here, value); - for (i=0;i<((here->ISRCfunctionOrder/2)-1);i++) { + for (i=0; i<(here->ISRCfunctionOrder/2)-1; i++) { if (*(here->ISRCcoeffs+2*(i+1))<=*(here->ISRCcoeffs+2*i)) { fprintf(stderr, "Warning : current source %s", here->ISRCname); @@ -175,10 +175,10 @@ ISRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select) TS = here->ISRCcoeffs[1]; // time step if (here->ISRCfunctionOrder > 2) - NALPHA = here->ISRCcoeffs[2]; + NALPHA = here->ISRCcoeffs[2]; // 1/f exponent if (here->ISRCfunctionOrder > 3 && NALPHA != 0.0) - NAMP = here->ISRCcoeffs[3]; + NAMP = here->ISRCcoeffs[3]; // 1/f amplitude if (here->ISRCfunctionOrder > 4) RTSAM = here->ISRCcoeffs[4]; // RTS amplitude diff --git a/src/spicelib/devices/isrc/isrctemp.c b/src/spicelib/devices/isrc/isrctemp.c index cc8345521..c96d2f807 100644 --- a/src/spicelib/devices/isrc/isrctemp.c +++ b/src/spicelib/devices/isrc/isrctemp.c @@ -13,6 +13,8 @@ Author: 1985 Thomas L. Quarles /*ARGSUSED*/ int ISRCtemp(GENmodel *inModel, CKTcircuit *ckt) + /* Pre-process voltage source parameters + */ { ISRCmodel *model = (ISRCmodel*)inModel; ISRCinstance *here; @@ -20,6 +22,7 @@ ISRCtemp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); + /* loop through all the voltage source models */ for( ; model != NULL; model = model->ISRCnextModel ) { /* loop through all the instances of the model */ @@ -37,11 +40,11 @@ ISRCtemp(GENmodel *inModel, CKTcircuit *ckt) /* no DC value - either have a transient value, or none */ if(here->ISRCfuncTGiven) { (*(SPfrontEnd->IFerror))(ERR_WARNING, - "Source %s has no DC value, transient time 0 value used", + "%s: no DC value, transient time 0 value used", &(here->ISRCname)); } else { (*(SPfrontEnd->IFerror))(ERR_WARNING, - "Source %s has no value, DC 0 assumed\n", + "%s: has no value, DC 0 assumed", &(here->ISRCname)); } } diff --git a/src/spicelib/devices/vsrc/vsrcacct.c b/src/spicelib/devices/vsrc/vsrcacct.c index ff2064865..582cc1319 100644 --- a/src/spicelib/devices/vsrc/vsrcacct.c +++ b/src/spicelib/devices/vsrc/vsrcacct.c @@ -22,8 +22,7 @@ extern double exprand(double); int VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) - /* set up the breakpoint table. - */ + /* set up the breakpoint table. */ { VSRCmodel *model = (VSRCmodel *)inModel; VSRCinstance *here; @@ -101,8 +100,8 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) time -= basetime; } - if( time <= 0 || time >= TR + PW + TF) { - if(ckt->CKTbreak && SAMETIME(time,0)) { + if( time <= 0.0 || time >= TR + PW + TF) { + if(ckt->CKTbreak && SAMETIME(time,0.0)) { error = CKTsetBreak(ckt,basetime + TR + tshift); if(error) return(error); } else if(ckt->CKTbreak && SAMETIME(TR+PW+TF,time) ) { diff --git a/src/spicelib/devices/vsrc/vsrcacld.c b/src/spicelib/devices/vsrc/vsrcacld.c index 065bde2f1..8adedc997 100644 --- a/src/spicelib/devices/vsrc/vsrcacld.c +++ b/src/spicelib/devices/vsrc/vsrcacld.c @@ -2,8 +2,6 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles **********/ -/* - */ #include "ngspice.h" #include "cktdefs.h" diff --git a/src/spicelib/devices/vsrc/vsrcask.c b/src/spicelib/devices/vsrc/vsrcask.c index 3183b9dfb..730e5567c 100644 --- a/src/spicelib/devices/vsrc/vsrcask.c +++ b/src/spicelib/devices/vsrc/vsrcask.c @@ -24,8 +24,8 @@ int VSRCask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *select) { VSRCinstance *here = (VSRCinstance*)inst; - int temp; static char *msg = "Current and power not available in ac analysis"; + int temp; double *v, *w; NG_IGNORE(select); @@ -52,9 +52,8 @@ VSRCask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * temp = value->v.numValue = here->VSRCfunctionOrder; v = value->v.vec.rVec = TMALLOC(double, here->VSRCfunctionOrder); w = here->VSRCcoeffs; - while (temp--) { + while (temp--) *v++ = *w++; - } return (OK); case VSRC_AC: value->v.numValue = 2; diff --git a/src/spicelib/devices/vsrc/vsrcdefs.h b/src/spicelib/devices/vsrc/vsrcdefs.h index 2a50d3a1a..de240e3a3 100644 --- a/src/spicelib/devices/vsrc/vsrcdefs.h +++ b/src/spicelib/devices/vsrc/vsrcdefs.h @@ -28,8 +28,8 @@ typedef struct sVSRCinstance { int VSRCowner; /* number of owner process */ int VSRCstate; /* not used */ - int VSRCposNode; /* number of positive node of resistor */ - int VSRCnegNode; /* number of negative node of resistor */ + int VSRCposNode; /* number of positive node of source */ + int VSRCnegNode; /* number of negative node of source */ int VSRCbranch; /* equation number of branch equation added for source */ @@ -72,9 +72,9 @@ typedef struct sVSRCinstance { unsigned VSRCacPGiven :1 ; /* flag to indicate ac phase given */ unsigned VSRCfuncTGiven :1 ; /* flag to indicate function type given */ unsigned VSRCcoeffsGiven :1 ; /* flag to indicate function coeffs given */ - unsigned VSRCdGiven :1 ; /* flag to indicate source is a disto input */ - unsigned VSRCdF1given :1; /* flag to indicate source is an f1 dist input */ - unsigned VSRCdF2given :1; /* flag to indicate source is an f2 dist input */ + unsigned VSRCdGiven :1 ; /* flag to indicate source is a distortion input */ + unsigned VSRCdF1given :1 ; /* flag to indicate source is an f1 distortion input */ + unsigned VSRCdF2given :1 ; /* flag to indicate source is an f2 distortion input */ unsigned VSRCrGiven :1; /* flag to indicate repeating pwl */ } VSRCinstance ; diff --git a/src/spicelib/devices/vsrc/vsrcext.h b/src/spicelib/devices/vsrc/vsrcext.h index e4b4caf63..0bbf1c62e 100644 --- a/src/spicelib/devices/vsrc/vsrcext.h +++ b/src/spicelib/devices/vsrc/vsrcext.h @@ -3,8 +3,8 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles **********/ -extern int VSRCacLoad(GENmodel*,CKTcircuit*); extern int VSRCaccept(CKTcircuit*,GENmodel *); +extern int VSRCacLoad(GENmodel*,CKTcircuit*); extern int VSRCask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*); extern int VSRCdelete(GENmodel*,IFuid,GENinstance**); extern void VSRCdestroy(GENmodel**); diff --git a/src/spicelib/devices/vsrc/vsrcitf.h b/src/spicelib/devices/vsrc/vsrcitf.h index 6792ee39d..d7a1cb481 100644 --- a/src/spicelib/devices/vsrc/vsrcitf.h +++ b/src/spicelib/devices/vsrc/vsrcitf.h @@ -4,6 +4,6 @@ Copyright 1990 Regents of the University of California. All rights reserved. #ifndef DEV_VSRC #define DEV_VSRC -SPICEdev *get_vsrc_info(void); +extern SPICEdev *get_vsrc_info(void); #endif diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index 7971b58d2..0efa47341 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -17,12 +17,12 @@ $Id$ /* gtri - begin - wbk - modify for supply ramping option */ #include "cmproto.h" /* gtri - end - wbk - modify for supply ramping option */ -#endif /* XSPICE_EXP */ +#endif int VSRCload(GENmodel *inModel, CKTcircuit *ckt) - /* actually load the current voltage value into the - * sparse matrix previously provided + /* actually load the current value into the + * sparse matrix previously provided */ { VSRCmodel *model = (VSRCmodel *)inModel; @@ -30,7 +30,7 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) double time; double value = 0.0; - /* loop through all the voltage source models */ + /* loop through all the source models */ for( ; model != NULL; model = model->VSRCnextModel ) { /* loop through all the instances of the model */ @@ -44,11 +44,12 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) *(here->VSRCibrNegptr) -= 1.0 ; if( (ckt->CKTmode & (MODEDCOP | MODEDCTRANCURVE)) && here->VSRCdcGiven ) { - /* grab dc value */ + /* load using DC value */ #ifdef XSPICE_EXP +/* gtri - begin - wbk - modify to process srcFact, etc. for all sources */ value = here->VSRCdcValue; #else - value = ckt->CKTsrcFact * here->VSRCdcValue; + value = here->VSRCdcValue * ckt->CKTsrcFact; #endif } else { if(ckt->CKTmode & (MODEDC)) { @@ -58,10 +59,9 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) } /* use the transient functions */ switch(here->VSRCfunctionType) { - default: { /* no function specified: use the DC value */ + default: value = here->VSRCdcValue; break; - } case PULSE: { double V1, V2, TD, TR, TF, PW, PER; @@ -161,7 +161,7 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) value = VO; } else { value = VO + VA * sin(FREQ * time * 2.0 * M_PI) * - exp(-(time*THETA)); + exp(-time*THETA); #endif /* gtri - end - wbk - add PHASE parameter */ } @@ -229,13 +229,13 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) #ifdef XSPICE /* compute waveform value */ value = VO + VA * - sin((2 * M_PI * FC * time + phasec) + + sin((2.0 * M_PI * FC * time + phasec) + MDI * sin(2.0 * M_PI * FS * time + phases)); -#else /* XSPICE */ +#else value = VO + VA * sin((2.0 * M_PI * FC * time) + - MDI * sin(2 * M_PI * FS * time)); -#endif /* XSPICE */ + MDI * sin(2.0 * M_PI * FS * time)); +#endif /* gtri - end - wbk - add PHASE parameters */ } break; @@ -276,11 +276,11 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) #ifdef XSPICE /* compute waveform value */ value = VA * (VO + sin(2.0 * M_PI * MF * time + phases )) * - sin(2 * M_PI * FC * time + phases); + sin(2.0 * M_PI * FC * time + phases); -#else /* XSPICE */ +#else value = VA * (VO + sin(2.0 * M_PI * MF * time)) * - sin(2 * M_PI * FC * time); + sin(2.0 * M_PI * FC * time); #endif } @@ -367,7 +367,7 @@ VNoi3 3 0 DC 0 TRNOISE(0 0 0 0 15m 22u 50u) : generate RTS noise /* DC value */ if(here -> VSRCdcGiven) value += here->VSRCdcValue; - } // case + } break; case TRRANDOM: { @@ -380,14 +380,15 @@ VNoi3 3 0 DC 0 TRNOISE(0 0 0 0 15m 22u 50u) : generate RTS noise break; } // switch - } + } // else (line 48) loadDone: /* gtri - begin - wbk - modify for supply ramping option */ #ifdef XSPICE_EXP value *= ckt->CKTsrcFact; value *= cm_analog_ramp_factor(); #else - if (ckt->CKTmode & MODETRANOP) value *= ckt->CKTsrcFact; + if (ckt->CKTmode & MODETRANOP) + value *= ckt->CKTsrcFact; #endif /* gtri - end - wbk - modify to process srcFact, etc. for all sources */ diff --git a/src/spicelib/devices/vsrc/vsrcpar.c b/src/spicelib/devices/vsrc/vsrcpar.c index c6441a587..1522cb7ac 100644 --- a/src/spicelib/devices/vsrc/vsrcpar.c +++ b/src/spicelib/devices/vsrc/vsrcpar.c @@ -7,8 +7,8 @@ Modified: 2000 AlansFixes */ #include "ngspice.h" -#include "vsrcdefs.h" #include "ifsim.h" +#include "vsrcdefs.h" #include "sperror.h" #include "suffix.h" #include "1-f-code.h" @@ -127,7 +127,8 @@ VSRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select) return ( E_PARMVAL ); } - break; } + break; + } case VSRC_SFFM: if(value->v.numValue < 2) return(E_BADPARM);