46 #ifndef Xyce_N_DEV_Neuron4_h
47 #define Xyce_N_DEV_Neuron4_h
68 static const char *
name() {
return "Neuron";}
110 void registerLIDs(
const std::vector<int> & intLIDVecRef,
111 const std::vector<int> & extLIDVecRef );
116 const std::vector< std::vector<int> > &
jacobianStamp()
const;
117 void registerJacLIDs(
const std::vector< std::vector<int> > & jacLIDVec );
127 void varTypes( std::vector<char> & varTypeVec );
153 template <
typename ScalarT>
154 static ScalarT
alphaN(
const ScalarT Vin)
156 ScalarT vScaled = 1000.0 * Vin;
157 ScalarT r = 1000.0 * (0.02 * (vScaled + 45.7)) / (1.0 - std::exp(-0.1*(vScaled+45.7)));
162 template <
typename ScalarT>
163 static ScalarT
betaN(
const ScalarT Vin)
165 ScalarT vScaled = 1000.0 * Vin;
166 ScalarT r = 1000.0 * 0.25 * std::exp( -0.0125 * (vScaled + 55.7));
172 template <
typename ScalarT>
173 static ScalarT
alphaM(
const ScalarT Vin)
175 ScalarT vScaled = 1000.0 * Vin;
176 ScalarT r = 1000.0 * (0.38 * (vScaled + 29.7)) / (1.0 - std::exp(-0.1*(vScaled+29.7)));
181 template <
typename ScalarT>
182 static ScalarT
betaM(
const ScalarT Vin)
184 ScalarT vScaled = 1000.0 * Vin;
185 ScalarT r = 1000.0 * 15.2 * std::exp( -0.0556 * (vScaled + 54.7));
190 template <
typename ScalarT>
191 static ScalarT
alphaH(
const ScalarT Vin)
193 ScalarT vScaled = 1000.0 * Vin;
194 ScalarT r = 1000.0 * 0.266 * std::exp( -0.05 * (vScaled + 48.0));
199 template <
typename ScalarT>
200 static ScalarT
betaH(
const ScalarT Vin)
202 ScalarT vScaled = 1000.0 * Vin;
203 ScalarT r = 1000.0 * 3.8 / (1.0 + std::exp(-0.1*(vScaled+18.0)));
209 template <
typename ScalarT>
210 static ScalarT
aInf(
const ScalarT Vin)
212 ScalarT vScaled = 1000.0 * Vin;
213 ScalarT r = std::pow( ((0.0761 * std::exp(0.0314 * (vScaled+94.22))) / (1.0+std::exp(0.0346*(vScaled+1.17)))), 1.0/3.0);
217 template <
typename ScalarT>
218 static ScalarT
aTau(
const ScalarT Vin)
220 ScalarT vScaled = 1000.0 * Vin;
221 ScalarT r = (0.3632 + 1.158 / (1.0 + std::exp(0.0497 * (vScaled + 55.96)))) / 1000.0;
225 template <
typename ScalarT>
226 static ScalarT
bInf(
const ScalarT Vin)
228 ScalarT vScaled = 1000.0 * Vin;
229 ScalarT r = std::pow( (1.0 / (1.0 + std::exp(0.0688*(vScaled+53.3)))), 4.0);
233 template <
typename ScalarT>
234 static ScalarT
bTau(
const ScalarT Vin)
236 ScalarT vScaled = 1000.0 * Vin;
237 ScalarT r = (1.24 + 2.678 / (1.0 + std::exp(0.0624 * (vScaled + 50.0)))) / 1000.0;
242 template <
typename ScalarT>
243 static ScalarT
M_Inf(
const ScalarT Vin)
245 ScalarT vScaled = 1000.0 * Vin;
246 ScalarT r = 1.0/(1.0 + std::exp(-(vScaled+57)/6.2));
250 template <
typename ScalarT>
251 static ScalarT
M_Tau(
const ScalarT Vin)
253 ScalarT vScaled = 1000.0 * Vin;
254 ScalarT r = (0.612 + 1.0/(std::exp(-(vScaled+132)/16.7) + std::exp((vScaled+16.8)/18.2)) ) / 1000.0;
258 template <
typename ScalarT>
259 static ScalarT
H_Inf(
const ScalarT Vin)
261 ScalarT vScaled = 1000.0 * Vin;
262 ScalarT r = 1.0 / (1.0 + std::exp((vScaled+81)/4.0));
266 template <
typename ScalarT>
267 static ScalarT
H_Tau(
const ScalarT Vin)
269 ScalarT vScaled = 1000.0 * Vin;
271 if( vScaled < -80.0 )
273 r = std::exp( (vScaled + 467)/66.6 ) / 1000.0;
277 r = ( 28.0 + std::exp(-(vScaled+22.0)/10.5)) / 1000.0;
283 template <
typename ScalarT>
284 static ScalarT
C_Inf(
const ScalarT Vin,
const ScalarT CaConc)
286 ScalarT vScaled = 1000.0 * Vin;
287 ScalarT r = (CaConc / (CaConc + 3.0)) * (1.0 / (1.0 + std::exp(-(vScaled+28.3)/12.6 )));
291 template <
typename ScalarT>
292 static ScalarT
C_Tau(
const ScalarT Vin)
294 ScalarT vScaled = 1000.0 * Vin;
295 ScalarT r = (90.3 - 75.1/(1.0 + std::exp(-(vScaled+46)/22.7))) / 1000.0;
302 template <
typename ScalarT>
303 static ScalarT
kcl1EquF(
const ScalarT& VSeg,
const ScalarT& VSegP,
const ScalarT & VSegN,
const ScalarT& n,
const ScalarT& m,
const ScalarT& h,
304 const ScalarT& a,
const ScalarT& b,
const ScalarT&
MC,
const ScalarT& HC,
const ScalarT& CC,
305 const ScalarT& gPrev,
const ScalarT& gNext,
306 const ScalarT& memG,
const ScalarT& restV,
const ScalarT& Kg,
const ScalarT& Ke,
const ScalarT& NaG,
const ScalarT& NaE,
307 const ScalarT& Ag,
const ScalarT& Ae,
const ScalarT& CaTg,
const ScalarT& CaE,
const ScalarT& KCaG)
309 ScalarT powN = n * n * n * n;
310 ScalarT powM = m * m * m;
311 ScalarT powA = a * a * a;
312 ScalarT powMC = MC *
MC;
313 ScalarT powCC = CC * CC * CC * CC;
314 ScalarT r = memG * (VSeg - restV) + Kg * powN * (VSeg - Ke ) + NaG * powM * h * (VSeg - NaE )
315 + Ag * powA * b * (VSeg - Ae) + CaTg * powMC * HC * (VSeg - CaE) + KCaG * powCC * (VSeg - Ke) - gNext * (VSegN - VSeg) - gPrev * (VSegP - VSeg);
319 template <
typename ScalarT>
320 static ScalarT
kcl1EquQ(
const ScalarT& VSeg,
const ScalarT& memC )
322 ScalarT r = memC * VSeg;
328 template <
typename ScalarT>
329 static ScalarT
kcl2EquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& m,
const ScalarT& h,
330 const ScalarT& a,
const ScalarT& b,
const ScalarT&
MC,
const ScalarT& HC,
const ScalarT& CC,
331 const ScalarT& memG,
const ScalarT& restV,
const ScalarT& Kg,
const ScalarT& Ke,
const ScalarT& NaG,
const ScalarT& NaE,
332 const ScalarT& Ag,
const ScalarT& Ae,
const ScalarT& CaTg,
const ScalarT& CaE,
const ScalarT& KCaG)
334 ScalarT powN = n * n * n * n;
335 ScalarT powM = m * m * m;
336 ScalarT powA = a * a * a;
337 ScalarT powMC = MC *
MC;
338 ScalarT powCC = CC * CC * CC * CC;
339 ScalarT r = -1.0 * (memG * (Vn1 - Vn2 - restV) + Kg * powN * (Vn1 - Vn2 - Ke ) + NaG * powM * h * (Vn1 - Vn2 - NaE )
340 + Ag * powA * b * (Vn1 - Vn2 - Ae) + CaTg * powMC * HC * (Vn1 - Vn2 - CaE) + KCaG * powCC * (Vn1 - Vn2 - Ke) );
344 template <
typename ScalarT>
345 static ScalarT
kcl2EquQ(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& memC )
347 ScalarT r = -1.0 * memC * (Vn1 - Vn2);
353 template <
typename ScalarT>
354 static ScalarT
nEquF(
const ScalarT& Vn1,
const ScalarT& n,
const ScalarT& Vrest )
357 ScalarT alpha = alphaN<ScalarT>(vDiff);
358 ScalarT beta = betaN<ScalarT>(vDiff);
359 ScalarT r = (alpha + beta) * n - alpha;
363 template <
typename ScalarT>
364 static ScalarT
nEquQ(
const ScalarT& n )
371 template <
typename ScalarT>
372 static ScalarT
mEquF(
const ScalarT& Vn1,
const ScalarT& m,
const ScalarT& Vrest )
375 ScalarT alpha = alphaM<ScalarT>(vDiff);
376 ScalarT beta = betaM<ScalarT>(vDiff);
377 ScalarT r = (alpha + beta) * m - alpha;
381 template <
typename ScalarT>
382 static ScalarT
mEquQ(
const ScalarT& m )
389 template <
typename ScalarT>
390 static ScalarT
hEquF(
const ScalarT& Vn1,
const ScalarT& h,
const ScalarT& Vrest )
393 ScalarT alpha = alphaH<ScalarT>(vDiff);
394 ScalarT beta = betaH<ScalarT>(vDiff);
395 ScalarT r = (alpha + beta) * h - alpha;
399 template <
typename ScalarT>
400 static ScalarT
hEquQ(
const ScalarT& h )
407 template <
typename ScalarT>
408 static ScalarT
aEquF(
const ScalarT& Vn1,
const ScalarT& a,
const ScalarT& Vrest )
411 ScalarT Inf = aInf<ScalarT>(vDiff);
412 ScalarT Tau = aTau<ScalarT>(vDiff);
413 ScalarT r = (a - Inf)/Tau;
417 template <
typename ScalarT>
418 static ScalarT
aEquQ(
const ScalarT& a )
425 template <
typename ScalarT>
426 static ScalarT
bEquF(
const ScalarT& Vn1,
const ScalarT& b,
const ScalarT& Vrest )
429 ScalarT Inf = bInf<ScalarT>(vDiff);
430 ScalarT Tau = bTau<ScalarT>(vDiff);
431 ScalarT r = (b - Inf)/Tau;
435 template <
typename ScalarT>
436 static ScalarT
bEquQ(
const ScalarT& b )
443 template <
typename ScalarT>
444 static ScalarT
M_EquF(
const ScalarT& Vn1,
const ScalarT&
M,
const ScalarT& Vrest )
447 ScalarT Inf = M_Inf<ScalarT>(vDiff);
448 ScalarT Tau = M_Tau<ScalarT>(vDiff);
449 ScalarT r = (M - Inf)/Tau;
453 template <
typename ScalarT>
461 template <
typename ScalarT>
462 static ScalarT
H_EquF(
const ScalarT& Vn1,
const ScalarT& H,
const ScalarT& Vrest )
465 ScalarT Inf = H_Inf<ScalarT>(vDiff);
466 ScalarT Tau = H_Tau<ScalarT>(vDiff);
467 ScalarT r = (H - Inf)/Tau;
471 template <
typename ScalarT>
472 static ScalarT
H_EquQ(
const ScalarT& H )
479 template <
typename ScalarT>
480 static ScalarT
C_EquF(
const ScalarT& Vn1,
const ScalarT& C,
const ScalarT& CaConc,
const ScalarT& Vrest )
483 ScalarT Inf = C_Inf<ScalarT>(vDiff, CaConc);
484 ScalarT Tau = C_Tau<ScalarT>(vDiff);
485 ScalarT r = (C - Inf)/Tau;
489 template <
typename ScalarT>
490 static ScalarT
C_EquQ(
const ScalarT& C )
497 template <
typename ScalarT>
498 static ScalarT
Ca_EquF(
const ScalarT& Vn1,
const ScalarT&
MC,
const ScalarT& HC,
const ScalarT& Ca,
499 const ScalarT& CaTg,
const ScalarT& CaE,
const ScalarT& CaGamma,
const ScalarT& CaTau )
501 ScalarT r = CaGamma * CaTg * MC * MC * HC * (Vn1 - CaE) + Ca / CaTau;
505 template <
typename ScalarT>
577 std::vector<double>
segF_dVp,
segF_dV,
segF_dVn,
segF_dn,
segF_dm,
segF_dh,
segF_da,
segF_db,
segF_dM,
segF_dH,
segF_dc;
static ScalarT bEquQ(const ScalarT &b)
std::vector< double > segHEquFvalue
bool updateTemperature(const double &temp_tmp)
std::vector< double > dmF_dV
std::vector< double > segBEquFvalue
std::vector< int > SegVEqnVsegOffset
std::vector< int > li_NaCurrentState
std::vector< double > dCaQ_dCa
std::vector< double > dCaF_dM
bool processInstanceParams()
processInstanceParams
static ScalarT bInf(const ScalarT Vin)
std::vector< double > dMF_dM
std::vector< double > segAEquFvalue
static ScalarT H_Inf(const ScalarT Vin)
std::vector< int > SegVEqnH_Offset
static ScalarT M_Tau(const ScalarT Vin)
std::vector< double > dnF_dn
std::vector< double > dcF_dV
std::vector< double > dnQ_dn
Pure virtual class to augment a linear system.
std::vector< int > li_aPro
std::vector< int > li_KCurrentState
std::vector< int > MEquVNodeOffset
std::vector< double > dcF_dc
std::vector< double > segF_dM
static ScalarT aTau(const ScalarT Vin)
std::vector< int > li_hPro
std::vector< Instance * > instanceContainer
std::vector< double > segFvalue
std::vector< double > segH_EquFvalue
std::vector< double > gForward
static ScalarT M_EquQ(const ScalarT &M)
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
static ScalarT nEquQ(const ScalarT &n)
std::vector< double > segF_dn
static ScalarT betaH(const ScalarT Vin)
std::vector< int > CEquCNodeOffset
std::vector< double > dhF_dV
virtual std::ostream & printOutInstances(std::ostream &os) const
std::vector< int > HEquHNodeOffset
std::vector< int > CaEquVNodeOffset
std::vector< double > dbQ_db
std::vector< int > BEquBNodeOffset
std::vector< double > dcF_dCa
std::vector< double > segM_EquQvalue
std::vector< double > segQ_dV
std::vector< int > CaEquCaNodeOffset
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &Miter, const FactoryBlock &factory_block)
std::vector< int > CaEquM_NodeOffset
std::vector< double > dmQ_dm
std::vector< int > M_EquM_NodeOffset
std::vector< int > li_bPro
std::vector< double > dHF_dV
bool updateIntermediateVars()
int APosEquNextNodeOffset
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
std::vector< int > li_Vol
std::vector< int > MEquMNodeOffset
std::vector< double > dmF_dm
std::vector< int > SegVEqnBOffset
std::vector< double > dCaF_dCa
static ScalarT H_Tau(const ScalarT Vin)
std::vector< int > NEquVNodeOffset
std::vector< int > li_nPro
const std::vector< std::vector< int > > & jacobianStamp() const
std::vector< double > segF_dc
static ScalarT mEquQ(const ScalarT &m)
static ScalarT C_EquQ(const ScalarT &C)
std::vector< double > segNEquQvalue
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
std::vector< double > potassiumCurrent
std::vector< double > segMEquFvalue
static ScalarT betaM(const ScalarT Vin)
static ScalarT alphaM(const ScalarT Vin)
static ScalarT C_Tau(const ScalarT Vin)
static ScalarT hEquQ(const ScalarT &h)
std::vector< double > gBackward
static ScalarT aEquF(const ScalarT &Vn1, const ScalarT &a, const ScalarT &Vrest)
std::vector< double > segF_dh
std::vector< double > segF_db
void varTypes(std::vector< char > &varTypeVec)
static ScalarT bEquF(const ScalarT &Vn1, const ScalarT &b, const ScalarT &Vrest)
std::vector< double > segMEquQvalue
std::vector< int > SegVEqnAOffset
static ScalarT C_Inf(const ScalarT Vin, const ScalarT CaConc)
void auxDAECalculations()
std::vector< double > dMF_dV
std::vector< double > segF_dVn
static ScalarT bTau(const ScalarT Vin)
std::vector< double > dCaF_dH
std::vector< double > dbF_dV
std::vector< double > segF_dH
std::vector< int > SegVEqnM_Offset
std::vector< int > li_HPro
std::vector< double > daF_dV
static ScalarT M_Inf(const ScalarT Vin)
static ScalarT H_EquQ(const ScalarT &H)
std::vector< double > segF_dVp
static ScalarT aEquQ(const ScalarT &a)
The Device class is an interface for device implementations.
std::vector< Instance * > InstanceVector
static ScalarT kcl1EquQ(const ScalarT &VSeg, const ScalarT &memC)
static ScalarT betaN(const ScalarT Vin)
std::vector< double > segF_dV
std::vector< int > M_EquVNodeOffset
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
std::vector< double > dMQ_dM
static ScalarT alphaH(const ScalarT Vin)
std::vector< double > dnF_dV
std::vector< double > segF_dm
std::vector< int > li_cPro
Class Configuration contains device configuration data.
int ANegEquLastNodeOffset
static ScalarT mEquF(const ScalarT &Vn1, const ScalarT &m, const ScalarT &Vrest)
std::vector< double > segBEquQvalue
std::vector< int > CEquVNodeOffset
std::vector< double > segH_EquQvalue
std::vector< double > daQ_da
std::vector< int > H_EquVNodeOffset
std::vector< int > AEquANodeOffset
std::vector< int > SegVEqnVnexOffset
std::vector< double > dhQ_dh
static ScalarT kcl2EquQ(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &memC)
std::vector< double > segCaEquQvalue
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
std::vector< double > segNEquFvalue
std::vector< int > SegVEqnCOffset
Model & operator=(const Model &)
bool updateSecondaryState()
std::vector< double > dHF_dH
static ScalarT C_EquF(const ScalarT &Vn1, const ScalarT &C, const ScalarT &CaConc, const ScalarT &Vrest)
Instance & operator=(const Instance &)
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
static ScalarT nEquF(const ScalarT &Vn1, const ScalarT &n, const ScalarT &Vrest)
std::vector< double > daF_da
static ScalarT aInf(const ScalarT Vin)
std::vector< double > segCEquQvalue
std::vector< int > li_CaPro
static ScalarT Ca_EquF(const ScalarT &Vn1, const ScalarT &MC, const ScalarT &HC, const ScalarT &Ca, const ScalarT &CaTg, const ScalarT &CaE, const ScalarT &CaGamma, const ScalarT &CaTau)
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
static ScalarT alphaN(const ScalarT Vin)
bool updatePrimaryState()
static bool modelRequired()
std::vector< double > segAEquQvalue
std::vector< double > sodiumCurrent
std::vector< int > SegVEqnMOffset
std::vector< int > SegVEqnVpreOffset
std::vector< int > CEquCaNodeOffset
std::vector< double > dhF_dh
std::vector< int > AEquVNodeOffset
static ScalarT kcl1EquF(const ScalarT &VSeg, const ScalarT &VSegP, const ScalarT &VSegN, const ScalarT &n, const ScalarT &m, const ScalarT &h, const ScalarT &a, const ScalarT &b, const ScalarT &MC, const ScalarT &HC, const ScalarT &CC, const ScalarT &gPrev, const ScalarT &gNext, const ScalarT &memG, const ScalarT &restV, const ScalarT &Kg, const ScalarT &Ke, const ScalarT &NaG, const ScalarT &NaE, const ScalarT &Ag, const ScalarT &Ae, const ScalarT &CaTg, const ScalarT &CaE, const ScalarT &KCaG)
std::vector< int > li_mPro
std::vector< int > SegVEqnHOffset
static ScalarT kcl2EquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &n, const ScalarT &m, const ScalarT &h, const ScalarT &a, const ScalarT &b, const ScalarT &MC, const ScalarT &HC, const ScalarT &CC, const ScalarT &memG, const ScalarT &restV, const ScalarT &Kg, const ScalarT &Ke, const ScalarT &NaG, const ScalarT &NaE, const ScalarT &Ag, const ScalarT &Ae, const ScalarT &CaTg, const ScalarT &CaE, const ScalarT &KCaG)
std::vector< double > dHQ_dH
std::vector< double > segM_EquFvalue
ModelBlock represents a .MODEL line from the netlist.
std::vector< int > li_MPro
std::vector< std::vector< int > > jacStamp
The DeviceTraits template describes the configuration of a device.
static const char * deviceTypeName()
Manages parameter binding for class C.
std::vector< int > HEquVNodeOffset
static bool isLinearDevice()
InstanceBlock represent a device instance line from the netlist.
static ScalarT M_EquF(const ScalarT &Vn1, const ScalarT &M, const ScalarT &Vrest)
static const char * name()
std::vector< double > dCaF_dV
static ScalarT H_EquF(const ScalarT &Vn1, const ScalarT &H, const ScalarT &Vrest)
static ScalarT Ca_EquQ(const ScalarT &Ca)
std::vector< double > segQvalue
std::vector< double > segCaEquFvalue
std::vector< int > H_EquH_NodeOffset
std::vector< double > segHEquQvalue
static void loadModelParameters(ParametricData< Model > &model_parameters)
std::vector< double > segCEquFvalue
std::vector< int > BEquVNodeOffset
static ScalarT hEquF(const ScalarT &Vn1, const ScalarT &h, const ScalarT &Vrest)
std::vector< int > CaEquH_NodeOffset
void addInstance(Instance *instance)
std::vector< int > SegVEqnNOffset
bool processParams()
processParams
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
std::vector< double > segF_da
std::vector< double > dbF_db
std::vector< int > NEquNNodeOffset
std::vector< double > dcQ_dc