⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 capsetup.c

📁 spice中支持多层次元件模型仿真的可单独运行的插件源码
💻 C
字号:
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1985 Thomas L. Quarles**********//* */#include "spice.h"#include <stdio.h>#include "util.h"#include "cktdefs.h"#include "capdefs.h"#include "sperror.h"#include "suffix.h"/*ARGSUSED*/intCAPsetup(matrix,inModel,ckt,states)    register SMPmatrix *matrix;    GENmodel *inModel;    CKTcircuit *ckt;    int *states;        /* load the capacitor structure with those pointers needed later          * for fast matrix loading          */{    register CAPmodel *model = (CAPmodel*)inModel;    register CAPinstance *here;    /*  loop through all the capacitor models */    for( ; model != NULL; model = model->CAPnextModel ) {        /*Default Value Processing for Model Parameters */        if (!model->CAPcjGiven) {            model->CAPcj = 0;        }        if (!model->CAPcjswGiven){             model->CAPcjsw = 0;        }        if (!model->CAPdefWidthGiven) {            model->CAPdefWidth = 10.e-6;        }        if (!model->CAPnarrowGiven) {            model->CAPnarrow = 0;        }        /* loop through all the instances of the model */        for (here = model->CAPinstances; here != NULL ;                here=here->CAPnextInstance) {	    if (here->CAPowner != ARCHme) goto matrixpointers;            /* Default Value Processing for Capacitor Instance */            if (!here->CAPlengthGiven) {                here->CAPlength = 0;            }            here->CAPqcap = *states;            *states += 2;            if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){                *states += 2 * (ckt->CKTsenInfo->SENparms);            }/* macro to make elements with built in test for out of memory */#define TSTALLOC(ptr,first,second) \if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\    return(E_NOMEM);\}matrixpointers:            TSTALLOC(CAPposPosptr,CAPposNode,CAPposNode)            TSTALLOC(CAPnegNegptr,CAPnegNode,CAPnegNode)            TSTALLOC(CAPposNegptr,CAPposNode,CAPnegNode)            TSTALLOC(CAPnegPosptr,CAPnegNode,CAPposNode)        }    }    return(OK);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -