Browse Source

devices/asrc, rewrite #6/10, check for errors right at the beginning

pre-master-46
rlar 11 years ago
parent
commit
b3860ac599
  1. 17
      src/spicelib/devices/asrc/asrcset.c

17
src/spicelib/devices/asrc/asrcset.c

@ -27,6 +27,15 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
for (; model; model = model->ASRCnextModel) {
for (here = model->ASRCinstances; here; here=here->ASRCnextInstance) {
if (!here->ASRCtree)
return E_PARMVAL;
if (here->ASRCtype == ASRC_VOLTAGE)
if (here->ASRCposNode == here->ASRCnegNode) {
SPfrontEnd->IFerrorf(ERR_FATAL, "instance %s is a shorted ASRC", here->ASRCname);
return(E_UNSUPP);
}
if (!here->ASRCtc1Given)
here->ASRCtc1 = 0.0;
if (!here->ASRCtc2Given)
@ -58,16 +67,8 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
/* For each controlling variable set the entries
in the vector of the positions of the SMP */
if (!here->ASRCtree)
return E_PARMVAL;
if (here->ASRCtype == ASRC_VOLTAGE) {
if (here->ASRCposNode == here->ASRCnegNode) {
SPfrontEnd->IFerrorf(ERR_FATAL, "instance %s is a shorted ASRC", here->ASRCname);
return(E_UNSUPP);
}
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 4);
TSTALLOC(ASRCposptr[j++], here->ASRCposNode, here->ASRCbranch);

Loading…
Cancel
Save