Xyce
6.1
|
Resistor device instance class. More...
#include <N_DEV_Resistor.h>
Public Member Functions | |
Instance (const Configuration &configuration, const InstanceBlock &instance_block, Model &model, const FactoryBlock &factory_block) | |
Construct a resistor instance. More... | |
~Instance () | |
Destroys this instance. More... | |
Model & | getModel () |
Gets the resistor model that owns this instance. More... | |
virtual void | registerLIDs (const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef) |
Register local IDs. More... | |
virtual void | registerStateLIDs (const std::vector< int > &staLIDVecRef) |
Register the local state IDs. More... | |
virtual void | registerStoreLIDs (const std::vector< int > &stoLIDVecRef) |
Register the local store IDs. More... | |
virtual void | registerJacLIDs (const std::vector< std::vector< int > > &jacLIDVec) |
Register the Jacobian local IDs. More... | |
virtual std::map< int, std::string > & | getStoreNameMap () |
Populates and returns the store name map. More... | |
virtual bool | processParams () |
Process parameters. More... | |
virtual bool | updateTemperature (const double &temp_tmp) |
Update the parameters that depend on the temperature of the device. More... | |
virtual bool | updateIntermediateVars () |
Update the intermediate variables. More... | |
virtual bool | updatePrimaryState () |
Update the state variables. More... | |
virtual const std::vector < std::vector< int > > & | jacobianStamp () const |
Return Jacobian stamp that informs topology of the layout of the resistor jacobian. More... | |
virtual bool | loadDAEFVector () |
Load the DAE F vector. More... | |
virtual bool | loadDAEdFdx () |
Load the DAE the derivative of the F vector with respect to the solution vector x, dFdx. More... | |
virtual bool | loadDAEQVector () |
Load Q vector. More... | |
virtual bool | loadDAEdQdx () |
Load derivative of Q vector with respect to solution vector. More... | |
virtual void | setupPointers () |
Setup direct access pointer to solution matrix and vectors. More... | |
![]() | |
DeviceInstance (const InstanceBlock &instance_block, ParametricData< void > ¶metric_data, const FactoryBlock &factory_block) | |
virtual | ~DeviceInstance () |
virtual void | enableLeadCurrentCalc () |
virtual void | registerGIDs (const std::list< index_pair > &intGIDListRef, const std::list< index_pair > &extGIDListRef) |
virtual void | registerStateGIDs (const std::list< index_pair > &staGIDListRef) |
virtual void | registerStoreGIDs (const std::list< index_pair > &stoGIDListRef) |
virtual const std::vector < std::string > & | getDepSolnVars () |
virtual void | registerDepSolnGIDs (const std::vector< std::vector< int > > &varList) |
virtual const std::vector < std::string > & | getDepStateVars () |
virtual void | registerDepStateGIDs (const std::vector< std::vector< int > > &varList) |
virtual const std::vector < std::string > & | getDepStoreVars () |
virtual void | registerDepStoreGIDs (const std::vector< std::vector< int > > &varList) |
virtual void | registerDepSolnLIDs (const std::vector< std::vector< int > > &depSolnLIDVecRef) |
virtual void | registerDepStateLIDs (const std::vector< std::vector< int > > &depStaLIDVecRef) |
virtual void | registerDepStoreLIDs (const std::vector< std::vector< int > > &depStoLIDVecRef) |
virtual void | registerGIDData (const std::vector< int > &counts, const std::vector< int > &GIDs, const std::vector< std::vector< int > > &jacGIDs) |
virtual void | getDepSolnGIDVec (std::vector< int > &depGIDVec) |
virtual bool | getIndexPairList (std::list< index_pair > &iplRef) |
virtual bool | getInstanceBreakPoints (std::vector< N_UTL_BreakPoint > &breakPointTimes) |
virtual bool | updateSource () |
virtual bool | processInstanceParams () |
virtual bool | isConverged () |
virtual bool | testDAEMatrices (std::vector< std::string > &nameVec) |
virtual bool | loadTrivialDAE_FMatrixStamp () |
bool | trivialStampLoader (N_LAS_Matrix *matPtr) |
bool | zeroMatrixDiagonal (N_LAS_Matrix *matPtr) |
virtual bool | updateSecondaryState () |
virtual bool | setIC () |
virtual bool | plotfileFlag () |
virtual bool | loadDeviceMask () |
virtual void | acceptStep () |
int | getNumIntVars () const |
int | getNumExtVars () const |
int | getNumStateVars () const |
int | getNumStoreVars () const |
void | setNumStoreVars (int num_store_vars) |
virtual void | getDevConMap (std::vector< int > &) |
virtual DeviceState * | getInternalState () |
virtual bool | setInternalState (const DeviceState &state) |
virtual bool | loadDFDV (int iElectrode, N_LAS_Vector *dfdvPtr) |
virtual bool | calcConductance (int iElectrode, const N_LAS_Vector *dxdvPtr) |
virtual std::map< int, std::string > & | getIntNameMap () |
virtual std::map< int, std::string > & | getStateNameMap () |
void | spiceInternalName (std::string &tmpname) |
virtual bool | outputPlotFiles () |
virtual bool | enablePDEContinuation () |
virtual bool | disablePDEContinuation () |
virtual void | setPDEContinuationAlpha (double alpha) |
virtual void | setPDEContinuationBeta (double beta) |
virtual bool | setInitialGuess () |
virtual double | getMaxTimeStepSize () |
virtual void | varTypes (std::vector< char > &varTypeVec) |
bool | getOrigFlag () const |
void | setOrigFlag (bool origFlag_local) |
const std::vector< int > & | getDevLIDs () const |
const std::vector< std::vector < int > > & | getDevJacLIDs () const |
const std::vector< int > & | getStaLIDVec () const |
bool | getMergeRowColChecked () const |
void | setMergeRowColChecked (bool mergeRowColChecked_local) |
const MatrixLoadData & | getMatrixLoadData () const |
MatrixLoadData & | getMatrixLoadData () |
![]() | |
DeviceEntity (const char *const entity_type, const std::string &device_name, ParametricData< void > ¶metric_data, const SolverState &solver_state, const DeviceOptions &device_options, const std::string &netlist_path, int netlist_line) | |
virtual | ~DeviceEntity () |
virtual CompositeParam * | constructComposite (const std::string &composite_name, const std::string ¶m_name) |
bool | setDefaultParam (double val) |
double | getDefaultParam () |
bool | scaleParam (const std::string ¶mName, double val, double val0) |
bool | scaleParam (const std::string ¶mName, double val) |
bool | scaleDefaultParam (double val) |
bool | setParam (const std::string ¶mName, double val) |
bool | getParam (const std::string ¶mName, double &result) |
bool | getParamBreakpoints (std::vector< Util::BreakPoint > &) |
bool | updateDependentParameters (N_LAS_Vector &vars) |
bool | updateDependentParameters (double temp_tmp) |
bool | updateGlobalParameters (std::map< std::string, double > &) |
bool | updateDependentParameters () |
double | setDependentParameter (Util::Param &, double *, ParameterType::ExprAccess) |
double | setDependentParameter (Util::Param &, std::vector< double > *, int, ParameterType::ExprAccess) |
void | setDependentParameter (Util::Param &par, Depend &dependentParam, ParameterType::ExprAccess depend) |
void | setDefaultParams () |
void | setParams (const std::vector< Param > ¶ms) |
bool | given (const std::string ¶meter_name) const |
const char * | getEntityType () const |
const std::string & | getName () const |
void | setDefaultParamName (const std::string &default_param_name) |
const std::vector< Depend > & | getDependentParams () |
const DeviceOptions & | getDeviceOptions () const |
const SolverState & | getSolverState () const |
const NetlistLocation & | netlistLocation () const |
const ParameterMap & | getParameterMap () const |
![]() | |
ParameterBase () | |
double | getOriginalValue (int serial_number) |
void | setOriginalValue (int serial_number, double value) |
bool | wasValueGiven (int serial_number) const |
void | setValueGiven (int serial_number, bool value) |
Private Member Functions | |
Instance (const Instance &) | |
Instance & | operator= (const Instance &) |
Static Private Member Functions | |
static void | initializeJacobianStamp () |
Common Jacobian stamp initializer for all Resistor devices. More... | |
Private Attributes | |
Model & | model_ |
Owning model. More... | |
double | R |
Resistance (ohms) More... | |
double | length |
Resistor length. More... | |
double | width |
Resistor width. More... | |
double | temp |
Temperature of this instance. More... | |
double | tempCoeff1 |
First order temperature coeff. More... | |
double | tempCoeff2 |
Second order temperature coeff. More... | |
double | dtemp |
Externally specified device temperature. More... | |
bool | tempCoeff1Given |
First order temperation value was given in netlist. More... | |
bool | tempCoeff2Given |
Second order temperature coeff was given in netlist. More... | |
bool | dtempGiven |
Externally specified device temperature was given in netlist. More... | |
double | G |
Conductance(1.0/ohms) More... | |
double | i0 |
Current(ohms) More... | |
int | li_Pos |
Index for Positive Node. More... | |
int | li_Neg |
Index for Negative Node. More... | |
int | li_store_dev_i |
Index for Lead Current. More... | |
int | APosEquPosNodeOffset |
Column index into force matrix of Pos/Pos conductance. More... | |
int | APosEquNegNodeOffset |
Column index into force matrix of Pos/Neg conductance. More... | |
int | ANegEquPosNodeOffset |
Column index into force matrix of Neg/Pos conductance. More... | |
int | ANegEquNegNodeOffset |
Column index into force matrix of Neg/Neg conductance. More... | |
double * | f_PosEquPosNodePtr |
double * | f_PosEquNegNodePtr |
double * | f_NegEquPosNodePtr |
double * | f_NegEquNegNodePtr |
Static Private Attributes | |
static std::vector < std::vector< int > > | jacStamp |
All Resistor instances have a common Jacobian Stamp. More... | |
Friends | |
class | ParametricData< Instance > |
Allow ParametricData to changes member values. More... | |
class | Model |
class | Traits |
class | Master |
Additional Inherited Members | |
![]() | |
std::vector< int > & | cols |
std::vector< double > & | vals |
NumericalJacobian * | numJacPtr |
bool | psLoaded |
bool | ssLoaded |
bool | rhsLoaded |
bool | origFlag |
int | numIntVars |
int | numExtVars |
int | numStateVars |
int | numStoreVars |
int | numLeadCurrentStoreVars |
bool | loadLeadCurrent |
std::vector< int > | devConMap |
bool | mergeRowColChecked |
![]() | |
void | jacStampMap (std::vector< std::vector< int > > &stamp_parent, std::vector< int > &map_parent, std::vector< std::vector< int > > &map2_parent, std::vector< std::vector< int > > &stamp, std::vector< int > &map, std::vector< std::vector< int > > &map2, int from, int to, int original_size) |
void | jacStampMap_fixOrder (std::vector< std::vector< int > > &stamp_parent, std::vector< std::vector< int > > &map2_parent, std::vector< std::vector< int > > &stamp, std::vector< std::vector< int > > &map2) |
void | outputJacStamp (const std::vector< std::vector< int > > &jac) |
void | outputJacMaps (const std::vector< int > &jacMap, const std::vector< std::vector< int > > &jacMap2) |
![]() | |
const ExternData & | extData |
std::list< index_pair > | intGIDList |
std::list< index_pair > | extGIDList |
std::list< index_pair > | indexPairList |
std::list< index_pair > | staGIDList |
std::vector< int > | intLIDVec |
std::vector< int > | extLIDVec |
std::vector< int > | staLIDVec |
std::vector< int > | stoLIDVec |
std::vector< int > | devLIDs |
std::vector< std::vector< int > > | devJacLIDs |
std::map< int, std::string > | intNameMap |
std::map< int, std::string > | stateNameMap |
std::map< int, std::string > | storeNameMap |
DeviceSupport | devSupport |
Resistor device instance class.
An instance is created for each occurance of the device in the netlist.
It contains "unique" resistor information - ie stuff that will be true of only one resistor in the circuit, such as the nodes to which it is connected. A resistor is connected to only two circuit nodes.
This class does not directly contain information about its node indices. It contains indices into the 5 parts (dFdx, dQdx, dx, F, and Q) of the matrix problem A*dx = b, and also the solution vector x. A is the Jacobian matrix that will be formed from dFdx and d(dQ/dt)dx, dx is the update to x, and b is right hand side function vector that will be formed from F and dQ/dt. These indices are global, and determined by topology during the initialization stage of execution.
Definition at line 102 of file N_DEV_Resistor.h.
Xyce::Device::Resistor::Instance::Instance | ( | const Configuration & | configuration, |
const InstanceBlock & | instance_block, | ||
Model & | model, | ||
const FactoryBlock & | factory_block | ||
) |
Construct a resistor instance.
[in] | configuration | Device configuration and traits. |
[in] | instance_block | Instance information from parser. |
[in] | model | Resistor Model to which we should add this instance. |
[in] | factory_block | Device options defined in netlist. |
Definition at line 270 of file N_DEV_Resistor.C.
|
inline |
|
private |
|
inline |
Gets the resistor model that owns this instance.
Definition at line 152 of file N_DEV_Resistor.h.
|
virtual |
Populates and returns the store name map.
If the DeviceInstance::storeNameMap is empty, populate it.
For the purpose of lead currents, store vector elements must be given names that can be used to locate lead currents at print time. When a netlist attempts to print, say, "I(R1)" the output code looks for an entry in the store vector named R1:DEV_I.
This method does the assignment of names to store vector elements.
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 529 of file N_DEV_Resistor.C.
|
staticprivate |
Common Jacobian stamp initializer for all Resistor devices.
The Jacobian stamp is a sparse-matrix representation of the pattern of non-zero elements that a device will put into the Jacobian matrix.
The Jacobian stamp is used by the Topology package to determine indices into the full Jacobian matrix for elements that correspond to this device.
There is one row of the Jacobian stamp for each equation associated with a device. The number of elements in a row are the number of non-zero elements in that row of the device's contribution to the Jacobian. The values of the elements are numbers local to the device that represent the column in which the non-zero element appears.
For the resistor, there are two external nodes (the positive and negative terminals of the device). The positive node is referred to as the 0th node of the device, and the negative node the 1st node. Considering positive current flow from the positive node to the negative node, current out of the positive node is , and current out of the negative node is
. Thus, the Jacobian matrix contribution for the resistor is:
This is a dense Jacobian with two rows. The first row is the row for the positive node's KCL, the second row is the row for the negative node KCL. Each row has two non-zero elements. The columns correspond to the nodes of the device: the first column is the positive node, the second the negative node. The element of the jacobian is the dependence of the equation associated with the row on the variable associated with the column.
The Jacobian stamp therefore has two rows, and each row has two elements. In this trivial device (because the matrix is small and fully dense), the stamp values are 0 ("positive node") for the first nonzero in each row, and 1 ("negative node") for the second nonzero.
Definition at line 120 of file N_DEV_Resistor.C.
|
inlinevirtual |
Return Jacobian stamp that informs topology of the layout of the resistor jacobian.
The Jacobian stamp describes the shape of the Jacobian to the Topology subsystem. The Topology subsystem, in turn, returns the offsets into the matrix and solution vectors where this instance data is located.
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 187 of file N_DEV_Resistor.h.
|
virtual |
Load the DAE the derivative of the F vector with respect to the solution vector x, dFdx.
Loads the contributions for a single resistor instance to the dFdx matrix (the F contribution to the Jacobian).
This method uses the Jacobian LIDs (row offsets) that were stored by registerJacLIDs.
Implements Xyce::Device::DeviceInstance.
Definition at line 811 of file N_DEV_Resistor.C.
|
inlinevirtual |
Load derivative of Q vector with respect to solution vector.
Since the Resistor does no charge storage, this is a no-op.
Implements Xyce::Device::DeviceInstance.
Definition at line 233 of file N_DEV_Resistor.h.
|
virtual |
Load the DAE F vector.
The Xyce DAE formulation solves the differential-algebraic equations These are vector equations resulting from the modified nodal analysis of the circuit.
This method loads the F-vector contributions for a single resistor instance.
In this method, the offsets defined in registerLIDs are used to store the device's F contributions into the F vector.
The Q vector is used for devices that store charge or magnetic energy, and since the resistor does none of that, the F vector contributions are the whole of the resistor's contribution to the full set of DAEs.
Implements Xyce::Device::DeviceInstance.
Definition at line 760 of file N_DEV_Resistor.C.
|
inlinevirtual |
Load Q vector.
Since the Resistor does no charge storage, this is a no-op.
Implements Xyce::Device::DeviceInstance.
Definition at line 211 of file N_DEV_Resistor.h.
|
virtual |
Process parameters.
In general, the processParams method is intended as a place for complex manipulation of parameters that must happen if temperature or other external changes happen. In the resistor device it does nothing other than call updateTemperature.
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 374 of file N_DEV_Resistor.C.
|
virtual |
Register the Jacobian local IDs.
jacLIDVec | Jacobian local Ids |
Having established local IDs for the solution variables, Topology must also assign local IDs for the elements of the Jacobian matrix.
For each non-zero element that was identified in the jacobianStamp, Topology will assign a Jacobian LID. The jacLIDVec will have the same structure as the JacStamp, but the values in the jacLIDVec will be offsets into the row of the sparse Jacobian matrix corresponding to the non-zero identified in the stamp.
These offsets are stored in this method for use later when we load the Jacobian.
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 576 of file N_DEV_Resistor.C.
|
virtual |
Register local IDs.
Register the local internal and external node IDs.
intLIDVecRef | internal local IDs from topology package |
extLIDVecRef | external local IDs from topology package |
Instantiation (calling the device constructor) of the device sets up variables numIntVars and numExtVars, the numbers of internal and external variables associated with the device. This information is then used by the Topology package to assign locations in the solution vector (and all other vectors of the same shape) for those variables. The "Local IDs" (LIDs) of these locations are provided by Topology so the device can know where to load its data.
This method saves the LIDs from Topology and associates each one with a particular local name for the internal or external variable. They are then used when we load the F and Q vectors.
The resistor device has no internal variables, so this method makes no use of the intLIDVecRef array.
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 413 of file N_DEV_Resistor.C.
|
virtual |
Register the local state IDs.
staLIDVecRef | State variable local IDs |
In general, devices may declare at construction that they require storage locations in the "state vector." Topology assigns locations in the state vector and returns "Local IDs" (LIDs) for devices to use for their state vector entries. If a device uses state vector entries, it uses the registerStateLIDs method to save the local IDs for later use.
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 464 of file N_DEV_Resistor.C.
|
virtual |
Register the local store IDs.
In addition to state vector, Xyce maintains a separate datastructure called a "store" vector. As with other such vectors, the device declares at construction time how many store vector entries it needs, and later Topology assigns locations for devices, returning LIDs.
These LIDs are stored in this method for later use.
The Resistor device uses exactly one "store vector" element, where it keeps the "lead current" that may be used on .PRINT lines as "I(R1)" for the current through resistor R1.
stoLIDVecRef | Store variable local IDs |
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 495 of file N_DEV_Resistor.C.
|
virtual |
Setup direct access pointer to solution matrix and vectors.
As an alternative to the row offsets defined in registerJacLIDs, it is also possible to obtain direct pointers of the Jacobian elements.
This method uses the offsets obtained in registerJacLIDs to retrieve the pointers.
In the resistor device the pointers to the matrix are only saved (and are only used for matrix access) if Xyce_NONPOINTER_MATRIX_LOAD is NOT defined at compile time. For some devices the use of pointers instead of array indexing can be a performance enhancement.
Use of pointers in this device is disabled by defining Xyce_NONPOINTER_MATRIX_LOAD at compile time. When disabled, array indexing with the offsets from registerJacLIDs is used in the matrix load methods.
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 621 of file N_DEV_Resistor.C.
|
virtual |
Update the intermediate variables.
The bulk of any device's computation is handled in the instance class' updateIntermediateVars method. For the resistor, this is merely the computation of the current through the resistor given the voltage difference between its terminals.
Intermediate variables computed here are used in the methods that load data into the F, Q, dFdX and dQdX data structures.
Implements Xyce::Device::DeviceInstance.
Definition at line 663 of file N_DEV_Resistor.C.
|
virtual |
Update the state variables.
This function is the function that is called from the device manager each time a load of vectors and Jacobian is required. Its first job is to call updateIntermediateVars.
After calling updateIntermediateVars, the updatePrimaryState method may load state vector elements as needed.
The resistor device has no state vector elements, so all this method does in the resistor instance class is call updateIntermediateVars.
There is no longer a "secondary" state. The "primary" in this method's name is purely historical.
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 713 of file N_DEV_Resistor.C.
|
virtual |
Update the parameters that depend on the temperature of the device.
temp_tmp | temperature |
Xyce has a number of mechanisms that allow temperature to be changed after a device has been instantiated. These include .STEP loops over temperature. When temperature is changed, any device that has parameters that depend on temperature must be updated. That updating happens here.
The Resistor device supports temperature-dependent resistance through its TC1 (linear dependence) and TC2 (quadratic dependence) parameters. If these parameters are specified, the resistance must be updated.
Reimplemented from Xyce::Device::DeviceInstance.
Definition at line 847 of file N_DEV_Resistor.C.
|
friend |
Definition at line 107 of file N_DEV_Resistor.h.
|
friend |
Definition at line 105 of file N_DEV_Resistor.h.
|
friend |
Allow ParametricData to changes member values.
Definition at line 104 of file N_DEV_Resistor.h.
|
friend |
Definition at line 106 of file N_DEV_Resistor.h.
|
private |
Column index into force matrix of Neg/Neg conductance.
Definition at line 278 of file N_DEV_Resistor.h.
|
private |
Column index into force matrix of Neg/Pos conductance.
Definition at line 277 of file N_DEV_Resistor.h.
|
private |
Column index into force matrix of Pos/Neg conductance.
Definition at line 276 of file N_DEV_Resistor.h.
|
private |
Column index into force matrix of Pos/Pos conductance.
Definition at line 275 of file N_DEV_Resistor.h.
|
private |
Externally specified device temperature.
NOT used, only here for compatibility in parsing netlist from simulators that support it
Definition at line 257 of file N_DEV_Resistor.h.
|
private |
Externally specified device temperature was given in netlist.
Definition at line 264 of file N_DEV_Resistor.h.
|
private |
Definition at line 285 of file N_DEV_Resistor.h.
|
private |
Definition at line 284 of file N_DEV_Resistor.h.
|
private |
Definition at line 283 of file N_DEV_Resistor.h.
|
private |
Definition at line 282 of file N_DEV_Resistor.h.
|
private |
Conductance(1.0/ohms)
Definition at line 267 of file N_DEV_Resistor.h.
|
private |
Current(ohms)
Definition at line 268 of file N_DEV_Resistor.h.
|
staticprivate |
All Resistor instances have a common Jacobian Stamp.
Common Jacobian Stamp for all Resistor devices.
Because all resistors have identical Jacobian stamps, this data is declared static and is shared by all resistor instances.
Definition at line 241 of file N_DEV_Resistor.h.
|
private |
Resistor length.
Definition at line 250 of file N_DEV_Resistor.h.
|
private |
Index for Negative Node.
Definition at line 271 of file N_DEV_Resistor.h.
|
private |
Index for Positive Node.
Definition at line 270 of file N_DEV_Resistor.h.
|
private |
Index for Lead Current.
Definition at line 272 of file N_DEV_Resistor.h.
|
private |
Owning model.
Definition at line 244 of file N_DEV_Resistor.h.
|
private |
Resistance (ohms)
Definition at line 247 of file N_DEV_Resistor.h.
|
private |
Temperature of this instance.
Definition at line 252 of file N_DEV_Resistor.h.
|
private |
First order temperature coeff.
Definition at line 255 of file N_DEV_Resistor.h.
|
private |
First order temperation value was given in netlist.
Definition at line 262 of file N_DEV_Resistor.h.
|
private |
Second order temperature coeff.
Definition at line 256 of file N_DEV_Resistor.h.
|
private |
Second order temperature coeff was given in netlist.
Definition at line 263 of file N_DEV_Resistor.h.
|
private |
Resistor width.
Definition at line 251 of file N_DEV_Resistor.h.