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

📄 mutsetup.c

📁 spice中支持多层次元件模型仿真的可单独运行的插件源码
💻 C
字号:
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1985 Thomas L. Quarles**********/        /* load the inductor structure with those pointers needed later          * for fast matrix loading          */#include "spice.h"#include <stdio.h>#include "util.h"#include "ifsim.h"#include "smpdefs.h"#include "cktdefs.h"#include "inddefs.h"#include "sperror.h"#include "suffix.h"#ifdef MUTUAL/*ARGSUSED*/intMUTsetup(matrix,inModel,ckt,states)    register SMPmatrix *matrix;    GENmodel *inModel;    CKTcircuit *ckt;    int *states;{    register MUTmodel *model = (MUTmodel*)inModel;    register MUTinstance *here;    int ktype;    int error;    /*  loop through all the inductor models */    for( ; model != NULL; model = model->MUTnextModel ) {        /* loop through all the instances of the model */        for (here = model->MUTinstances; here != NULL ;                here=here->MUTnextInstance) {                        ktype = CKTtypelook("Inductor");            if(ktype <= 0) {                (*(SPfrontEnd->IFerror))(ERR_PANIC,                        "mutual inductor, but inductors not available!",                        (IFuid *)NULL);                return(E_INTERN);            }            error = CKTfndDev((GENERIC*)ckt,&ktype,(GENERIC**)&(here->MUTind1),                    here->MUTindName1, (GENERIC *)NULL,(char *)NULL);            if(error && error!= E_NODEV && error != E_NOMOD) return(error);            if(error) {                IFuid namarray[2];                namarray[0]=here->MUTname;                namarray[1]=here->MUTindName1;                (*(SPfrontEnd->IFerror))(ERR_WARNING,                    "%s: coupling to non-existant inductor %s.",                    namarray);            }            error = CKTfndDev((GENERIC*)ckt,&ktype,(GENERIC**)&(here->MUTind2),                    here->MUTindName2,(GENERIC *)NULL,(char *)NULL);            if(error && error!= E_NODEV && error != E_NOMOD) return(error);            if(error) {                IFuid namarray[2];                namarray[0]=here->MUTname;                namarray[1]=here->MUTindName2;                (*(SPfrontEnd->IFerror))(ERR_WARNING,                    "%s: coupling to non-existant inductor %s.",                    namarray);            }            here->MUTfactor = here->MUTcoupling *sqrt(here->MUTind1->INDinduct *                    here->MUTind2->INDinduct);/* 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);\}            TSTALLOC(MUTbr1br2,MUTind1->INDbrEq,MUTind2->INDbrEq)            TSTALLOC(MUTbr2br1,MUTind2->INDbrEq,MUTind1->INDbrEq)        }    }    return(OK);}#endif /* MUTUAL */

⌨️ 快捷键说明

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