46 #include <Xyce_config.h>
63 #include <N_ERH_ErrorMgr.h>
67 #include <N_LAS_Matrix.h>
68 #include <N_LAS_Vector.h>
69 #include <N_UTL_FeatureTest.h>
82 .setDescription(
"Maximal Synaptic Conductance");
89 .setDescription(
"Presynaptic voltage spike threhsold");
93 .setDescription(
"Time delay between presynaptic signal and postsynaptic response");
97 .setDescription(
"Maximal Synaptic Conductance");
101 .setDescription(
"Postsynaptic Reversal Potential");
105 .setDescription(
"Rise time constant");
109 .setDescription(
"Decay time constant");
153 :
DeviceInstance(IB, configuration.getInstanceParameters(), factory_block),
161 #ifdef Xyce_FullSynapseJac
162 APostEquPostNodeOffset(-1),
163 f_PostEquPostNodePtr(0),
167 randInitialized(false)
178 #ifdef Xyce_FullSynapseJac
220 const std::vector<int> & extLIDVecRef )
225 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
227 Xyce::dout() << std::endl << section_divider << std::endl;
228 Xyce::dout() <<
" SynapseInstance::registerLIDs" << std::endl;
229 Xyce::dout() <<
" name = " <<
getName() << std::endl;
239 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) )
241 Xyce::dout() <<
" li_Prev = " <<
li_Prev << std::endl;
242 Xyce::dout() <<
" li_Post = " <<
li_Post << std::endl;
250 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) )
252 Xyce::dout() << section_divider << std::endl;
323 #ifdef Xyce_FullSynapseJac
324 APostEquPostNodeOffset = jacLIDVec[1][0];
338 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
339 #ifdef Xyce_FullSynapseJac
341 f_PostEquPostNodePtr = &(dFdx[
li_Post][APostEquPostNodeOffset]);
356 bool bsuccess =
true;
371 unsigned int aSeed =
static_cast<unsigned int>(time( NULL ) ) ;
379 double vPre = lastSolVecPtr[
li_Prev];
380 double vPost = lastSolVecPtr[
li_Post];
411 double Anow = stoVector[
li_A0_store] * exp( - ( time - t0 ) / tau1 );
412 double Bnow = stoVector[
li_B0_store] * exp( - ( time - t0 ) / tau2 );
420 double cond = Bnow-Anow;
421 ipost = cond*(vPost-eRev);
424 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
426 Xyce::dout() << std::endl << section_divider << std::endl;
427 Xyce::dout() <<
" SynapseInstance::updateIntermediateVars" << std::endl;
428 Xyce::dout() <<
"Anow: " << Anow << std::endl;
429 Xyce::dout() <<
"Bnow: " << Bnow << std::endl;
430 Xyce::dout() <<
"vPost: " << vPost << std::endl;
431 Xyce::dout() <<
"eRev: " << eRev << std::endl;
432 Xyce::dout() <<
"ipost: " <<
ipost << std::endl;
433 Xyce::dout() <<
"didVpost: " << didVpost << std::endl;
560 #ifdef Xyce_FullSynapseJac
580 bool bsuccess =
true;
599 double deltaAB = factor*
gMax;
603 double Anow = stoVector[
li_A0_store] * exp( - ( time - t0 ) / tau1 );
604 double Bnow = stoVector[
li_B0_store] * exp( - ( time - t0 ) / tau2 );
642 bool bsuccess =
true;
679 std::vector<Instance*>::iterator iter;
683 for (iter=first; iter!=last; ++iter)
685 (*iter)->processParams();
703 :
DeviceModel(MB, configuration.getModelParameters(), factory_block),
737 std::vector<Instance*>::iterator iter;
741 for (iter=first; iter!=last; ++iter)
757 std::vector<Instance*>::const_iterator iter;
764 os <<
"Number of Synapse4 Instances: " << isize << std::endl;
765 os <<
" name model name Parameters" << std::endl;
766 for (i=0, iter=first; iter!=last; ++iter, ++i)
768 os <<
" " << i <<
": " << (*iter)->getName() <<
"\t";
793 for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
814 bool bsuccess =
true;
817 #pragma omp parallel for reduction (&&:bsuccess)
822 bool tmpBool = (*it)->updateIntermediateVars();
823 bsuccess = bsuccess && tmpBool;
852 bool Master::loadDAEVectors(
double * solVec,
double * fVec,
double * qVec,
double * bVec,
double * storeLeadF,
double * storeLeadQ,
double * leadF,
double * leadQ,
double * junctionV)
860 bool bsuccess =
true;
870 bool tmpBool = (*it)->loadDAEFVector();
871 bsuccess = bsuccess && tmpBool;
893 bool bsuccess =
true;
903 bool tmpBool = (*it)->loadDAEdFdx();
904 bsuccess = bsuccess && tmpBool;
919 .registerDevice(
"synapse", 4)
920 .registerModelType(
"synapse", 4);
const InstanceName & getName() const
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
bool updateTemperature(const double &temp_tmp)
virtual bool updateState(double *solVec, double *staVec, double *stoVec)
Updates the devices state information.
bool updateDependentParameters()
static std::vector< std::vector< int > > jacStamp
const DeviceOptions & deviceOptions_
Descriptor & addPar(const char *parName, T default_value, T U::*varPtr)
Adds the parameter description to the parameter map.
static void loadModelParameters(ParametricData< Model > &model_parameters)
virtual bool loadDAEVectors(double *solVec, double *fVec, double *qVec, double *bVec, double *storeLeadF, double *storeLeadQ, double *leadF, double *leadQ, double *junctionV)
Populates the device's ExternData object with these pointers.
Pure virtual class to augment a linear system.
bool updateIntermediateVars()
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
void setNumStoreVars(int num_store_vars)
InstanceVector::const_iterator getInstanceEnd() const
Returns an iterator to the ending of the vector of all instances created for this device...
virtual void registerJacLIDs(const JacobianStamp &jacLIDVec)
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
int getNumStoreVars() const
InstanceVector::const_iterator getInstanceBegin() const
Returns an iterator to the beginning of the vector of all instances created for this device...
int SetSeed(unsigned int seedIn)
std::vector< Param > params
Parameters from the line.
void setParams(const std::vector< Param > ¶ms)
const std::string & getName() const
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
void registerStoreLIDs(const std::vector< int > &stoLIDVecRef)
const DeviceOptions & getDeviceOptions() const
double * nextStoVectorRawPtr
virtual bool updateSecondaryState(double *staDeriv, double *stoVec)
Updates the devices secondary state information.
bool outputPlotFiles(bool force_final_output)
static Config< T > & addConfiguration()
Adds the device to the Xyce device configuration.
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
Linear::Matrix * dFdxMatrixPtr
bool processParams()
processParams
bool updateSecondaryState()
The Device class is an interface for device implementations.
void addStoreNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
bool processInstanceParams()
processInstanceParams
const SolverState & solverState_
Class Configuration contains device configuration data.
std::vector< Instance * > instanceContainer
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &Riter, const FactoryBlock &factory_block)
const SolverState & getSolverState() const
virtual std::ostream & printOutInstances(std::ostream &os) const
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
Linear::Vector * daeFVectorPtr
virtual bool loadDAEMatrices(Linear::Matrix &dFdx, Linear::Matrix &dQdx)
Populates the device's Jacobian object with these pointers.
const std::vector< std::vector< int > > & jacobianStamp() const
const ExternData & extData
ModelBlock represents a .MODEL line from the netlist.
Manages parameter binding for class C.
InstanceBlock represent a device instance line from the netlist.
double currTime_
DeviceEntity for expression time, breakpoints DeviceMgr for dependent parameters, breakpoints...
std::vector< Param > params
double * lastSolVectorRawPtr
double * lastStoVectorRawPtr
bool updatePrimaryState()
const SolverState & getSolverState() const
Returns the solver state given during device construction.
void setModParams(const std::vector< Param > ¶ms)
int numLeadCurrentStoreVars