46 #ifndef Xyce_N_DEV_Neuron_h
47 #define Xyce_N_DEV_Neuron_h
67 static const char *
name() {
return "Neuron";}
95 static std::vector< std::vector<int> >
jacStamp;
111 void registerLIDs(
const std::vector<int> & intLIDVecRef,
112 const std::vector<int> & extLIDVecRef );
117 const std::vector< std::vector<int> > &
jacobianStamp()
const;
118 void registerJacLIDs(
const std::vector< std::vector<int> > & jacLIDVec );
128 void varTypes( std::vector<char> & varTypeVec );
158 template <
typename ScalarT>
159 static ScalarT
alphaN(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
161 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
164 if ((vDiff > 9.99) && (vDiff < 10.01) )
166 r = 1.0/(10.0 * ( std::exp( (10.0 - vDiff)/10.0 )));
171 (100.0 * ( std::exp( (10.0 - vDiff)/10.0 ) - 1.0 ));
177 template <
typename ScalarT>
178 static ScalarT
betaN(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
180 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
181 ScalarT r = 0.125 * std::exp( -vDiff/80.0 );
187 template <
typename ScalarT>
188 static ScalarT
alphaM(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
190 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
192 if ((vDiff > 24.99) && (vDiff < 25.01) )
195 (( std::exp( (25.0 - vDiff)/10.0 )));
200 (10.0 * ( std::exp( (25.0 - vDiff)/10.0 ) - 1.0 ));
206 template <
typename ScalarT>
207 static ScalarT
betaM(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
209 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
210 ScalarT r = 4.0 * std::exp( -vDiff/18.0 );
216 template <
typename ScalarT>
217 static ScalarT
alphaH(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
219 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
220 ScalarT r = 0.07 * std::exp( -vDiff/20.0 );
225 template <
typename ScalarT>
226 static ScalarT
betaH(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
228 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
229 ScalarT r = 1.0 / ( std::exp( (30.0 - vDiff)/10.0 ) + 1.0 );
236 template <
typename ScalarT>
237 static ScalarT
kcl1EquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& m,
const ScalarT& h,
238 const ScalarT& memG,
const ScalarT& leakE,
const ScalarT& Kg,
const ScalarT& Ke,
const ScalarT& NaG,
const ScalarT& NaE )
240 ScalarT powN = n * n * n * n;
241 ScalarT powM = m * m * m;
242 ScalarT r = memG * (Vn1 - Vn2 - leakE) + Kg * powN * (Vn1 - Vn2 - Ke ) + NaG * powM * h * (Vn1 - Vn2 - NaE );
246 template <
typename ScalarT>
247 static ScalarT
kcl1EquQ(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& memC )
249 ScalarT r = memC * (Vn1 - Vn2);
254 template <
typename ScalarT>
255 static ScalarT
kcl2EquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& m,
const ScalarT& h,
256 const ScalarT& memG,
const ScalarT& leakE,
const ScalarT& Kg,
const ScalarT& Ke,
const ScalarT& NaG,
const ScalarT& NaE )
258 ScalarT powN = n * n * n * n;
259 ScalarT powM = m * m * m;
260 ScalarT r = -1.0*(memG * (Vn1 - Vn2 - leakE) + Kg * powN * (Vn1 - Vn2 - Ke ) + NaG * powM * h * (Vn1 - Vn2 - NaE ));
264 template <
typename ScalarT>
265 static ScalarT
kcl2EquQ(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& memC )
267 ScalarT r = -1.0 * memC * (Vn1 - Vn2);
272 template <
typename ScalarT>
273 static ScalarT
nEquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& Vrest )
275 ScalarT r = alphaN<ScalarT>( Vn1, Vn2, Vrest ) * (1.0 - n ) - betaN<ScalarT>( Vn1, Vn2, Vrest ) * n;
279 template <
typename ScalarT>
280 static ScalarT
nEquQ(
const ScalarT& n )
287 template <
typename ScalarT>
288 static ScalarT
mEquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& m,
const ScalarT& Vrest )
290 ScalarT r = alphaM<ScalarT>( Vn1, Vn2, Vrest ) * (1.0 - m ) - betaM<ScalarT>( Vn1, Vn2, Vrest ) * m;
294 template <
typename ScalarT>
295 static ScalarT
mEquQ(
const ScalarT& m )
302 template <
typename ScalarT>
303 static ScalarT
hEquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& h,
const ScalarT& Vrest )
305 ScalarT r = alphaH<ScalarT>( Vn1, Vn2, Vrest ) * (1.0 - h ) - betaH<ScalarT>( Vn1, Vn2, Vrest ) * h;
309 template <
typename ScalarT>
310 static ScalarT
hEquQ(
const ScalarT& h )
474 virtual bool updateState (
double * solVec,
double * staVec,
double * stoVec);
static ScalarT hEquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &h, const ScalarT &Vrest)
bool processParams()
processParams
static ScalarT kcl1EquQ(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &memC)
Pure virtual class to augment a linear system.
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
static ScalarT hEquQ(const ScalarT &h)
static ScalarT alphaN(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
static ScalarT nEquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &n, const ScalarT &Vrest)
bool updateSecondaryState()
Model & operator=(const Model &)
std::vector< Instance * > instanceContainer
static ScalarT alphaH(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
bool processInstanceParams()
processInstanceParams
void auxDAECalculations()
static bool isLinearDevice()
DeviceMaster instantiates a device as described by the device traits T.
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
static ScalarT kcl2EquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &n, const ScalarT &m, const ScalarT &h, const ScalarT &memG, const ScalarT &leakE, const ScalarT &Kg, const ScalarT &Ke, const ScalarT &NaG, const ScalarT &NaE)
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
bool updateIntermediateVars()
Instance & operator=(const Instance &)
static ScalarT nEquQ(const ScalarT &n)
bool updatePrimaryState()
bool updateTemperature(const double &temp_tmp)
static const char * name()
static ScalarT betaN(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
The Device class is an interface for device implementations.
static std::vector< std::vector< int > > jacStamp
static const char * deviceTypeName()
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
static ScalarT mEquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &m, const ScalarT &Vrest)
Class Configuration contains device configuration data.
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
const std::vector< std::vector< int > > & jacobianStamp() const
void varTypes(std::vector< char > &varTypeVec)
static ScalarT mEquQ(const ScalarT &m)
static ScalarT kcl2EquQ(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &memC)
void addInstance(Instance *instance)
virtual bool updateState(double *solVec, double *staVec, double *stoVec)
Updates the devices state information.
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
static void loadModelParameters(ParametricData< Model > &model_parameters)
Master(const Configuration &configuration, const FactoryBlock &factory_block, const SolverState &ss1, const DeviceOptions &do1)
static ScalarT betaM(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &Miter, const FactoryBlock &factory_block)
ModelBlock represents a .MODEL line from the netlist.
The DeviceTraits template describes the configuration of a device.
Manages parameter binding for class C.
static bool modelRequired()
InstanceBlock represent a device instance line from the netlist.
static ScalarT kcl1EquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &n, const ScalarT &m, const ScalarT &h, const ScalarT &memG, const ScalarT &leakE, const ScalarT &Kg, const ScalarT &Ke, const ScalarT &NaG, const ScalarT &NaE)
static ScalarT betaH(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
std::vector< Instance * > InstanceVector
virtual std::ostream & printOutInstances(std::ostream &os) const
static ScalarT alphaM(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)