Ejemplo n.º 1
0
void
CCCSsPrint(GENmodel *inModel, CKTcircuit *ckt)
{
    CCCSmodel *model = (CCCSmodel*)inModel;
    CCCSinstance *here;

    printf("CURRENT CONTROLLED CURRENT SOURCES-----------------\n");
    /*  loop through all the voltage source models */
    for( ; model != NULL; model = model->CCCSnextModel ) {

        printf("Model name:%s\n",model->CCCSmodName);

        /* loop through all the instances of the model */
        for (here = model->CCCSinstances; here != NULL ;
                here=here->CCCSnextInstance) {

            printf("    Instance name:%s\n",here->CCCSname);
            printf("      Positive, negative nodes: %s, %s\n",
                    CKTnodName(ckt,here->CCCSposNode),
                    CKTnodName(ckt,here->CCCSnegNode));
            printf("      Controlling source name: %s\n",
                    here->CCCScontName);
            printf("      Controlling Branch equation number: %s\n",
                    CKTnodName(ckt,here->CCCScontBranch));
            printf("      Coefficient: %f\n",here->CCCScoeff);
            printf("    CCCSsenParmNo:%d\n",here->CCCSsenParmNo);

        }
    } 
}
Ejemplo n.º 2
0
void
VCVSsPrint(GENmodel *inModel, CKTcircuit *ckt)
{
    VCVSmodel *model = (VCVSmodel *)inModel;
    VCVSinstance *here;

    printf("VOLTAGE CONTROLLED VOLTAGE SOURCES-----------------\n");
    /*  loop through all the voltage source models */
    for( ; model != NULL; model = model->VCVSnextModel ) {

        printf("Model name:%s\n",model->VCVSmodName);

        /* loop through all the instances of the model */
        for (here = model->VCVSinstances; here != NULL ;
                here=here->VCVSnextInstance) {

            printf("    Instance name:%s\n",here->VCVSname);
            printf("      Positive, negative nodes: %s, %s\n",
                    CKTnodName(ckt,here->VCVSposNode),
                    CKTnodName(ckt,here->VCVSnegNode));
            printf("      Controlling Positive, negative nodes: %s, %s\n",
                    CKTnodName(ckt,here->VCVScontPosNode),
                    CKTnodName(ckt,here->VCVScontNegNode));
            printf("      Branch equation number: %s\n",
                    CKTnodName(ckt,here->VCVSbranch));
            printf("      Coefficient: %f\n",here->VCVScoeff);
            printf("    VCVSsenParmNo:%d\n",here->VCVSsenParmNo);
        }
    }
}
Ejemplo n.º 3
0
void
MOS1sPrint(GENmodel *inModel, CKTcircuit *ckt)
/* Pretty print the sensitivity info for all the MOS1 
         * devices  in the circuit.
         */
{
    MOS1model *model = (MOS1model *)inModel;
    MOS1instance *here;

    printf("LEVEL 1 MOSFETS-----------------\n");
    /*  loop through all the MOS1 models */
    for( ; model != NULL; model = model->MOS1nextModel ) {

        printf("Model name:%s\n",model->MOS1modName);

        /* loop through all the instances of the model */
        for (here = model->MOS1instances; here != NULL ;
                here=here->MOS1nextInstance) {

            printf("    Instance name:%s\n",here->MOS1name);
            printf("      Drain, Gate , Source nodes: %s, %s ,%s\n",
            CKTnodName(ckt,here->MOS1dNode),CKTnodName(ckt,here->MOS1gNode),
            CKTnodName(ckt,here->MOS1sNode));
            
            printf("  Multiplier: %g ",here->MOS1m);
            printf(here->MOS1mGiven ? "(specified)\n" : "(default)\n");
            
            printf("      Length: %g ",here->MOS1l);
            printf(here->MOS1lGiven ? "(specified)\n" : "(default)\n");
            printf("      Width: %g ",here->MOS1w);
            printf(here->MOS1wGiven ? "(specified)\n" : "(default)\n");
            if(here->MOS1sens_l == 1){
                printf("    MOS1senParmNo:l = %d ",here->MOS1senParmNo);
            }
            else{ 
                printf("    MOS1senParmNo:l = 0 ");
            }
            if(here->MOS1sens_w == 1){
                printf("    w = %d \n",here->MOS1senParmNo + here->MOS1sens_l);
            }
            else{ 
                printf("    w = 0 \n");
            }


        }
    }
}
Ejemplo n.º 4
0
void
MOS3sPrint(GENmodel *inModel, CKTcircuit *ckt)
{
    MOS3model *model = (MOS3model *)inModel;
    MOS3instance *here;

    printf("LEVEL 3 MOSFETS-----------------\n");
    /*  loop through all the MOS3 models */
    for( ; model != NULL; model = model->MOS3nextModel ) {

        printf("Model name:%s\n",model->MOS3modName);

        /* loop through all the instances of the model */
        for (here = model->MOS3instances; here != NULL ;
                here=here->MOS3nextInstance) {
            if (here->MOS3owner != ARCHme) continue;

            printf("    Instance name:%s\n",here->MOS3name);
            printf("      Drain, Gate , Source nodes: %s, %s ,%s\n",
                   CKTnodName(ckt,here->MOS3dNode),CKTnodName(ckt,here->MOS3gNode),
                   CKTnodName(ckt,here->MOS3sNode));

            printf("  Multiplier: %g ",here->MOS3m);
            printf(here->MOS3mGiven ? "(specified)\n" : "(default)\n");
            printf("      Length: %g ",here->MOS3l);
            printf(here->MOS3lGiven ? "(specified)\n" : "(default)\n");
            printf("      Width: %g ",here->MOS3w);
            printf(here->MOS3wGiven ? "(specified)\n" : "(default)\n");
            if(here->MOS3sens_l == 1) {
                printf("    MOS3senParmNo:l = %d ",here->MOS3senParmNo);
            }
            else {
                printf("    MOS3senParmNo:l = 0 ");
            }
            if(here->MOS3sens_w == 1) {
                printf("    w = %d \n",here->MOS3senParmNo + here->MOS3sens_l);
            }
            else {
                printf("    w = 0 \n");
            }


        }
    }
}
Ejemplo n.º 5
0
/* ARGSUSED */
int
TXLsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit*ckt, int *state)
{
    TXLmodel *model = (TXLmodel *)inModel;
    TXLinstance *here;
    CKTnode *tmp;
    int error;

    NG_IGNORE(state);

    /*  loop through all the models */
    for( ; model != NULL; model = model->TXLnextModel ) {

        if (!model->Rgiven) {
            SPfrontEnd->IFerrorf (ERR_FATAL,
                                  "model %s: lossy line series resistance not given", model->TXLmodName);
            return(E_BADPARM);
        }
        if (!model->Ggiven) {
            SPfrontEnd->IFerrorf (ERR_FATAL,
                                  "model %s: lossy line parallel conductance not given", model->TXLmodName);
            return(E_BADPARM);
        }
        if (!model->Lgiven) {
            SPfrontEnd->IFerrorf (ERR_FATAL,
                                  "model %s: lossy line series inductance not given", model->TXLmodName);
            return (E_BADPARM);
        }
        if (!model->Cgiven) {
            SPfrontEnd->IFerrorf (ERR_FATAL,
                                  "model %s: lossy line parallel capacitance not given", model->TXLmodName);
            return (E_BADPARM);
        }
        if (!model->lengthgiven) {
            SPfrontEnd->IFerrorf (ERR_FATAL,
                                  "model %s: lossy line length must be given", model->TXLmodName);
            return (E_BADPARM);
        }

        /* loop through all the instances of the model */
        for (here = model->TXLinstances; here != NULL ;
                here=here->TXLnextInstance) {

            /* macro to make elements with built in test for out of memory */
#define TSTALLOC(ptr,first,second) \
do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
    return(E_NOMEM);\
} } while(0)

            if (! here->TXLibr1Given) {
                error = CKTmkCur(ckt, &tmp, here->TXLname, "branch1");
                if (error) return (error);
                here->TXLibr1 = tmp->number;
            }
            if (! here->TXLibr2Given) {
                error = CKTmkCur(ckt, &tmp, here->TXLname, "branch2");
                if (error) return (error);
                here->TXLibr2 = tmp->number;
            }

            TSTALLOC(TXLposPosptr, TXLposNode, TXLposNode);
            TSTALLOC(TXLposNegptr, TXLposNode, TXLnegNode);
            TSTALLOC(TXLnegPosptr, TXLnegNode, TXLposNode);
            TSTALLOC(TXLnegNegptr, TXLnegNode, TXLnegNode);
            TSTALLOC(TXLibr1Posptr, TXLibr1, TXLposNode);
            TSTALLOC(TXLibr2Negptr, TXLibr2, TXLnegNode);
            TSTALLOC(TXLnegIbr2ptr, TXLnegNode, TXLibr2);
            TSTALLOC(TXLposIbr1ptr, TXLposNode, TXLibr1);
            TSTALLOC(TXLibr1Ibr1ptr, TXLibr1, TXLibr1);
            TSTALLOC(TXLibr2Ibr2ptr, TXLibr2, TXLibr2);
            TSTALLOC(TXLibr1Negptr, TXLibr1, TXLnegNode);
            TSTALLOC(TXLibr2Posptr, TXLibr2, TXLposNode);
            TSTALLOC(TXLibr1Ibr2ptr, TXLibr1, TXLibr2);
            TSTALLOC(TXLibr2Ibr1ptr, TXLibr2, TXLibr1);

            here->in_node_name = CKTnodName(ckt,here->TXLposNode);
            here->out_node_name = CKTnodName(ckt,here->TXLnegNode);
            ReadTxL(here, ckt);

        }
    }

    return(OK);
}
Ejemplo n.º 6
0
int
CKTsenComp(CKTcircuit *ckt)
{
    int size;
    int row;
    int col;
    SENstruct *info;

#ifdef SENSDEBUG
    char *rowe;
    SMPelement *elt;
#endif

#ifdef SENSDEBUG
    printf("CKTsenComp\n");
#endif

    size = SMPmatSize(ckt->CKTmatrix);
    info = ckt->CKTsenInfo;

    if ((info->SENmode == DCSEN) || (info->SENmode == TRANSEN)) {

        /*  loop throgh all the columns of RHS
            matrix - each column corresponding to a design
            parameter */

        for (col = 1; col <= info->SENparms; col++) {

            for (row = 1; row <= size; row++) {
                ckt->CKTsenRhs[row] = info->SEN_RHS[row][col];
            }

            /* solve for the sensitivity values */
            SMPsolve(ckt->CKTmatrix, ckt->CKTsenRhs, ckt->CKTrhsSpare);

            /* store the sensitivity values */
            for (row = 1; row <= size; row++) {
                info->SEN_Sap[row][col] = ckt->CKTsenRhs[row];
                info->SEN_RHS[row][col] = ckt->CKTsenRhs[row];
            }
        }

#ifdef SENSDEBUG
        printf("\n");
        printf("Sensitivity matrix :\n");

        for (row = 1; row <= size; row++) {
            rowe = CKTnodName(ckt, row);
//          if (strcmp("4", rowe) == 0) {
                for (col = 1; col <= info->SENparms; col++) {
                    printf("\t");
                    printf("Sap(%s,%d) = %.5e\t", rowe, col,
                           info->SEN_Sap[row][col]);
                }
                printf("\n\n");
//          }
        }

        printf("  RHS matrix   :\n");
        for (row = 1; row <= size; row++) {
            for (col = 1; col <= info->SENparms; col++) {
                printf("  ");
                printf("RHS(%d,%d) = %.7e ", row, col,
                       info->SEN_RHS[row][col]);
            }
            printf("\n");
        }

        printf("      Jacobian  matrix :\n");
        for (row = 1; row <= size; row++) {
            for (col = 1; col <= size; col++) {
                elt = SMPfindElt(ckt->CKTmatrix, row , col , 0);
                if (elt)
                    printf("%.7e ", elt->Real);
                else
                    printf("0.0000000e+00 ");
            }
            printf("\n");
        }
#endif

    }

    if (info->SENmode == ACSEN) {

        /*  loop throgh all the columns of RHS
            matrix - each column corresponding to a design
            parameter */

        for (col = 1; col <= info->SENparms; col++) {

            for (row = 1; row <= size; row++) {
                ckt->CKTsenRhs[row]  = info->SEN_RHS[row][col];
                ckt->CKTseniRhs[row] = info->SEN_iRHS[row][col];
            }

            /* solve for the sensitivity values ( both real and imag parts)*/
            SMPcSolve(ckt->CKTmatrix, ckt->CKTsenRhs, ckt->CKTseniRhs,
                      ckt->CKTrhsSpare, ckt->CKTirhsSpare);

            /* store the sensitivity values ( both real and imag parts)*/
            for (row = 1; row <= size; row++) {
                info->SEN_RHS[row][col]  = ckt->CKTsenRhs[row];
                info->SEN_iRHS[row][col] = ckt->CKTseniRhs[row];
            }
        }

#ifdef SENSDEBUG
        printf("\n");
        printf("CKTomega = %.7e rad/sec\t\n", ckt->CKTomega);
        printf("Sensitivity matrix :\n");
        for (row = 1; row <= size; row++) {
            rowe = CKTnodName(ckt, row);
            for (col = 1; col <= info->SENparms; col++) {
                printf("\t");
                printf("RHS(%s,%d) = %.5e", rowe, col,
                       info->SEN_RHS[row][col]);
                printf(" + j %.5e\t", info->SEN_iRHS[row][col]);
                printf("\n\n");
            }
            printf("\n");
        }

        printf("CKTomega = %.7e rad/sec\t\n", ckt->CKTomega);
        printf("  RHS matrix   :\n");
        for (row = 1; row <= size; row++) {
            for (col = 1; col <= info->SENparms; col++) {
                printf("  ");
                printf("RHS(%d,%d) = %.7e ", row, col,
                       info->SEN_RHS[row][col]);
                printf("+j %.7e ", info->SEN_iRHS[row][col]);
            }
            printf("\n");
        }

        printf("      Jacobian  matrix for AC :\n");
        for (row = 1; row <= size; row++) {
            for (col = 1; col <= size; col++) {
                elt = SMPfindElt(ckt->CKTmatrix, row , col , 0);
                if (elt) {
                    printf("%.7e ", elt->Real);
                    printf("+j%.7e\t", elt->Imag);
                } else{
                    printf("0.0000000e+00 ");
                    printf("+j0.0000000e+00\t");
                }
            }
            printf("\n\n");
        }
#endif

    }

    return OK;
}