KiCad PCB EDA Suite
dialog_spice_model.cpp File Reference
#include "wildcards_and_files_ext.h"
#include "dialog_spice_model.h"
#include <sim/spice_value.h>
#include <confirm.h>
#include <project.h>
#include <wx/tokenzr.h>
#include <wx/wupdlock.h>
#include <cctype>
#include <cstring>

Go to the source code of this file.

Classes

struct  SPICE_MODEL_INFO
 

Enumerations

enum  TRRANDOM_TYPE { TRRANDOM_UNIFORM = 0, TRRANDOM_GAUSSIAN = 1, TRRANDOM_EXPONENTIAL = 2, TRRANDOM_POISSON = 3 }
 

Functions

static bool empty (const wxTextCtrl *aCtrl)
 
static int wxCALLBACK comparePwlValues (wxIntPtr aItem1, wxIntPtr aItem2, wxIntPtr WXUNUSED(aSortData))
 
static int getModelTypeIdx (char aPrimitive)
 

Variables

static const std::vector< SPICE_MODEL_INFOmodelTypes
 

Enumeration Type Documentation

◆ TRRANDOM_TYPE

Enumerator
TRRANDOM_UNIFORM 
TRRANDOM_GAUSSIAN 
TRRANDOM_EXPONENTIAL 
TRRANDOM_POISSON 

Definition at line 82 of file dialog_spice_model.cpp.

Function Documentation

◆ comparePwlValues()

static int wxCALLBACK comparePwlValues ( wxIntPtr  aItem1,
wxIntPtr  aItem2,
wxIntPtr   WXUNUSEDaSortData 
)
static

Definition at line 47 of file dialog_spice_model.cpp.

48 {
49  float* t1 = reinterpret_cast<float*>( &aItem1 );
50  float* t2 = reinterpret_cast<float*>( &aItem2 );
51 
52  if( *t1 > *t2 )
53  return 1;
54 
55  if( *t1 < *t2 )
56  return -1;
57 
58  return 0;
59 }

Referenced by DIALOG_SPICE_MODEL::addPwlValue().

◆ empty()

static bool empty ( const wxTextCtrl *  aCtrl)
static

Definition at line 40 of file dialog_spice_model.cpp.

41 {
42  return aCtrl->GetValue().IsEmpty();
43 }

Referenced by DIALOG_SPICE_MODEL::generatePowerSource(), DIALOG_SPICE_MODEL::TransferDataFromWindow(), and DIALOG_SPICE_MODEL::TransferDataToWindow().

◆ getModelTypeIdx()

static int getModelTypeIdx ( char  aPrimitive)
static

Definition at line 92 of file dialog_spice_model.cpp.

93 {
94  const char prim = std::toupper( aPrimitive );
95 
96  for( size_t i = 0; i < modelTypes.size(); ++i )
97  {
98  if( modelTypes[i].type == prim )
99  return i;
100  }
101 
102  return -1;
103 }
static const std::vector< SPICE_MODEL_INFO > modelTypes

References modelTypes.

Referenced by DIALOG_SPICE_MODEL::onModelSelected(), and DIALOG_SPICE_MODEL::TransferDataToWindow().

Variable Documentation

◆ modelTypes

const std::vector<SPICE_MODEL_INFO> modelTypes
static
Initial value:
=
{
{ SP_DIODE, _( "Diode" ), { "d" } },
{ SP_BJT, _( "BJT" ), { "npn", "pnp" } },
{ SP_MOSFET, _( "MOSFET" ), { "nmos", "pmos", "vdmos" } },
{ SP_JFET, _( "JFET" ), { "njf", "pjf" } },
{ SP_SUBCKT, _( "Subcircuit" ), {} },
}
#define _(s)
Definition: 3d_actions.cpp:33

Definition at line 72 of file dialog_spice_model.cpp.

Referenced by getModelTypeIdx(), DIALOG_SPICE_MODEL::Init(), DIALOG_SPICE_MODEL::onTypeSelected(), DIALOG_SPICE_MODEL::MODEL::parseModelType(), and DIALOG_SPICE_MODEL::TransferDataFromWindow().