46 #ifndef Xyce_N_DEV_Neuron9_h
47 #define Xyce_N_DEV_Neuron9_h
69 static const char *
name() {
return "Neuron";}
97 static std::vector< std::vector<int> >
jacStamp;
113 void registerLIDs(
const std::vector<int> & intLIDVecRef,
114 const std::vector<int> & extLIDVecRef );
119 const std::vector< std::vector<int> > &
jacobianStamp()
const;
120 void registerJacLIDs(
const std::vector< std::vector<int> > & jacLIDVec );
130 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);
163 r = 0.032*(15.0 - vDiff +
VT)/( std::exp( (15.0 - vDiff +
VT)/5.0) - 1.0);
168 template <
typename ScalarT>
169 static ScalarT
betaN(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
171 ScalarT vDiff = 1000.0 * (Vn1 - Vn2);
173 r = 0.5*( std::exp( (10.0 - vDiff +
VT)/40.0) );
179 template <
typename ScalarT>
180 static ScalarT
alphaM(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
182 ScalarT vDiff = 1000.0 * (Vn1 - Vn2);
184 r = 0.32*(13.0 - vDiff +
VT )/( std::exp((13.0 - vDiff +
VT )/4.0) - 1.0);
189 template <
typename ScalarT>
190 static ScalarT
betaM(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
192 ScalarT vDiff = 1000.0 * (Vn1 - Vn2);
194 r = 0.28*(vDiff -
VT - 40.0)/( std::exp((vDiff -
VT - 40.0)/5.0) - 1.0);
199 template <
typename ScalarT>
200 static ScalarT
alphaH(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
202 ScalarT vDiff = 1000.0 * (Vn1 - Vn2);
204 r = 0.128 * std::exp( (17.0 - vDiff +
VT)/18.0 );
209 template <
typename ScalarT>
210 static ScalarT
betaH(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
212 ScalarT vDiff = 1000.0 * (Vn1 - Vn2);
214 r = 4.0/( 1.0 + std::exp( (40.0 - vDiff +
VT)/5.0) );
221 template <
typename ScalarT>
222 static ScalarT
kcl1EquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& m,
const ScalarT& h,
223 const ScalarT& memG,
const ScalarT& leakE,
const ScalarT& Kg,
const ScalarT& Ke,
const ScalarT& NaG,
const ScalarT& NaE )
225 ScalarT powN = n * n * n * n;
226 ScalarT powM = m * m * m;
227 ScalarT r = memG * (Vn1 - Vn2 - leakE) + Kg * powN * (Vn1 - Vn2 - Ke ) + NaG * powM * h * (Vn1 - Vn2 - NaE );
231 template <
typename ScalarT>
232 static ScalarT
kcl1EquQ(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& memC )
234 ScalarT r = memC * (Vn1 - Vn2);
239 template <
typename ScalarT>
240 static ScalarT
kcl2EquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& m,
const ScalarT& h,
241 const ScalarT& memG,
const ScalarT& leakE,
const ScalarT& Kg,
const ScalarT& Ke,
const ScalarT& NaG,
const ScalarT& NaE )
243 ScalarT powN = n * n * n * n;
244 ScalarT powM = m * m * m;
245 ScalarT r = -1.0*(memG * (Vn1 - Vn2 - leakE) + Kg * powN * (Vn1 - Vn2 - Ke ) + NaG * powM * h * (Vn1 - Vn2 - NaE ));
249 template <
typename ScalarT>
250 static ScalarT
kcl2EquQ(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& memC )
252 ScalarT r = -1.0 * memC * (Vn1 - Vn2);
257 template <
typename ScalarT>
258 static ScalarT
nEquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& Vrest )
260 ScalarT r = alphaN<ScalarT>( Vn1, Vn2, Vrest ) * (1.0 - n ) - betaN<ScalarT>( Vn1, Vn2, Vrest ) * n;
264 template <
typename ScalarT>
265 static ScalarT
nEquQ(
const ScalarT& n )
272 template <
typename ScalarT>
273 static ScalarT
mEquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& m,
const ScalarT& Vrest )
275 ScalarT r = alphaM<ScalarT>( Vn1, Vn2, Vrest ) * (1.0 - m ) - betaM<ScalarT>( Vn1, Vn2, Vrest ) * m;
279 template <
typename ScalarT>
280 static ScalarT
mEquQ(
const ScalarT& m )
287 template <
typename ScalarT>
288 static ScalarT
hEquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& h,
const ScalarT& Vrest )
290 ScalarT r = alphaH<ScalarT>( Vn1, Vn2, Vrest ) * (1.0 - h ) - betaH<ScalarT>( Vn1, Vn2, Vrest ) * h;
294 template <
typename ScalarT>
295 static ScalarT
hEquQ(
const ScalarT& h )
314 static const double VT;
459 virtual bool updateState (
double * solVec,
double * staVec,
double * stoVec);
static ScalarT betaM(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
bool processParams()
processParams
static ScalarT nEquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &n, const ScalarT &Vrest)
static bool modelRequired()
void addInstance(Instance *instance)
static ScalarT hEquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &h, const ScalarT &Vrest)
Pure virtual class to augment a linear system.
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
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)
Master(const Configuration &configuration, const FactoryBlock &factory_block, const SolverState &ss1, const DeviceOptions &do1)
static const char * deviceTypeName()
bool updateSecondaryState()
static const char * name()
static ScalarT kcl1EquQ(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &memC)
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &Miter, const FactoryBlock &factory_block)
void auxDAECalculations()
bool processInstanceParams()
processInstanceParams
DeviceMaster instantiates a device as described by the device traits T.
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
static ScalarT mEquQ(const ScalarT &m)
virtual bool updateState(double *solVec, double *staVec, double *stoVec)
Updates the devices state information.
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
bool updateIntermediateVars()
static ScalarT betaN(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
static void loadModelParameters(ParametricData< Model > &model_parameters)
virtual std::ostream & printOutInstances(std::ostream &os) const
Model & operator=(const Model &)
static ScalarT hEquQ(const ScalarT &h)
static ScalarT nEquQ(const ScalarT &n)
The Device class is an interface for device implementations.
std::vector< Instance * > instanceContainer
static bool isLinearDevice()
Class Configuration contains device configuration data.
Instance & operator=(const Instance &)
std::vector< Instance * > InstanceVector
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
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)
static ScalarT alphaM(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
static ScalarT kcl2EquQ(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &memC)
bool updateTemperature(const double &temp_tmp)
static ScalarT mEquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &m, const ScalarT &Vrest)
static ScalarT alphaN(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
const std::vector< std::vector< int > > & jacobianStamp() const
void varTypes(std::vector< char > &varTypeVec)
static std::vector< std::vector< int > > jacStamp
ModelBlock represents a .MODEL line from the netlist.
The DeviceTraits template describes the configuration of a device.
static ScalarT alphaH(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)
bool updatePrimaryState()
Manages parameter binding for class C.
InstanceBlock represent a device instance line from the netlist.
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
static ScalarT betaH(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &Vrest)