
/*
 * Structures for model: ilimit
 *
 * Automatically generated by cmpp preprocessor
 *
 * !!! DO NOT EDIT !!!
 *
 */


#include "ngspice/ngspice.h"
#include <stdio.h>
#include "ngspice/devdefs.h"
#include "ngspice/ifsim.h"
#include "ngspice/mifdefs.h"
#include "ngspice/mifproto.h"
#include "ngspice/mifparse.h"


static IFparm MIFmPTable[] = {
    IOP("in_offset", 0, IF_REAL, "input offset"),
    IOP("gain", 1, IF_REAL, "gain"),
    IOP("r_out_source", 2, IF_REAL, "sourcing resistance"),
    IOP("r_out_sink", 3, IF_REAL, "sinking resistance"),
    IOP("i_limit_source", 4, IF_REAL, "current sourcing limit"),
    IOP("i_limit_sink", 5, IF_REAL, "current sinking limit"),
    IOP("v_pwr_range", 6, IF_REAL, "pwr. smoothing range"),
    IOP("i_source_range", 7, IF_REAL, "sourcing cur sm. rng"),
    IOP("i_sink_range", 8, IF_REAL, "sinking cur sm. rng"),
    IOP("r_out_domain", 9, IF_REAL, "output resistance sm. domain"),
};


static Mif_Port_Type_t MIFportEnum0[] = {
    MIF_VOLTAGE,
    MIF_DIFF_VOLTAGE,
    MIF_CURRENT,
    MIF_DIFF_CURRENT,
    MIF_VSOURCE_CURRENT,
};


static char *MIFportStr0[] = {
    "v",
    "vd",
    "i",
    "id",
    "vnam",
};


static Mif_Port_Type_t MIFportEnum1[] = {
    MIF_CONDUCTANCE,
    MIF_DIFF_CONDUCTANCE,
};


static char *MIFportStr1[] = {
    "g",
    "gd",
};


static Mif_Port_Type_t MIFportEnum2[] = {
    MIF_CONDUCTANCE,
    MIF_DIFF_CONDUCTANCE,
};


static char *MIFportStr2[] = {
    "g",
    "gd",
};


static Mif_Port_Type_t MIFportEnum3[] = {
    MIF_CONDUCTANCE,
    MIF_DIFF_CONDUCTANCE,
};


static char *MIFportStr3[] = {
    "g",
    "gd",
};


