Browse Source
initial PSS commit
initial PSS commit
16 changed files with 1853 additions and 2 deletions
-
21ChangeLog
-
12src/frontend/commands.c
-
9src/frontend/runcoms.c
-
3src/frontend/runcoms.h
-
46src/frontend/shyu.c
-
8src/frontend/spiceif.c
-
1src/include/Makefile.am
-
15src/include/cktdefs.h
-
38src/include/pssdefs.h
-
4src/spicelib/analysis/Makefile.am
-
5src/spicelib/analysis/analysis.c
-
1455src/spicelib/analysis/dcpss.c
-
52src/spicelib/analysis/pssaskq.c
-
33src/spicelib/analysis/pssinit.c
-
81src/spicelib/analysis/psssetp.c
-
72src/spicelib/parser/inp2dot.c
@ -0,0 +1,38 @@ |
|||
/********** |
|||
Author: 2010-05 Stefano Perticaroli ``spertica'' |
|||
**********/ |
|||
|
|||
#ifndef PSS |
|||
#define PSS |
|||
|
|||
#include "jobdefs.h" |
|||
#include "tskdefs.h" |
|||
/* |
|||
* PSSdefs.h - defs for pss analyses |
|||
*/ |
|||
|
|||
typedef struct { |
|||
int JOBtype; |
|||
JOB *JOBnextJob; |
|||
char *JOBname; |
|||
double PSSguessedFreq; |
|||
CKTnode *PSSoscNode; |
|||
double PSSstabTime; |
|||
long PSSmode; |
|||
long int PSSpoints; |
|||
int PSSharms; |
|||
void *PSSplot_td; |
|||
void *PSSplot_fd; |
|||
int sc_iter; |
|||
double steady_coeff; |
|||
} PSSan; |
|||
|
|||
#define GUESSED_FREQ 1 |
|||
#define STAB_TIME 2 |
|||
#define OSC_NODE 3 |
|||
#define PSS_POINTS 4 |
|||
#define PSS_HARMS 5 |
|||
#define PSS_UIC 6 |
|||
#define SC_ITER 7 |
|||
#define STEADY_COEFF 8 |
|||
#endif /*PSS*/ |
|||
1455
src/spicelib/analysis/dcpss.c
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,52 @@ |
|||
/********** |
|||
Author: 2010-05 Stefano Perticaroli ``spertica'' |
|||
**********/ |
|||
|
|||
#include "ngspice.h" |
|||
#include "ifsim.h" |
|||
#include "iferrmsg.h" |
|||
#include "cktdefs.h" |
|||
#include "pssdefs.h" |
|||
|
|||
/* ARGSUSED */ |
|||
int |
|||
PSSaskQuest(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value) |
|||
{ |
|||
NG_IGNORE(ckt); |
|||
|
|||
switch(which) { |
|||
|
|||
case GUESSED_FREQ: |
|||
value->rValue = ((PSSan *)anal)->PSSguessedFreq; |
|||
break; |
|||
case OSC_NODE: |
|||
value->nValue = ((PSSan *)anal)->PSSoscNode; |
|||
break; |
|||
case STAB_TIME: |
|||
value->rValue = ((PSSan *)anal)->PSSstabTime; |
|||
break; |
|||
case PSS_UIC: |
|||
if(((PSSan *)anal)->PSSmode & MODEUIC) { |
|||
value->iValue = 1; |
|||
} else { |
|||
value->iValue = 0; |
|||
} |
|||
break; |
|||
case PSS_POINTS: |
|||
value->iValue = ((PSSan *)anal)->PSSpoints; |
|||
break; |
|||
case PSS_HARMS: |
|||
value->iValue = ((PSSan *)anal)->PSSharms; |
|||
break; |
|||
case SC_ITER: |
|||
value->iValue = ((PSSan *)anal)->sc_iter; |
|||
break; |
|||
case STEADY_COEFF: |
|||
value->rValue = ((PSSan *)anal)->steady_coeff; |
|||
break; |
|||
|
|||
default: |
|||
return(E_BADPARM); |
|||
} |
|||
return(OK); |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
/********** |
|||
Author: 2010-05 Stefano Perticaroli ``spertica'' |
|||
**********/ |
|||
|
|||
#include "ngspice.h" |
|||
#include "cktdefs.h" |
|||
#include "trandefs.h" |
|||
#include "pssdefs.h" |
|||
#include "iferrmsg.h" |
|||
|
|||
int PSSinit(CKTcircuit *ckt, JOB *job) |
|||
{ |
|||
/* Final time depends on stabilization time requested for PSS |
|||
and on at least one more oscillation period */ |
|||
ckt->CKTfinalTime = ((PSSan*)job)->PSSstabTime + 2/((PSSan*)job)->PSSguessedFreq; |
|||
/* Step is chosen empirically to be 1% of PSSguessedFreq */ |
|||
ckt->CKTstep = 0.01 * (1/((PSSan*)job)->PSSguessedFreq); |
|||
/* Init time should be always zero */ |
|||
ckt->CKTinitTime = 0; |
|||
/* MaxStep should not exceed Nyquist criterion */ |
|||
ckt->CKTmaxStep = 0.5*(1/((PSSan*)job)->PSSguessedFreq); |
|||
ckt->CKTdelmin = 1e-9*ckt->CKTmaxStep; |
|||
ckt->CKTmode = ((PSSan*)job)->PSSmode; |
|||
/* modified CKTdefs.h for the following - 100609 */ |
|||
ckt->CKTstabTime = ((PSSan*)job)->PSSstabTime; |
|||
ckt->CKTguessedFreq = ((PSSan*)job)->PSSguessedFreq; |
|||
ckt->CKTharms = ((PSSan*)job)->PSSharms; |
|||
ckt->CKTpsspoints = ((PSSan*)job)->PSSpoints; |
|||
ckt->CKTsc_iter = ((PSSan*)job)->sc_iter; |
|||
ckt->CKTsteady_coeff = ((PSSan*)job)->steady_coeff; |
|||
|
|||
return OK; |
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
/********** |
|||
Author: 2010-05 Stefano Perticaroli ``spertica'' |
|||
**********/ |
|||
|
|||
#include "ngspice.h" |
|||
#include "ifsim.h" |
|||
#include "iferrmsg.h" |
|||
#include "cktdefs.h" |
|||
#include "pssdefs.h" |
|||
|
|||
#include "analysis.h" |
|||
|
|||
/* ARGSUSED */ |
|||
int |
|||
PSSsetParm(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value) |
|||
{ |
|||
NG_IGNORE(ckt); |
|||
|
|||
switch(which) { |
|||
|
|||
case GUESSED_FREQ: |
|||
((PSSan *)anal)->PSSguessedFreq = value->rValue; |
|||
break; |
|||
case OSC_NODE: |
|||
((PSSan *)anal)->PSSoscNode = value->nValue; |
|||
break; |
|||
case STAB_TIME: |
|||
((PSSan *)anal)->PSSstabTime = value->rValue; |
|||
break; |
|||
case PSS_POINTS: |
|||
((PSSan *)anal)->PSSpoints = value->iValue; |
|||
break; |
|||
case PSS_HARMS: |
|||
((PSSan *)anal)->PSSharms = value->iValue; |
|||
break; |
|||
case PSS_UIC: |
|||
if(value->iValue) { |
|||
((PSSan *)anal)->PSSmode |= MODEUIC; |
|||
} |
|||
break; |
|||
case SC_ITER: |
|||
((PSSan *)anal)->sc_iter = value->iValue; |
|||
break; |
|||
case STEADY_COEFF: |
|||
((PSSan *)anal)->steady_coeff = value->rValue; |
|||
break; |
|||
|
|||
default: |
|||
return(E_BADPARM); |
|||
} |
|||
return(OK); |
|||
} |
|||
|
|||
|
|||
static IFparm PSSparms[] = { |
|||
{ "fguess", GUESSED_FREQ, IF_SET|IF_REAL, "guessed frequency" }, |
|||
{ "oscnode", OSC_NODE, IF_SET|IF_STRING, "oscillation node" }, |
|||
{ "stabtime", STAB_TIME, IF_SET|IF_REAL, "stabilization time" }, |
|||
{ "points", PSS_POINTS, IF_SET|IF_INTEGER, "pick equispaced number of time points in PSS" }, |
|||
{ "harmonics", PSS_HARMS, IF_SET|IF_INTEGER, "consider only given number of harmonics in PSS from DC" }, |
|||
{ "uic", PSS_UIC, IF_SET|IF_INTEGER, "use initial conditions (1 true - 0 false)" }, |
|||
{ "sc_iter", SC_ITER, IF_SET|IF_INTEGER, "maxmimum number of shooting cycle iterations" }, |
|||
{ "steady_coeff", STEADY_COEFF, IF_SET|IF_INTEGER, "set steady coefficient for convergence test" } |
|||
}; |
|||
|
|||
SPICEanalysis PSSinfo = { |
|||
{ |
|||
"PSS", |
|||
"Periodic Steady State analysis", |
|||
|
|||
sizeof(PSSparms)/sizeof(IFparm), |
|||
PSSparms |
|||
}, |
|||
sizeof(PSSan), |
|||
TIMEDOMAIN, |
|||
1, |
|||
PSSsetParm, |
|||
PSSaskQuest, |
|||
PSSinit, |
|||
DCpss |
|||
}; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue