1 /*************************************************************************** 2 JSPICE3 adaptation of Spice3f2 - Copyright (c) Stephen R. Whiteley 1992 3 Copyright 1990 Regents of the University of California. All rights reserved. 4 Authors: 1985 Thomas L. Quarles 5 1987 Kanwar Jit Singh 6 1993 Stephen R. Whiteley 7 ****************************************************************************/ 8 9 #include "spice.h" 10 #include <stdio.h> 11 #include "srcdefs.h" 12 #include "uflags.h" 13 14 /* Arbitrary source */ 15 static IFparm SRCpTable[] = { /* parameters */ 16 IP( "i", SRC_I, IF_PARSETREE, "Current source "), 17 IP( "v", SRC_V, IF_PARSETREE, "Voltage source"), 18 IOP( "type", SRC_DEP, IF_INTEGER, "Type of dependency"), 19 IOPP( "dc", SRC_DC, IF_REAL, "D.C. source value"), 20 IOP( "ac", SRC_AC, IF_REALVEC, "AC magnitude, phase vector"), 21 IOPAAU("acmag", SRC_AC_MAG, IF_REAL, "A.C. Magnitude"), 22 IOPAAU("acphase", SRC_AC_PHASE, IF_REAL, "A.C. Phase"), 23 IOP( "function",SRC_FUNC, IF_PARSETREE, "Function specification"), 24 IP( "distof1", SRC_D_F1, IF_REALVEC, "f1 input for distortion"), 25 IP( "distof2", SRC_D_F2, IF_REALVEC, "f2 input for distortion"), 26 IOP( "gain", SRC_GAIN, IF_REAL , "Gain of source"), 27 IOP( "control", SRC_CONTROL, IF_INSTANCE, "Name of controlling source"), 28 OPU( "pos_node",SRC_POS_NODE, IF_INTEGER, "Positive node of source"), 29 OPU( "neg_node",SRC_NEG_NODE, IF_INTEGER, "Negative node of source"), 30 OPU( "acreal", SRC_AC_REAL, IF_REAL, "AC real part"), 31 OPU( "acimag", SRC_AC_IMAG, IF_REAL, "AC imaginary part"), 32 OP( "c", SRC_CURRENT, IF_REAL, "Voltage source current"), 33 OP( "p", SRC_POWER, IF_REAL, "Instantaneous power"), 34 OP( "cont_p_node",SRC_CONT_P_NODE,IF_INTEGER, 35 "Positive node of contr. source"), 36 OP( "cont_n_node",SRC_CONT_N_NODE,IF_INTEGER, 37 "Negative node of contr. source") 38 }; 39 40 41 /* model parameters */ 42 /* static IFparm SRCmPTable[] = { }; */ 43 44 static char *SRCnames1[] = { 45 "src+", 46 "src-", 47 }; 48 49 static char *SRCnames2[] = { 50 "src+", 51 "src-", 52 "srcC+", 53 "srcC-" 54 }; 55 56 static IFkeys SRCkeys[] = { 57 { 'a', NUMELEMS(SRCnames1), SRCnames1, 0, 0 }, 58 { 'v', NUMELEMS(SRCnames1), SRCnames1, 0, 0 }, 59 { 'i', NUMELEMS(SRCnames1), SRCnames1, 0, 0 }, 60 { 'e', NUMELEMS(SRCnames2), SRCnames2, 0, 0 }, 61 { 'f', NUMELEMS(SRCnames1), SRCnames1, 0, 1 }, 62 { 'g', NUMELEMS(SRCnames2), SRCnames2, 0, 0 }, 63 { 'h', NUMELEMS(SRCnames1), SRCnames1, 0, 1 }, 64 }; 65 66 static int SRCkSize = NUMELEMS(SRCkeys); 67 static int SRCpTSize = NUMELEMS(SRCpTable); 68 static int SRCmPTSize = 0; 69 static int SRCiSize = sizeof(SRCinstance); 70 static int SRCmSize = sizeof(SRCmodel); 71 72 73 SPICEdev SRCinfo = { 74 { 75 "Source", 76 "General source model ", 77 78 &SRCkSize, 79 SRCkeys, 80 1, 81 NULL, 82 SRCparse, 83 84 &SRCpTSize, 85 SRCpTable, 86 87 0, /*&SRCmPTSize*/ 88 NULL /*SRCmPTable*/ 89 }, 90 91 SRCparam, 92 NULL, 93 SRCload, 94 SRCsetup, 95 SRCsetup, 96 NULL, 97 NULL, 98 SRCfindBr, 99 SRCacLoad, /* ac and normal load functions NOT identical */ 100 NULL, 101 SRCdestroy, 102 SRCmDelete, 103 SRCdelete, 104 NULL, 105 SRCask, 106 NULL, 107 SRCpzLoad, 108 SRCconvTest, 109 NULL, /* DISTO */ 110 NULL, /* NOISE */ 111 112 &SRCiSize, 113 &SRCmSize 114 }; 115