48 #include <Xyce_config.h>
53 #include <N_UTL_Math.h>
63 #include <N_LAS_Vector.h>
64 #include <N_LAS_Matrix.h>
65 #include <N_UTL_FeatureTest.h>
78 .setDescription(
"internal Resistance");
85 .setDescription(
"Lower limit of ADC voltage range");
89 .setDescription(
"Upper limit of ADC voltage range");
93 .setDescription(
"Settling time");
126 :
DeviceInstance(instance_block, configuration.getInstanceParameters(), factory_block),
132 outputBitVectorWidth_(1),
138 APosEquPosNodeOffset(-1),
139 APosEquNegNodeOffset(-1),
140 ANegEquPosNodeOffset(-1),
141 ANegEquNegNodeOffset(-1)
173 if (
R != 0.0)
G = 1.0/
R;
200 const std::vector<int> & extLIDVecRef)
205 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) )
207 Xyce::dout() << std::endl << section_divider << std::endl;
208 Xyce::dout() <<
" ADCInstance::registerLIDs" << std::endl;
209 Xyce::dout() <<
" name = " <<
getName() << std::endl;
222 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) )
223 Xyce::dout() <<
" li_Pos = " <<
li_Pos << std::endl;
227 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) )
228 Xyce::dout() <<
" li_Neg = " <<
li_Neg << std::endl;
230 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) )
231 Xyce::dout() << section_divider << std::endl;
298 bool bsuccess =
true;
347 TVVEC_Out.insert(TVVEC_Out.end(),
TVVEC.begin(),
TVVEC.end());
365 std::vector< std::pair<double,double> >::iterator itVec;
368 itVec = lower_bound(
TVVEC.begin(),
TVVEC.end(),std::pair<double,double>(earliestTime,0.0));
387 bool bsuccess =
true;
414 bool bsuccess =
true;
418 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) &&
getSolverState().debugTimeFlag)
420 Xyce::dout() << subsection_divider <<std::endl;
421 Xyce::dout() <<
" name = " <<
getName() << std::endl;
422 Xyce::dout() <<
" G = " <<
G << std::endl;
447 bool bsuccess =
true;
461 double deltaV(0.0), vFrac(0.0);
501 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) &&
getSolverState().debugTimeFlag)
503 Xyce::dout() <<
"In Instance::getInstanceBreakPoints. deltaV = " << deltaV
504 <<
" and output state is " << newState
505 <<
" vFrac = " << vFrac <<
" nQuantLevels = " <<
nQuantLevels_ << std::endl;
511 long long int timeInFS =
static_cast<long long int>(
515 #ifdef Xyce_OLD_PRE_ROLLBACK
516 breakPointTimes.push_back( Util::BreakPoint(timeInFS*1e-15,PAUSE_BREAKPOINT));
528 TVVEC.push_back(std::pair<double,double>(timeInFS*1e-15,deltaV));
531 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) &&
getSolverState().debugTimeFlag)
533 Xyce::dout() <<
"ADC ----------------------------------------" << std::endl;
534 Xyce::dout() <<
"ADC Debug output. name = " <<
getName() << std::endl;
535 Xyce::dout() <<
"ADC setting pause breakpoint for " << currentTime << std::endl;
536 double approxTime = timeInFS*1e-15;
537 Xyce::dout() <<
"ADC Approximated time, to nearest femptosecond: " << approxTime << std::endl;
538 Xyce::dout() <<
"ADC Time value pairs: " << std::endl;
540 std::vector< std::pair<double, double> >::iterator beg =
TVVEC.begin();
541 std::vector< std::pair<double, double> >::iterator end =
TVVEC.end();
542 std::vector< std::pair<double, double> >::iterator itTV = beg;
544 for (; itTV!=end; ++itTV)
546 std::pair<double, double> & tvPair = *itTV;
547 Xyce::dout() <<
"ADC time: " << tvPair.first <<
" value: " << tvPair.second << std::endl;
550 Xyce::dout() <<
"ADC ----------------------------------------" << std::endl;
567 double vPos(0.0), vNeg(0.0), deltaV(0.0), vFrac(0.0);
578 TVVEC.push_back(std::pair<double,double>(0.0,deltaV));
606 std::vector<Instance*>::iterator iter;
610 for (iter=first; iter!=last; ++iter)
612 (*iter)->processParams();
654 for (
int i=0; i<width;++i)
657 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) &&
getSolverState().debugTimeFlag)
659 Xyce::dout() <<
"Instance::setBitVectorWidth name = "
660 <<
getName() <<
" width = " << width
678 :
DeviceModel(model_block, configuration.getModelParameters(), factory_block),
679 lowerVoltageLimit_(0.0),
680 upperVoltageLimit_(5.0),
708 std::vector<Instance*>::iterator iter;
712 for (iter=first; iter!=last; ++iter)
728 std::vector<Instance*>::const_iterator iter;
734 os <<
" name\t\tmodelName\tParameters" << std::endl;
736 for (i = 0, iter = first; iter != last; ++iter, ++i)
738 os <<
" " << i <<
": " << (*iter)->getName() <<
"\t";
749 for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
799 bool Master::loadDAEVectors (
double * solVec,
double * fVec,
double *qVec,
double * bVec,
double * storeLeadF,
double * storeLeadQ,
double * leadF,
double * leadQ,
double * junctionV)
848 bool bsuccess =
true;
853 bsuccess = bsuccess && tmpBool;
869 .registerDevice(
"adc", 1)
870 .registerModelType(
"adc", 1);
const InstanceName & getName() const
Instance(const Configuration &configuration, const InstanceBlock &instance_block, Model &model, const FactoryBlock &factory_block)
static std::vector< std::vector< int > > jacStamp
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
bool updateDependentParameters()
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 void forEachInstance(DeviceInstanceOp &op) const
double lowerVoltageLimit_
Pure virtual class to augment a linear system.
void getTVVEC(std::vector< std::pair< double, double > > &TVVVEC_Out)
bool processInstanceParams()
processInstanceParams
InstanceVector::const_iterator getInstanceEnd() const
Returns an iterator to the ending of the vector of all instances created for this device...
double upperVoltageLimit_
bool getInstanceBreakPoints(std::vector< Util::BreakPoint > &breakPointTimes)
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
bool getInstanceParamsMap(std::map< std::string, double > ¶msMap)
InstanceVector::const_iterator getInstanceBegin() const
Returns an iterator to the beginning of the vector of all instances created for this device...
virtual std::ostream & printOutInstances(std::ostream &os) const
std::vector< Param > params
Parameters from the line.
virtual bool loadDAEMatrices(Linear::Matrix &dFdx, Linear::Matrix &dQdx)
Populates the device's Jacobian object with these pointers.
void setParams(const std::vector< Param > ¶ms)
const std::string & getName() const
double * daeFVectorRawPtr
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
std::vector< std::pair< double, double > > TVVEC
std::vector< Instance * > instanceContainer
static Config< T > & addConfiguration()
Adds the device to the Xyce device configuration.
bool getBreakPoints(std::vector< Util::BreakPoint > &breakPointTimes)
Linear::Matrix * dFdxMatrixPtr
bool processParams()
processParams
The Device class is an interface for device implementations.
const std::vector< std::vector< int > > & jacobianStamp() const
bool updateIntermediateVars()
const SolverState & solverState_
virtual bool updateSecondaryState(double *staDeriv, double *stoVec)
Updates the devices secondary state information.
Class Configuration contains device configuration data.
bool setBitVectorWidth(int width)
void trimTVVEC(double earliestTime)
const SolverState & getSolverState() const
virtual void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
int outputBitVectorWidth_
virtual bool updateState(double *solVec, double *staVec, double *stoVec)
Updates the devices state information.
bool updatePrimaryState()
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
const ExternData & extData
ModelBlock represents a .MODEL line from the netlist.
Manages parameter binding for class C.
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
InstanceBlock represent a device instance line from the netlist.
std::vector< Param > params
void setModParams(const std::vector< Param > ¶ms)
double * nextSolVectorRawPtr
bool updateSecondaryState()
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.