static Mif_Conn_Info_t MIFconnTable[] = {
  {
    "in",
    "input",
    MIF_IN,
    MIF_VOLTAGE,
    "v",
    5,
    MIFportEnum0,
    MIFportStr0,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
  {
    "pos_pwr",
    "positive power supply",
    MIF_INOUT,
    MIF_CONDUCTANCE,
    "g",
    2,
    MIFportEnum1,
    MIFportStr1,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "neg_pwr",
    "negative power supply",
    MIF_INOUT,
    MIF_CONDUCTANCE,
    "g",
    2,
    MIFportEnum2,
    MIFportStr2,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "out",
    "output",
    MIF_INOUT,
    MIF_CONDUCTANCE,
    "g",
    2,
    MIFportEnum3,
    MIFportStr3,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
};

static union Mif_Parse_Value in_offset_default[] = {
    { .rvalue=0.000000e+00 },
};

static union Mif_Parse_Value gain_default[] = {
    { .rvalue=1.000000e+00 },
};

static union Mif_Parse_Value r_out_source_default[] = {
    { .rvalue=1.000000e+00 },
};

static union Mif_Parse_Value r_out_sink_default[] = {
    { .rvalue=1.000000e+00 },
};

static union Mif_Parse_Value i_limit_source_default[] = {
    { .rvalue=1.000000e-02 },
};

static union Mif_Parse_Value i_limit_sink_default[] = {
    { .rvalue=1.000000e-02 },
};

static union Mif_Parse_Value v_pwr_range_default[] = {
    { .rvalue=1.000000e-06 },
};

static union Mif_Parse_Value i_source_range_default[] = {
    { .rvalue=1.000000e-09 },
};

static union Mif_Parse_Value i_sink_range_default[] = {
    { .rvalue=1.000000e-09 },
};

static union Mif_Parse_Value r_out_domain_default[] = {
    { .rvalue=1.000000e-09 },
};


static Mif_Param_Info_t MIFparamTable[] = {
  {
    "in_offset",
    "input offset",
    MIF_REAL,
    1,
    in_offset_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "gain",
    "gain",
    MIF_REAL,
    1,
    gain_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "r_out_source",
    "sourcing resistance",
    MIF_REAL,
    1,
    r_out_source_default,
    MIF_TRUE,
    { .rvalue=1.000000e-09 },
    MIF_TRUE,
    { .rvalue=1.000000e+09 },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "r_out_sink",
    "sinking resistance",
    MIF_REAL,
    1,
    r_out_sink_default,
    MIF_TRUE,
    { .rvalue=1.000000e-09 },
    MIF_TRUE,
    { .rvalue=1.000000e+09 },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "i_limit_source",
    "current sourcing limit",
    MIF_REAL,
    1,
    i_limit_source_default,
    MIF_TRUE,
    { .rvalue=1.000000e-12 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "i_limit_sink",
    "current sinking limit",
    MIF_REAL,
    1,
    i_limit_sink_default,
    MIF_TRUE,
    { .rvalue=1.000000e-12 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "v_pwr_range",
    "pwr. smoothing range",
    MIF_REAL,
    1,
    v_pwr_range_default,
    MIF_TRUE,
    { .rvalue=1.000000e-15 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "i_source_range",
    "sourcing cur sm. rng",
    MIF_REAL,
    1,
    i_source_range_default,
    MIF_TRUE,
    { .rvalue=1.000000e-15 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "i_sink_range",
    "sinking cur sm. rng",
    MIF_REAL,
    1,
    i_sink_range_default,
    MIF_TRUE,
    { .rvalue=1.000000e-15 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "r_out_domain",
    "output resistance sm. domain",
    MIF_REAL,
    1,
    r_out_domain_default,
    MIF_TRUE,
    { .rvalue=1.000000e-15 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
};


extern void cm_ilimit(Mif_Private_t *);

static int val_terms             = 0;
static int val_numNames          = 0;
static int val_numInstanceParms  = 0;
static int val_numModelParms     = 10;
static int val_sizeofMIFinstance = sizeof(MIFinstance);
static int val_sizeofMIFmodel    = sizeof(MIFmodel);

SPICEdev cm_ilimit_info = {
    .DEVpublic = {
        .name = "ilimit",
        .description = "current limiter block",
        .terms = &val_terms,
        .numNames = &val_numNames,
        .termNames = NULL,
        .numInstanceParms = &val_numInstanceParms,
        .instanceParms = NULL,
        .numModelParms = &val_numModelParms,
        .modelParms = MIFmPTable,
        .flags = 0,

        .cm_func = cm_ilimit,
        .num_conn = 4,
        .conn = MIFconnTable,
        .num_param = 10,
        .param = MIFparamTable,
        .num_inst_var = 0,
        .inst_var = NULL,
    },

    .DEVparam = NULL,
    .DEVmodParam = MIFmParam,
    .DEVload = MIFload,
    .DEVsetup = MIFsetup,
    .DEVunsetup = MIFunsetup,
    .DEVpzSetup = NULL,
    .DEVtemperature = NULL,
    .DEVtrunc = MIFtrunc,
    .DEVfindBranch = NULL,
    .DEVacLoad = MIFload,
    .DEVaccept = NULL,
    .DEVdestroy = NULL,
    .DEVmodDelete = MIFmDelete,
    .DEVdelete = MIFdelete,
    .DEVsetic = NULL,
    .DEVask = MIFask,
    .DEVmodAsk = MIFmAsk,
    .DEVpzLoad = NULL,
    .DEVconvTest = MIFconvTest,
    .DEVsenSetup = NULL,
    .DEVsenLoad = NULL,
    .DEVsenUpdate = NULL,
    .DEVsenAcLoad = NULL,
    .DEVsenPrint = NULL,
    .DEVsenTrunc = NULL,
    .DEVdisto = NULL,
    .DEVnoise = NULL,
    .DEVsoaCheck = NULL,
    .DEVinstSize = &val_sizeofMIFinstance,
    .DEVmodSize = &val_sizeofMIFmodel,

#ifdef CIDER
    .DEVdump = NULL,
    .DEVacct = NULL,
#endif

#ifdef KLU
    .DEVbindCSC = MIFbindCSC,
    .DEVbindCSCComplex = MIFbindCSCComplex,
    .DEVbindCSCComplexToReal = MIFbindCSCComplexToReal,
#endif
};

