[go: nahoru, domu]

Skip to content

Commit

Permalink
Modified DeviceTraits struct and deviceTypeName() in .H files to use …
Browse files Browse the repository at this point in the history
…level = X in model card for YMemristor device, updated deviceRegister() in .C
  • Loading branch information
michea committed Feb 11, 2017
1 parent 147ff12 commit 1299dfd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 39 deletions.
20 changes: 3 additions & 17 deletions Joglekar/Xyce/N_DEV_MemristorJoglekar.C
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ namespace Device {
namespace MemristorJoglekar {







template <typename ScalarT>
ScalarT JogelkarWindowFunction( const ScalarT & X, double P )
{
Expand Down Expand Up @@ -104,15 +99,6 @@ ScalarT I_V( const ScalarT & V1, const ScalarT & V2, const ScalarT & X, double R
}











//
// Common Jacobian Stamp for all MemristorJoglekar devices.
// Because all memristors have identical Jacobian stamps, this data is
Expand Down Expand Up @@ -1105,8 +1091,8 @@ void
registerDevice()
{
Config<Traits>::addConfiguration()
.registerDevice("joglekar", 1)
.registerModelType("joglekar", 1);
.registerDevice("memristor", 4)
.registerModelType("memristor", 4);
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1148,4 +1134,4 @@ void MemristorJoglekarSensitivity::operator()(

} // namespace MemristorJoglekar
} // namespace Device
} // namespace Xyce
} // namespace Xyce
5 changes: 3 additions & 2 deletions Joglekar/Xyce/N_DEV_MemristorJoglekar.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <N_DEV_DeviceInstance.h>
#include <N_DEV_DeviceModel.h>
#include <N_DEV_DeviceMaster.h>
#include <N_DEV_MemristorTEAM.h>

namespace Xyce {
namespace Device {
Expand Down Expand Up @@ -74,10 +75,10 @@ class MemristorJoglekarSensitivity : public baseSensitivity

static MemristorJoglekarSensitivity memrSens;

struct Traits : public DeviceTraits<Model, Instance>
struct Traits : public DeviceTraits<Model, Instance, MemristorTEAM::Traits>
{
static const char *name() {return "MemristorJoglekar";}
static const char *deviceTypeName() {return "YJOGLEKAR level 1";}
static const char *deviceTypeName() {return "YMEMRISTOR level 4";}
static int numNodes() {return 2;}
static bool modelRequired() {return true;}
static bool isLinearDevice() {return false;}
Expand Down
30 changes: 14 additions & 16 deletions Knowm/Xyce/N_DEV_MemristorKnowm.C
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include <Xyce_config.h>
#include <N_DEV_Const.h>

#include <N_DEV_MemristorKnowm.h>

#include <N_DEV_DeviceOptions.h>
#include <N_DEV_ExternData.h>
#include <N_DEV_SolverState.h>
Expand Down Expand Up @@ -297,7 +299,6 @@ void Traits::loadModelParameters(ParametricData<MemristorKnowm::Model> &p)
.setUnit(U_NONE)
.setDescription("Schottky Reverse Beta");


}

//-----------------------------------------------------------------------------
Expand All @@ -319,7 +320,7 @@ Instance::Instance(
: DeviceInstance(instance_block, configuration.getInstanceParameters(), factory_block),
model_(model),
rInit_(0.0),
Temp_(300.0),
Temp_(300.0),
G(0.0),
i0(0.0),
li_Pos(-1),
Expand Down Expand Up @@ -407,9 +408,8 @@ bool Instance::processParams()
// Xyce::dout() << "----------Instance::processParams" << std::endl;
// Xyce::dout() << " rInit_ = " << rInit_ << std::endl;
// }

if (!given("TEMP")){
Temp_ = getDeviceOptions().temp.getImmutableValue<double>();
Temp_ = getDeviceOptions().temp.getImmutableValue<double>();
}

updateTemperature(Temp_);
Expand Down Expand Up @@ -706,7 +706,6 @@ bool Instance::updateIntermediateVars()
// temperature. When temperature is changed, any device that has parameters
// that depend on temperature must be updated. That updating happens here.
//
//
// @return true on success
//
// @author Tom Russo, Component Information and Models
Expand Down Expand Up @@ -975,11 +974,10 @@ bool Master::updateState(double * solVec, double * staVec, double * stoVec)
Sacado::Fad::SFad<double,3> resultFad;

double vT = 0.026;
vT = ri.Temp_ * CONSTKoverQ;
// if (DEBUG_DEVICE){
// Xyce::dout() << " vT = " << vT << std::endl;
// }

vT = ri.Temp_ * CONSTKoverQ;
// if (DEBUG_DEVICE){
// Xyce::dout() << " vT = " << vT << std::endl;
// }
resultFad = dXdt( varV1, varV2, varX, ri.model_.Ron_, ri.model_.Roff_, ri.model_.Von_, ri.model_.Voff_, ri.model_.Tau_, vT );

ri.xVarFContribution = resultFad.val();
Expand Down Expand Up @@ -1043,14 +1041,14 @@ bool Master::loadDAEVectors (double * solVec, double * fVec, double *qVec, doub
for (InstanceVector::const_iterator it = getInstanceBegin(); it != getInstanceEnd(); ++it)
{
Instance & ri = *(*it);
fVec[ri.li_Pos] += -ri.i0;
fVec[ri.li_Neg] += ri.i0;
fVec[ri.li_Pos] += ri.i0;
fVec[ri.li_Neg] += -ri.i0;
fVec[ri.li_x] += ri.xVarFContribution;
qVec[ri.li_x] -= solVec[ri.li_x];
if( getSolverState().dcopFlag )
{
double x = initialX(ri.model_.Ron_, ri.model_.Roff_, ri.rInit_);
qVec[ri.li_x] -= x;
qVec[ri.li_x] += x;
// if (DEBUG_DEVICE){
// Xyce::dout() << "DCOP x = " << x << std::endl;
// }
Expand Down Expand Up @@ -1181,8 +1179,8 @@ void
registerDevice()
{
Config<Traits>::addConfiguration()
.registerDevice("Knowm", 1)
.registerModelType("Knowm", 1);
.registerDevice("memristor", 5)
.registerModelType("memristor", 5);
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1224,4 +1222,4 @@ void MemristorKnowmSensitivity::operator()(

} // namespace MemristorKnowm
} // namespace Device
} // namespace Xyce
} // namespace Xyce
9 changes: 5 additions & 4 deletions Knowm/Xyce/N_DEV_MemristorKnowm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

//-----------------------------------------------------------------------------
//
// Purpose : Implementation of the Knowm MKnowm memristor model.
// Purpose : Implementation of the MSS memristor model.
//
// Creator : Tim Molter, Knowm Inc.
//
Expand All @@ -43,6 +43,7 @@
#include <N_DEV_DeviceModel.h>
#include <N_DEV_DeviceMaster.h>
#include <N_UTL_RandomNumbers.h>
#include <N_DEV_MemristorTEAM.h>

namespace Xyce {
namespace Device {
Expand Down Expand Up @@ -75,10 +76,10 @@ class MemristorKnowmSensitivity : public baseSensitivity

static MemristorKnowmSensitivity memrSens;

struct Traits : public DeviceTraits<Model, Instance>
struct Traits : public DeviceTraits<Model, Instance, MemristorTEAM::Traits>
{
static const char *name() {return "MemristorKnowm";}
static const char *deviceTypeName() {return "YKnowm level 1";}
static const char *deviceTypeName() {return "YMEMRISTOR level 5";}
static int numNodes() {return 2;}
static bool modelRequired() {return true;}
static bool isLinearDevice() {return false;}
Expand Down Expand Up @@ -222,7 +223,7 @@ class Instance : public DeviceInstance

// User-specified parameters:
double rInit_;
double Temp_; // instance temperature (TEMP)
double Temp_; // instance temperature (TEMP)

// Derived parameters:
double G; //< Conductance(1.0/ohms)
Expand Down

0 comments on commit 1299dfd

Please sign in to comment.