45 #include <Xyce_config.h>
48 #include <N_UTL_Math.h>
57 #include <N_ERH_ErrorMgr.h>
59 #include <N_LAS_Vector.h>
60 #include <N_LAS_Matrix.h>
62 #include <N_UTL_Expression.h>
63 #include <N_UTL_BreakPoint.h>
64 #include <N_UTL_FeatureTest.h>
80 .setDescription(
"Current for current source");
85 .setDescription(
"Voltage for voltage source");
90 .setDescription(
"Device temperature");
97 #define Xyce_NONPOINTER_MATRIX_LOAD 1
113 :
DeviceInstance(IB, configuration.getInstanceParameters(), factory_block),
121 ABraEquPosNodeOffset(-1),
122 ABraEquNegNodeOffset(-1),
123 APosEquBraVarOffset(-1),
124 ANegEquBraVarOffset(-1),
125 fBraEquPosNodePtr(0),
126 fBraEquNegNodePtr(0),
164 UserError0(*
this) <<
"Must supply one of V= or I=";
176 std::vector<Depend>::const_iterator d;
180 for (d = begin ; d != end ; ++d)
182 if (d->name ==
"I" || d->name ==
"V")
301 const std::vector<int> & extLIDVecRef )
308 Xyce::dout() << std::endl << section_divider << std::endl;
309 Xyce::dout() <<
" BsrcInstance::registerLIDs" << std::endl;
310 Xyce::dout() <<
" name = " <<
getName() << std::endl;
326 Xyce::dout() <<
" li_Pos = " <<
li_Pos << std::endl;
327 Xyce::dout() <<
" li_Neg = " <<
li_Neg << std::endl;
336 Xyce::dout() <<
" li_Bra = " <<
li_Bra << std::endl;
342 Xyce::dout() << section_divider << std::endl;
437 li_ddt[i] = staLIDVecRef[i];
478 const std::vector< std::vector<int> > & jacLIDVec)
517 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
637 double maxMag = 1.0e+10;
640 static Report::MessageCode id;
642 Report::UserWarning(
id) <<
"Expression derivative |" <<
expVarDerivs[i] <<
"| exceeds " << maxMag <<
", value reduced";
665 double source(0.0), v_pos(0.0), v_neg(0.0), i_bra(0.0);
680 double c_tmp = i_bra;
681 double v_tmp = (v_pos-v_neg-source);
776 varTypeVec.resize(1);
795 :
DeviceModel(MB, configuration.getModelParameters(), factory_block)
809 std::vector<Instance*>::iterator iter;
813 for (iter=first; iter!=last; ++iter)
857 std::vector<Instance*>::const_iterator iter;
863 os <<
" name model name Parameters" << std::endl;
864 for (i=0, iter=first; iter!=last; ++iter, ++i)
866 os <<
" " << i <<
": " << (*iter)->getName() <<
" ";
892 for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
976 double maxMag = 1.0e+10;
979 static Report::MessageCode id;
981 Report::UserWarning(
id) <<
"Expression derivative |" << bi.
expVarDerivs[k] <<
"| exceeds " << maxMag <<
", value reduced";
998 bool Master::loadDAEVectors (
double * solVec,
double * fVec,
double *qVec,
double * bVec,
double * storeLeadF,
double * storeLeadQ,
double * leadF,
double * leadQ,
double * junctionV)
1003 double v_pos(0.0), v_neg(0.0), i_bra(0.0);
1004 double source = bi.
expVal;
1010 v_pos = solVec[bi.
li_Pos];
1011 v_neg = solVec[bi.
li_Neg];
1012 i_bra = solVec[bi.
li_Bra];
1014 double c_tmp = i_bra;
1015 double v_tmp = (v_pos-v_neg-source);
1017 fVec[bi.
li_Pos] += c_tmp;
1018 fVec[bi.
li_Neg] += -c_tmp;
1019 fVec[bi.
li_Bra] += v_tmp;
1029 fVec[bi.
li_Pos] += source;
1030 fVec[bi.
li_Neg] += -source;
1063 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
1089 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
1116 .registerDevice(
"b", 1)
1117 .registerDevice(
"f", 1)
1118 .registerDevice(
"h", 1);
const InstanceName & getName() const
std::vector< int > APosEquExpVarOffsets
double * nextStaDerivVectorRawPtr
bool updateDependentParameters()
const DeviceOptions & deviceOptions_
Descriptor & addPar(const char *parName, T default_value, T U::*varPtr)
Adds the parameter description to the parameter map.
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
std::vector< int > ABraEquExpVarOffsets
bool given(const std::string ¶meter_name) const
Pure virtual class to augment a linear system.
void addInternalNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
std::vector< Instance * > instanceContainer
void setNumStoreVars(int num_store_vars)
void addBranchDataNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
InstanceVector::const_iterator getInstanceEnd() const
Returns an iterator to the ending of the vector of all instances created for this device...
virtual bool updateSecondaryState(double *staDeriv, double *stoVec)
Updates the devices secondary state information.
const std::vector< Depend > & getDependentParams()
bool updateSecondaryState()
std::vector< double > expVarDerivs
virtual void registerJacLIDs(const JacobianStamp &jacLIDVec)
static void loadModelParameters(ParametricData< Model > &model_parameters)
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
double * fPosEquBraVarPtr
double * nextJunctionVCompRawPtr
virtual bool processInstanceParams()
processInstanceParams
const std::vector< std::string > & getDepSolnVars()
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
std::vector< double > ddtVals
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.
std::vector< int > ANegEquExpVarOffsets
int getNumStoreVars() const
InstanceVector::const_iterator getInstanceBegin() const
Returns an iterator to the beginning of the vector of all instances created for this device...
void registerBranchDataLIDs(const std::vector< int > &branchLIDVecRef)
Register the local store IDs.
void setParams(const std::vector< Param > ¶ms)
const std::string & getName() const
double * daeFVectorRawPtr
double * fBraEquNegNodePtr
double * fBraEquPosNodePtr
std::vector< double * > fNegEquExpVarPtrs
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
virtual bool updateState(double *solVec, double *staVec, double *stoVec)
Updates the devices state information.
const DeviceOptions & getDeviceOptions() const
bool updateIntermediateVars()
double * nextStoVectorRawPtr
bool updateTemperature(const double &temp)
int numBranchDataVarsIfAllocated
std::vector< double > myVarVals
static Config< T > & addConfiguration()
Adds the device to the Xyce device configuration.
std::vector< int > li_ddt
Linear::Matrix * dFdxMatrixPtr
const DeviceOptions & getDeviceOptions() const
Returns the device options given during device construction.
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
int li_branch_data
Index for lead current and junction voltage (for power calculations)
The Device class is an interface for device implementations.
const std::vector< std::vector< int > > & jacobianStamp() const
void addStoreNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
const SolverState & solverState_
void varTypes(std::vector< char > &varTypeVec)
Class Configuration contains device configuration data.
std::vector< double * > fPosEquExpVarPtrs
double * nextLeadCurrFCompRawPtr
std::vector< std::vector< int > > jacStamp
virtual bool processParams()
processParams
void setNumBranchDataVars(int num_branch_data_vars)
double * nextStaVectorRawPtr
void registerStoreLIDs(const std::vector< int > &stoLIDVecRef)
double * fNegEquBraVarPtr
virtual bool loadDAEMatrices(Linear::Matrix &dFdx, Linear::Matrix &dQdx)
Populates the device's Jacobian object with these pointers.
bool updatePrimaryState()
virtual std::ostream & printOutInstances(std::ostream &os) const
double scale_src
scaling for source loads
const ExternData & extData
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
ModelBlock represents a .MODEL line from the netlist.
Parameter may be specified as a solution dependent expression from netlist.
Manages parameter binding for class C.
InstanceBlock represent a device instance line from the netlist.
Util::Expression * Exp_ptr
std::vector< double * > fBraEquExpVarPtrs
std::vector< Param > params
int getNumBranchDataVars() const
virtual const std::vector< std::string > & getDepSolnVars()
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &BMiter, const FactoryBlock &factory_block)
double * nextSolVectorRawPtr