
/*
 * Structures for model: core
 *
 * 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("h_array", 0, (IF_REAL|IF_VECTOR), "magnetic field array"),
    IOP("b_array", 1, (IF_REAL|IF_VECTOR), "flux density array"),
    IOP("area", 2, IF_REAL, "cross-sectional area"),
    IOP("length", 3, IF_REAL, "core length"),
    IOP("input_domain", 4, IF_REAL, "input sm. domain"),
    IOP("fraction", 5, IF_FLAG, "smoothing fractional/abs switch"),
    IOP("mode", 6, IF_INTEGER, "mode switch (1 = pwl, 2 = hyst)"),
    IOP("in_low", 7, IF_REAL, "input low value"),
    IOP("in_high", 8, IF_REAL, "input high value"),
    IOP("hyst", 9, IF_REAL, "hysteresis"),
    IOP("out_lower_limit", 10, IF_REAL, "output lower limit"),
    IOP("out_upper_limit", 11, IF_REAL, "output upper limit"),
};


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


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


static Mif_Conn_Info_t MIFconnTable[] = {
  {
    "mc",
    "magnetic core",
    MIF_INOUT,
    MIF_DIFF_CONDUCTANCE,
    "gd",
    2,
    MIFportEnum0,
    MIFportStr0,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
};

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

static union Mif_Parse_Value fraction_default[] = {
    { .bvalue=MIF_TRUE },
};

static union Mif_Parse_Value mode_default[] = {
    { .ivalue=1 },
};

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

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

static union Mif_Parse_Value hyst_default[] = {
    { .rvalue=1.000000e-01 },
};

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

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


static Mif_Param_Info_t MIFparamTable[] = {
  {
    "h_array",
    "magnetic field array",
    MIF_REAL,
    0,
    NULL,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_TRUE,
    MIF_FALSE,
    0,
    MIF_TRUE,
    2,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
  {
    "b_array",
    "flux density array",
    MIF_REAL,
    0,
    NULL,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_TRUE,
    MIF_FALSE,
    0,
    MIF_TRUE,
    2,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
  {
    "area",
    "cross-sectional area",
    MIF_REAL,
    0,
    NULL,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
  {
    "length",
    "core length",
    MIF_REAL,
    0,
    NULL,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
  {
    "input_domain",
    "input sm. domain",
    MIF_REAL,
    1,
    input_domain_default,
    MIF_TRUE,
    { .rvalue=1.000000e-12 },
    MIF_TRUE,
    { .rvalue=5.000000e-01 },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "fraction",
    "smoothing fractional/abs switch",
    MIF_BOOLEAN,
    1,
    fraction_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "mode",
    "mode switch (1 = pwl, 2 = hyst)",
    MIF_INTEGER,
    1,
    mode_default,
    MIF_TRUE,
    { .ivalue=1 },
    MIF_TRUE,
    { .ivalue=2 },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "in_low",
    "input low value",
    MIF_REAL,
    1,
    in_low_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "in_high",
    "input high value",
    MIF_REAL,
    1,
    in_high_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "hyst",
    "hysteresis",
    MIF_REAL,
    1,
    hyst_default,
    MIF_TRUE,
    { .rvalue=0.000000e+00 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "out_lower_limit",
    "output lower limit",
    MIF_REAL,
    1,
    out_lower_limit_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "out_upper_limit",
    "output upper limit",
    MIF_REAL,
    1,
    out_upper_limit_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
};


extern void cm_core(Mif_Private_t *);

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

SPICEdev cm_core_info = {
    .DEVpublic = {
        .name = "core",
        .description = "magnetic core",
        .terms = &val_terms,
        .numNames = &val_numNames,
        .termNames = NULL,
        .numInstanceParms = &val_numInstanceParms,
        .instanceParms = NULL,
        .numModelParms = &val_numModelParms,
        .modelParms = MIFmPTable,
        .flags = 0,

        .cm_func = cm_core,
        .num_conn = 1,
        .conn = MIFconnTable,
        .num_param = 12,
        .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
};

