Xyce  6.1
Xyce::Device::Capacitor::Instance Class Reference

Capacitor instance. More...

#include <N_DEV_Capacitor.h>

Inheritance diagram for Xyce::Device::Capacitor::Instance:
Collaboration diagram for Xyce::Device::Capacitor::Instance:

Public Member Functions

 Instance (const Configuration &configuration, const InstanceBlock &instance_block, Model &model, const FactoryBlock &factory_block)
 Construct a Capacitor model from a "model block" that was created by the netlist parser. More...
 
 ~Instance ()
 
bool isLinearDevice () const
 
void registerLIDs (const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
 Register local IDs. More...
 
void registerStateLIDs (const std::vector< int > &staLIDVecRef)
 Register the local state IDs. More...
 
void registerStoreLIDs (const std::vector< int > &stoLIDVecRef)
 Register the local store IDs. More...
 
void registerBranchDataLIDs (const std::vector< int > &branchLIDVecRef)
 Register the local store IDs. More...
 
void loadNodeSymbols (Util::SymbolTable &symbol_table) const
 Populates and returns the store name map. More...
 
const std::vector< std::vector< int > > & jacobianStamp () const
 Return Jacobian stamp that informs topology of the layout of the resistor jacobian. More...
 
void registerJacLIDs (const std::vector< std::vector< int > > &jacLIDVec)
 Register the Jacobian local IDs. More...
 
bool processParams ()
 Process parameters. More...
 
bool updateTemperature (const double &temp_tmp)
 Update the parameters that depend on the temperature of the device. More...
 
bool updateIntermediateVars ()
 
bool updatePrimaryState ()
 Update the state variables. More...
 
bool setIC ()
 
bool loadDAEQVector ()
 Load the DAE Q vector. More...
 
bool loadDAEFVector ()
 Load the DAE F vector. More...
 
bool loadDAEdQdx ()
 Load the DAE the derivative of the Q vector with respect to the solution vector x, dFdx. More...
 
bool loadDAEdFdx ()
 Load the DAE the derivative of the F vector with respect to the solution vector x, dFdx. More...
 
void setupPointers ()
 Setup direct access pointer to solution matrix and vectors. More...
 
void varTypes (std::vector< char > &varTypeVec)
 
ModelgetModel ()
 
- Public Member Functions inherited from Xyce::Device::DeviceInstance
 DeviceInstance (const InstanceBlock &instance_block, ParametricData< void > &parametric_data, const FactoryBlock &factory_block)
 
virtual ~DeviceInstance ()
 
virtual std::ostream & printName (std::ostream &os) const
 
virtual void enableLeadCurrentCalc ()
 
virtual void registerGIDs (const IndexPairVector &intGIDListRef, const IndexPairVector &extGIDListRef)
 
virtual void registerStateGIDs (const IndexPairVector &staGIDListRef)
 
virtual void registerStoreGIDs (const IndexPairVector &stoGIDListRef)
 
virtual const std::vector< std::string > & getDepSolnVars ()
 
virtual void registerDepSolnGIDs (const std::vector< IdVector > &varList)
 
virtual const std::vector< std::string > & getDepStateVars ()
 
virtual void registerDepStateGIDs (const std::vector< IdVector > &varList)
 
virtual const std::vector< std::string > & getDepStoreVars ()
 
virtual void registerDepStoreGIDs (const std::vector< IdVector > &varList)
 
virtual const std::vector< std::string > & getDepLeadCurrentVars ()
 
virtual void registerDepLeadCurrentGIDs (const std::vector< IdVector > &varList)
 
virtual void registerDepSolnLIDs (const std::vector< IdVector > &depSolnLIDVecRef)
 
virtual void registerDepStateLIDs (const std::vector< IdVector > &depStaLIDVecRef)
 
virtual void registerDepStoreLIDs (const std::vector< IdVector > &depStoLIDVecRef)
 
virtual void registerGIDData (const std::vector< int > &counts, const IdVector &GIDs, const JacobianStamp &jacGIDs)
 
virtual const IdVectorgetDepSolnGIDVec ()
 
virtual const IndexPairVector & getIndexPairList ()
 
virtual bool getInstanceBreakPoints (std::vector< Util::BreakPoint > &breakPointTimes)
 
virtual bool updateSource ()
 
virtual bool processInstanceParams ()
 
virtual bool isConverged ()
 
virtual bool testDAEMatrices (const std::vector< const std::string * > &nameVec)
 
virtual bool loadTrivialDAE_FMatrixStamp ()
 
bool trivialStampLoader (Linear::Matrix *matPtr)
 
bool zeroMatrixDiagonal (Linear::Matrix *matPtr)
 
virtual bool updateSecondaryState ()
 
virtual bool plotfileFlag ()
 
virtual void loadErrorWeightMask ()
 
virtual void acceptStep ()
 
virtual bool loadDAEBVector ()
 
virtual int getNumNoiseSources () const
 
virtual void setupNoiseSources (Xyce::Analysis::NoiseData &noiseDataVec)
 
virtual void getNoiseSources (Xyce::Analysis::NoiseData &noiseDataVec)
 
const InstanceNamegetName () const
 
int getNumIntVars () const
 
int getNumExtVars () const
 
int getNumStateVars () const
 
int getNumStoreVars () const
 
int getNumBranchDataVars () const
 
void setNumStoreVars (int num_store_vars)
 
void setNumBranchDataVars (int num_branch_data_vars)
 
virtual const std::vector< int > & getDevConMap ()
 
virtual DeviceStategetInternalState ()
 
virtual bool setInternalState (const DeviceState &state)
 
virtual bool loadDFDV (int iElectrode, Linear::Vector *dfdvPtr)
 
virtual bool calcConductance (int iElectrode, const Linear::Vector *dxdvPtr)
 
virtual bool outputPlotFiles (bool force_final_output)
 
virtual bool enablePDEContinuation (int &max_PDE_continuation_steps)
 
virtual bool disablePDEContinuation ()
 
virtual void setPDEContinuationAlpha (double alpha)
 
virtual void setPDEContinuationBeta (double beta)
 
virtual bool setInitialGuess ()
 
virtual double getMaxTimeStepSize ()
 
bool getOrigFlag () const
 
void setOrigFlag (bool origFlag_local)
 
const IdVectorgetDevLIDs () const
 
const std::vector< IdVector > & getDevJacLIDs () const
 
const IdVectorgetStaLIDVec () const
 
bool getMergeRowColChecked () const
 
void setMergeRowColChecked (bool mergeRowColChecked_local)
 
const MatrixLoadDatagetMatrixLoadData () const
 
MatrixLoadDatagetMatrixLoadData ()
 
const ExternDatagetExternData () const
 
- Public Member Functions inherited from Xyce::Device::DeviceEntity
 DeviceEntity (ParametricData< void > &parametric_data, const SolverState &solver_state, const DeviceOptions &device_options, const std::string &netlist_filename, int netlist_line)
 
virtual ~DeviceEntity ()
 
virtual CompositeParamconstructComposite (const std::string &composite_name, const std::string &param_name)
 
bool setDefaultParam (double val, bool overrideOriginal=false)
 
double getDefaultParam () const
 
bool scaleParam (const std::string &paramName, double val, double val0)
 
bool scaleParam (const std::string &paramName, double val)
 
bool scaleDefaultParam (double val)
 
bool analyticSensitivityAvailable (const std::string &paramName)
 
bool analyticSensitivityAvailableDefaultParam ()
 
bool getAnalyticSensitivity (const std::string &paramName, std::vector< double > &dfdpVec, std::vector< double > &dqdpVec, std::vector< double > &dbdpVec, std::vector< int > &FindicesVec, std::vector< int > &QindicesVec, std::vector< int > &BindicesVec)
 
bool getAnalyticSensitivityDefaultParam (std::vector< double > &dfdpVec, std::vector< double > &dqdpVec, std::vector< double > &dbdpVec, std::vector< int > &FindicesVec, std::vector< int > &QindicesVec, std::vector< int > &BindicesVec)
 
bool setParam (const std::string &paramName, double val, bool overrideOriginal=false)
 
bool getParam (const std::string &paramName, double &result) const
 
bool findParam (const std::string &param_name) const
 
bool getParamBreakpoints (std::vector< Util::BreakPoint > &)
 
bool updateDependentParameters (const Linear::Vector &vars)
 
bool updateDependentParameters (double temp_tmp)
 
bool updateGlobalParameters (GlobalParameterMap &)
 
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 > &params)
 
bool given (const std::string &parameter_name) const
 
void setDefaultParamName (const std::string &default_param_name)
 
const std::vector< Depend > & getDependentParams ()
 
void addDependentParameter (const Depend &param)
 
const DeviceOptionsgetDeviceOptions () const
 
const SolverStategetSolverState () const
 
const NetlistLocation & netlistLocation () const
 
const ParameterMapgetParameterMap () const
 
- Public Member Functions inherited from Xyce::Device::ParameterBase
 ParameterBase ()
 
virtual ~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 &)
 
Instanceoperator= (const Instance &)
 

Private Attributes

Modelmodel_
 
Util::Expression * expPtr
 
int expNumVars
 
std::vector< double > expVarDerivs
 
double C
 
double IC
 
double length
 
double width
 
double temp
 
double tempCoeff1
 
double tempCoeff2
 
bool tempCoeff1Given
 
bool tempCoeff2Given
 
double age
 age in hours More...
 
double ageCoef
 degradation coeficient. More...
 
double baseCap
 the baseline capacitance before aging More...
 
bool tempGiven
 
bool ICGiven
 
bool solVarDepC
 
double q0
 charge in the capacitor More...
 
double vcap
 
int li_Pos
 
int li_Neg
 
int li_Bra
 for the "voltage source" when IC is specified More...
 
int li_branch_data
 Index for lead current and junction voltage (for power calculations) More...
 
int li_QState
 
std::vector< int > li_dQdXState
 
std::vector< int > li_dCdXState
 
int li_vcapState
 
int li_capState
 
int li_store_dev_i
 
int APosEquPosNodeOffset
 
int ANegEquPosNodeOffset
 
int APosEquNegNodeOffset
 
int ANegEquNegNodeOffset
 
std::vector< int > APosEquDepVarOffsets
 
std::vector< int > ANegEquDepVarOffsets
 
int ABraEquPosNodeOffset
 
int ABraEquNegNodeOffset
 
int ABraEquBraNodeOffset
 
int APosEquBraNodeOffset
 
int ANegEquBraNodeOffset
 
double * qPosEquPosNodePtr
 
double * qNegEquPosNodePtr
 
double * qPosEquNegNodePtr
 
double * qNegEquNegNodePtr
 
double * fBraEquPosNodePtr
 
double * fBraEquNegNodePtr
 
double * fBraEquBraNodePtr
 
double * fPosEquBraNodePtr
 
double * fNegEquBraNodePtr
 
std::vector< double * > qPosEquDepVarsPtrs
 
std::vector< double * > qNegEquDepVarsPtrs
 
std::vector< std::vector< int > > jacStamp
 
std::vector< std::vector< int > > jacStamp_IC
 

Friends

class ParametricData< Instance >
 
class Model
 
class Traits
 
class Master
 
class capSensitivity
 

Additional Inherited Members

- Public Attributes inherited from Xyce::Device::DeviceInstance
std::vector< int > & cols
 
std::vector< double > & vals
 
NumericalJacobiannumJacPtr
 
bool psLoaded
 
bool ssLoaded
 
bool rhsLoaded
 
bool origFlag
 
int numIntVars
 
int numExtVars
 
int numStateVars
 
int numStoreVars
 
int numLeadCurrentVars
 
int numLeadCurrentStoreVars
 
bool loadLeadCurrent
 
int numBranchDataVars
 
int numBranchDataVarsIfAllocated
 
std::vector< int > devConMap
 
bool mergeRowColChecked
 
- Protected Member Functions inherited from Xyce::Device::DeviceInstance
void jacStampMap (const JacobianStamp &stamp_parent, IdVector &map_parent, JacobianStamp &map2_parent, JacobianStamp &stamp, IdVector &map, JacobianStamp &map2, int from, int to, int original_size)
 
void jacStampMap_fixOrder (const JacobianStamp &stamp_parent, JacobianStamp &map2_parent, JacobianStamp &stamp, JacobianStamp &map2)
 
void outputJacStamp (const JacobianStamp &jac)
 
void outputJacMaps (const std::vector< int > &jacMap, const JacobianStamp &jacMap2)
 
- Protected Attributes inherited from Xyce::Device::DeviceInstance
const ExternDataextData
 
IndexPairVector indexPairList
 
IndexPairVector intGIDList
 
IndexPairVector extGIDList
 
IndexPairVector staGIDList
 
IdVector intLIDVec
 
IdVector extLIDVec
 
IdVector staLIDVec
 
IdVector stoLIDVec
 
IdVector devLIDs
 devLIDs is a combined LID vector, containing int, ext, and expVar ID's. More...
 
JacobianStamp devJacLIDs
 
DeviceSupport devSupport
 
- Protected Attributes inherited from Xyce::Device::DeviceEntity
std::vector< int > expVarGIDs
 
std::vector< int > expVarLIDs
 
std::vector< std::string > expVarNames
 
std::vector< double > expVarVals
 
std::vector< double > eVarVals
 

Detailed Description

Capacitor instance.

This class refers to a single instance of the capacitor device. It contains indicies into the matrix equation. See the comments for the Resistor::Instance class for more details.

Definition at line 112 of file N_DEV_Capacitor.h.

Constructor & Destructor Documentation

Xyce::Device::Capacitor::Instance::Instance ( const Configuration configuration,
const InstanceBlock instance_block,
Model model,
const FactoryBlock factory_block 
)

Construct a Capacitor model from a "model block" that was created by the netlist parser.

Parameters
configuration
model_block
factory_block
Author
Eric Keiter, SNL, Parallel Computational Sciences
Date
3/16/00

Unlike the resistor, the capacitor's jacobian stamp is set up directly in the constructor, and is not static. This is because the capacitor supports some options that the resistor does not:

  • The capacitor instance line may be given an IC=value that will be used as the initial voltage drop across the capacitance at the operating point.
  • The capacitance on the instance line may be an expression that is permitted to be a function of other solution variables (such as voltages elsewhere in the circuit).

Both of these require that the Jacobian stamp for the device be modified. Use of a static Jacobian stamp would prevent this flexibility, because the static stamp would be used by all capacitor devices, even those that do not make use of the options.

Since the setting of the Jacobian stamp in this otherwise simple device is so complex, we will document how it is set here.

In its simplest form, the charge $q_0$ on the capacitor is $C(V_+-V_-)$. Thus, the current out of the positive node is $d(q_0)/dt$, and the current "out" of the negative node is $-d(q0)/dt$. In the Xyce formulation, we load $q_0$ into the Q vector for the positive node, and $-q_0$ into the Q vector for the negative node; the time integator will later differentiate this to obtain the currents. Thus, the contribution to the Jacobian from the capacitor (with constant capacitance and no initial condition) will require loading the dQdx matrix with the derivatives of $q_0$ with respect to the voltage nodes:

\[ \left[\begin{array}{rr} C & -C \\ -C & C \end{array} \right] \]

The jacobian stamp in this case is the same as the one defined by the resistor: it has two rows, one for the positive node equation and one for negative node equation, and two columns, one for the positive node and one for the negative. Column 0's value in each row is 0 to reflect that the first nonzero value of the jacobian row is the one corresponding to the positive node, and column 1's value is 1 to reflect that the second nonzero corresponds to the dependence on the negative node.

If an initial condition is present, however, the circuit at DC is the same as if there were only a voltage source across the positive and negative nodes, and in transient it is the same as the capacitor without the voltage source present. Thus, at DC the current out of the positive node would be equal to the voltage source branch current, and the current out of the negative node would be the negative of that. Since these quantities are not differentiated they would be placed in the F vector, no the Q vector. An extra equation, called the "branch equation" stipulates that the voltage drop between the positive and negative node be equal to the initial condition, so this element of the F vector would be loaded with $(V_+-V_-)-V_{ic}$. Therefore in DC the dFdx matrix would be loaded with:

\[ \left[ \begin{array}{rrr} 0 & 0 & 1 \\ 0 & 0 & -1 \\ 1 & -1 & 0 \end{array}\right] \]

The the first two rows are for the positive and negative node equations, and the third row is for the branch equation. The third column is for the branch current variable. At DC nothing would be loaded into either the Q vector or its derivative.

In transient, the loads into the Q vector are the same as without the initial condition. Xyce requires that a single jacobian stamp be used for both the dFdx and dQdx matrices, and does not allow this matrix to vary between DC and transient. Thus the dQdx matrix would be loaded with:

\[ \left[ \begin{array}{rrr} C & -C & 0 \\ -C & C & 0 \\ 0 & 0 & 0 \end{array}\right] \]

The dFdx matrix must be loaded with a single value to turn off the branch equation and prevent a singular Jacobian:

\[ \left[ \begin{array}{rrr} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{array}\right] \]

The net result of this modification is that now, irrespective of whether we are at DC or in transient, every element of the 3x3 matrix is potentially nonzero in one or the other of dFdx or dQdx, and therefore our jacobian stamp is also a dense 3x3 matrix, with each column's value equal to that column's number.

Finally, if the capacitance is solution-variable dependent, each of the rows for positive and negative nodes must be augmented with an additional column for each variable that the capacitance depends on. These rows are similarly dense, and each value of the jacobian stamp for each column is equal to its column number.

Definition at line 328 of file N_DEV_Capacitor.C.

Xyce::Device::Capacitor::Instance::~Instance ( )

Definition at line 616 of file N_DEV_Capacitor.C.

Xyce::Device::Capacitor::Instance::Instance ( const Instance )
private

Member Function Documentation

Model& Xyce::Device::Capacitor::Instance::getModel ( )
inline

Definition at line 166 of file N_DEV_Capacitor.h.

bool Xyce::Device::Capacitor::Instance::isLinearDevice ( ) const
inlinevirtual

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 134 of file N_DEV_Capacitor.h.

const std::vector< std::vector< int > > & Xyce::Device::Capacitor::Instance::jacobianStamp ( ) const
virtual

Return Jacobian stamp that informs topology of the layout of the resistor jacobian.

Returns
const reference to a std::vector of std::vector of integers describing Jacobian stamp shape 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.

The Jacobian stamp of the capacitor depends on whether an initial condition is given or not.

Author
Robert Hoekstra
Date
8/20/2001

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 874 of file N_DEV_Capacitor.C.

bool Xyce::Device::Capacitor::Instance::loadDAEdFdx ( )
virtual

Load the DAE the derivative of the F vector with respect to the solution vector x, dFdx.

Loads the contributions for a single capacitor instance to the dFdx matrix (the F contribution to the Jacobian).

This method uses the Jacobian LIDs (row offsets) that were stored by registerJacLIDs.

See also
Xyce::Device::Capacitor::Instance::registerJacLIDs

The capacitor only loads the dFdx matrix when an initial condition is given on the instance line for the device.

Note
This method is called by the default implementation of the loadDAEMatrices master function. Since the Capacitor class reimplements the "Master" "loadDAEMatrices" function that loads the contributions from all capacitor devices in a single loop, THIS FUNCTION IS NOT ACTUALLY USED. The loadDAEdFdx method is only called when a device class does not re-implement the master class. This can be a source of confusion when attempting to modify the Capacitor device, or any other device that reimplements the Master classes.
See also
Xyce::Device::Capacitor::Master::loadDAEMatrices
Returns
true on success
Author
Eric Keiter, SNL, Parallel Computational Sciences
Date
03/05/04

Implements Xyce::Device::DeviceInstance.

Definition at line 1526 of file N_DEV_Capacitor.C.

bool Xyce::Device::Capacitor::Instance::loadDAEdQdx ( )
virtual

Load the DAE the derivative of the Q vector with respect to the solution vector x, dFdx.

Loads the contributions for a single resistor instance to the dFdx matrix (the Q contribution to the Jacobian).

This method uses the Jacobian LIDs (row offsets) that were stored by registerJacLIDs.

See also
Xyce::Device::Capacitor::Instance::registerJacLIDs
Note
This method is called by the default implementation of the loadDAEMatrices master function. Since the Capacitor class reimplements the "Master" "loadDAEMatrices" function that loads the contributions from all capacitor devices in a single loop, THIS FUNCTION IS NOT ACTUALLY USED. The loadDAEdFdx method is only called when a device class does not re-implement the master class. This can be a source of confusion when attempting to modify the capacitor device, or any other device that reimplements the Master classes.
See also
Xyce::Device::Capacitor::Master::loadDAEMatrices
Returns
true on success
Author
Eric Keiter, SNL, Parallel Computational Sciences
Date
03/05/04

Implements Xyce::Device::DeviceInstance.

Definition at line 1441 of file N_DEV_Capacitor.C.

bool Xyce::Device::Capacitor::Instance::loadDAEFVector ( )
virtual

Load the DAE F vector.

Returns
true on success

The Xyce DAE formulation solves the differential-algebraic equations $F(x)+dQ(x)/dt=0$ These are vector equations resulting from the modified nodal analysis of the circuit.

This method loads the F-vector contributions for a single capacitor instance.

In this method, the offsets defined in registerLIDs are used to store the device's F contributions into the F vector.

The only time a capacitor adds anything to the F vector is in the DC phase of a computation if and only if an initial condition is given on the capacitor instance line.

Note
This method is called by the default implementation of the loadDAEVectors master function. Since the Capacitor class reimplements the "Master" "loadDAEVectors" function that loads the contributions from all capacitor devices in a single loop, THIS FUNCTION IS NOT ACTUALLY USED. The loadDAEFVector method is only called when a device class does not re-implement the master class. This can be a source of confusion when attempting to modify the Capacitor device, or any other device that reimplements the Master classes.
See also
Xyce::Device::Capacitor::Master::loadDAEVectors
Author
Eric Keiter, SNL, Parallel Computational Sciences
Date
01/24/03

Implements Xyce::Device::DeviceInstance.

Definition at line 1343 of file N_DEV_Capacitor.C.

bool Xyce::Device::Capacitor::Instance::loadDAEQVector ( )
virtual

Load the DAE Q vector.

Returns
true on success

The Xyce DAE formulation solves the differential-algebraic equations $F(x)+dQ(x)/dt=0$ These are vector equations resulting from the modified nodal analysis of the circuit.

This method loads the Q-vector contributions for a single capacitor instance.

In this method, the offsets defined in registerLIDs are used to store the device's Q contributions into the Q vector.

The Q vector is used for devices that store charge or magnetic energy. The capacitor is such a device

Note
This method is called by the default implementation of the loadDAEVectors master function. Since the capacitor class reimplements the "Master" "loadDAEVectors" function that loads the contributions from all capacitor devices in a single loop, THIS FUNCTION IS NOT ACTUALLY USED. The loadDAEQVector method is only called when a device class does not re-implement the master class. This can be a source of confusion when attempting to modify the Capacitor device, or any other device that reimplements the Master classes.
See also
Xyce::Device::Capacitor::Master::loadDAEVectors
Author
Eric Keiter, SNL, Parallel Computational Sciences
Date
01/24/03

Implements Xyce::Device::DeviceInstance.

Definition at line 1276 of file N_DEV_Capacitor.C.

void Xyce::Device::Capacitor::Instance::loadNodeSymbols ( Util::SymbolTable &  symbol_table) const
virtual

Populates and returns the store name map.

Implements Xyce::Device::DeviceInstance.

Definition at line 837 of file N_DEV_Capacitor.C.

Instance& Xyce::Device::Capacitor::Instance::operator= ( const Instance )
private
bool Xyce::Device::Capacitor::Instance::processParams ( )
virtual

Process parameters.

Returns
true on success

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.

The Capacitor device supports an "AGE" parameter and a degradation rate parameter that together determine how to modify the capacitance given on the instance line. Further, Xyce supports a "semiconductor capacitor" model which allows the user to specify the capacitance through a combination of model parameters (junction capacitance and junction sidewall capacitance) and instance parameters (length and width).

Both of these methods of capacitance value determination need to be done after the normal processing of netlist parameters. That processing is done here.

Author
Eric Keiter, SNL, Parallel Computational Sciences
Date
6/03/02

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 195 of file N_DEV_Capacitor.C.

void Xyce::Device::Capacitor::Instance::registerBranchDataLIDs ( const std::vector< int > &  branchLIDVecRef)
virtual

Register the local store IDs.

In addition to state vector, Xyce maintains a separate datastructure called a "branch data" vector. As with other such vectors, the device declares at construction time how many branch 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 "branch data vector" element, where it keeps the "lead current" that may be used on .PRINT lines as "I(C1)" for the current through C1. and a junction voltage.

Parameters
stoLIDVecRefStore variable local IDs
Author
Richard Schiek, Electrical Systems Modeling
Date
12/18/2012

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 817 of file N_DEV_Capacitor.C.

void Xyce::Device::Capacitor::Instance::registerJacLIDs ( const std::vector< std::vector< int > > &  jacLIDVec)
virtual

Register the Jacobian local IDs.

Parameters
jacLIDVecJacobian local Ids
See also
Xyce::Device::Capacitor::Instance::Capacitor

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.

Note
Because the capacitor's Jacobian stamp depends on whether an initial condition was given or not, this method is slightly more complex than the corresponding method in the Resistor. The method is further complicated by the possibilty that the capacitance may be given as an expression depending on solution variables; in this case, the capacitor jacstamp has extra columns for the device's dependence on those other variables.
See also
Xyce::Device::Resistor::Instance::registerJacLIDs
Author
Robert Hoekstra, SNL, Parallel Computational Sciences
Date
08/27/02

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 921 of file N_DEV_Capacitor.C.

void Xyce::Device::Capacitor::Instance::registerLIDs ( const std::vector< int > &  intLIDVecRef,
const std::vector< int > &  extLIDVecRef 
)
virtual

Register local IDs.

Register the local internal and external node IDs.

Parameters
intLIDVecRefinternal local IDs from topology package
extLIDVecRefexternal 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 Capacitor device has no internal variables, so this method makes no use of the intLIDVecRef array.

Author
Robert Hoekstra, SNL, Parallel Computational Sciences
Date
6/20/02

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 655 of file N_DEV_Capacitor.C.

void Xyce::Device::Capacitor::Instance::registerStateLIDs ( const std::vector< int > &  staLIDVecRef)
virtual

Register the local state IDs.

Parameters
staLIDVecRefState 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.

The capacitor has at least one state variable (the charge) and as many as three (the charge plus state variables used to support the "voltage dependent capacitance" feature) plus the number of variables on whihc the capacitance depends.

Note
The storage of the charge as a state variable when the capacitance is a constant is a holdover from older implementations, and in the future may be saved only as part of the voltage-dependent capacitance feature.
Author
Robert Hoekstra, SNL, Parallel Computational Sciences
Date
06/20/02

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 725 of file N_DEV_Capacitor.C.

void Xyce::Device::Capacitor::Instance::registerStoreLIDs ( const std::vector< int > &  stoLIDVecRef)
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 Capacitor device uses exactly one "store vector" element, where it keeps the "lead current" that may be used on .PRINT lines as "I(C1)" for the current through resistor R1.

Parameters
stoLIDVecRefStore variable local IDs
Author
Richard Schiek, Electrical Systems Modeling
Date
1/23/2013

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 781 of file N_DEV_Capacitor.C.

bool Xyce::Device::Capacitor::Instance::setIC ( )
virtual

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 1555 of file N_DEV_Capacitor.C.

void Xyce::Device::Capacitor::Instance::setupPointers ( )
virtual

Setup direct access pointer to solution matrix and vectors.

See also
Xyce::Device::Capacitor::Instance::registerJacLIDs

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.

Author
Eric Keiter, SNL
Date
11/30/08

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 1016 of file N_DEV_Capacitor.C.

bool Xyce::Device::Capacitor::Instance::updateIntermediateVars ( )
inlinevirtual

Implements Xyce::Device::DeviceInstance.

Definition at line 148 of file N_DEV_Capacitor.h.

bool Xyce::Device::Capacitor::Instance::updatePrimaryState ( )
virtual

Update the state variables.

Returns
true on success

The capacitor's state variables are used to store the charge on the capacitor. In the case of a constant capacitance the charge is $q_0=CV$, but the computation is much more complex if the capacitance is variable.

Note
This method is called by the default implementation of the loadState master function. While the Capacitor class reimplements the "Master" "loadState" function that loads the contributions from all capacitor devices in a single loop, because this method is so complicated for the case of solution-dependent capacitances, the overloaded method falls back on this function in that case.
Even though this method IS called in some cases, note that it does NOT call updateIntermediateVars as other device updatePrimaryState methods do. The capacitor device doesn't actually HAVE an updateIntermediateVars method, and all the hard work is done either in the Master class updateState function directly for the simple, constant-capacitance case, or here, for the solution-variable-dependent-capacitance case.
See also
Xyce::Device::Capacitor::Master::updateState
Author
Eric Keiter, SNL, Parallel Computational Sciences
Date
01/29/01

For solution-variable dependent cap in transient, we can't use the expression $q_0=CV$ because the capacitance is actually dQ/dV, not Q/V. We must integrate CdV to get the charge. We approximate this by incrementally adding C'*deltaV as V changes. C' is the average capacitance between this and the previous step. Using the average assures charge conservation, at least when C is a function of vcap alone.

When C is not a function of vcap alone, we have additional derivative terms that must also be integrated for proper computation of all dQdx entries.

Implements Xyce::Device::DeviceInstance.

Definition at line 1090 of file N_DEV_Capacitor.C.

bool Xyce::Device::Capacitor::Instance::updateTemperature ( const double &  temp_tmp)
virtual

Update the parameters that depend on the temperature of the device.

Parameters
temp_tmptemperature

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 capacitor device supports temperature-dependent resistance through its TC1 (linear dependence) and TC2 (quadratic dependence) parameters. If these parameters are specified, the capacitance must be updated.

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 280 of file N_DEV_Capacitor.C.

void Xyce::Device::Capacitor::Instance::varTypes ( std::vector< char > &  varTypeVec)
virtual

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 1593 of file N_DEV_Capacitor.C.

Friends And Related Function Documentation

friend class capSensitivity
friend

Definition at line 118 of file N_DEV_Capacitor.h.

friend class Master
friend

Definition at line 117 of file N_DEV_Capacitor.h.

friend class Model
friend

Definition at line 115 of file N_DEV_Capacitor.h.

friend class ParametricData< Instance >
friend

Definition at line 114 of file N_DEV_Capacitor.h.

friend class Traits
friend

Definition at line 116 of file N_DEV_Capacitor.h.

Member Data Documentation

int Xyce::Device::Capacitor::Instance::ABraEquBraNodeOffset
private

Definition at line 240 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::ABraEquNegNodeOffset
private

Definition at line 239 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::ABraEquPosNodeOffset
private

Definition at line 238 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::age
private

age in hours

Definition at line 200 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::ageCoef
private

degradation coeficient.

Definition at line 201 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::ANegEquBraNodeOffset
private

Definition at line 242 of file N_DEV_Capacitor.h.

std::vector<int> Xyce::Device::Capacitor::Instance::ANegEquDepVarOffsets
private

Definition at line 236 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::ANegEquNegNodeOffset
private

Definition at line 232 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::ANegEquPosNodeOffset
private

Definition at line 230 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::APosEquBraNodeOffset
private

Definition at line 241 of file N_DEV_Capacitor.h.

std::vector<int> Xyce::Device::Capacitor::Instance::APosEquDepVarOffsets
private

Definition at line 235 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::APosEquNegNodeOffset
private

Definition at line 231 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::APosEquPosNodeOffset
private

Definition at line 229 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::baseCap
private

the baseline capacitance before aging

Definition at line 202 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::C
private

Definition at line 181 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::expNumVars
private

Definition at line 176 of file N_DEV_Capacitor.h.

Util::Expression* Xyce::Device::Capacitor::Instance::expPtr
private

Definition at line 175 of file N_DEV_Capacitor.h.

std::vector<double> Xyce::Device::Capacitor::Instance::expVarDerivs
private

Definition at line 178 of file N_DEV_Capacitor.h.

double* Xyce::Device::Capacitor::Instance::fBraEquBraNodePtr
private

Definition at line 253 of file N_DEV_Capacitor.h.

double* Xyce::Device::Capacitor::Instance::fBraEquNegNodePtr
private

Definition at line 252 of file N_DEV_Capacitor.h.

double* Xyce::Device::Capacitor::Instance::fBraEquPosNodePtr
private

Definition at line 251 of file N_DEV_Capacitor.h.

double* Xyce::Device::Capacitor::Instance::fNegEquBraNodePtr
private

Definition at line 255 of file N_DEV_Capacitor.h.

double* Xyce::Device::Capacitor::Instance::fPosEquBraNodePtr
private

Definition at line 254 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::IC
private

Definition at line 182 of file N_DEV_Capacitor.h.

bool Xyce::Device::Capacitor::Instance::ICGiven
private

Definition at line 205 of file N_DEV_Capacitor.h.

std::vector< std::vector<int> > Xyce::Device::Capacitor::Instance::jacStamp
private

Definition at line 261 of file N_DEV_Capacitor.h.

std::vector< std::vector<int> > Xyce::Device::Capacitor::Instance::jacStamp_IC
private

Definition at line 262 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::length
private

Definition at line 185 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::li_Bra
private

for the "voltage source" when IC is specified

Definition at line 216 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::li_branch_data
private

Index for lead current and junction voltage (for power calculations)

Definition at line 217 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::li_capState
private

Definition at line 224 of file N_DEV_Capacitor.h.

std::vector<int> Xyce::Device::Capacitor::Instance::li_dCdXState
private

Definition at line 222 of file N_DEV_Capacitor.h.

std::vector<int> Xyce::Device::Capacitor::Instance::li_dQdXState
private

Definition at line 221 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::li_Neg
private

Definition at line 215 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::li_Pos
private

Definition at line 214 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::li_QState
private

Definition at line 219 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::li_store_dev_i
private

Definition at line 226 of file N_DEV_Capacitor.h.

int Xyce::Device::Capacitor::Instance::li_vcapState
private

Definition at line 223 of file N_DEV_Capacitor.h.

Model& Xyce::Device::Capacitor::Instance::model_
private

Definition at line 172 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::q0
private

charge in the capacitor

Definition at line 209 of file N_DEV_Capacitor.h.

std::vector<double *> Xyce::Device::Capacitor::Instance::qNegEquDepVarsPtrs
private

Definition at line 258 of file N_DEV_Capacitor.h.

double* Xyce::Device::Capacitor::Instance::qNegEquNegNodePtr
private

Definition at line 249 of file N_DEV_Capacitor.h.

double* Xyce::Device::Capacitor::Instance::qNegEquPosNodePtr
private

Definition at line 247 of file N_DEV_Capacitor.h.

std::vector<double *> Xyce::Device::Capacitor::Instance::qPosEquDepVarsPtrs
private

Definition at line 257 of file N_DEV_Capacitor.h.

double* Xyce::Device::Capacitor::Instance::qPosEquNegNodePtr
private

Definition at line 248 of file N_DEV_Capacitor.h.

double* Xyce::Device::Capacitor::Instance::qPosEquPosNodePtr
private

Definition at line 246 of file N_DEV_Capacitor.h.

bool Xyce::Device::Capacitor::Instance::solVarDepC
private

Definition at line 206 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::temp
private

Definition at line 187 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::tempCoeff1
private

Definition at line 191 of file N_DEV_Capacitor.h.

bool Xyce::Device::Capacitor::Instance::tempCoeff1Given
private

Definition at line 196 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::tempCoeff2
private

Definition at line 192 of file N_DEV_Capacitor.h.

bool Xyce::Device::Capacitor::Instance::tempCoeff2Given
private

Definition at line 197 of file N_DEV_Capacitor.h.

bool Xyce::Device::Capacitor::Instance::tempGiven
private

Definition at line 204 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::vcap
private

Definition at line 211 of file N_DEV_Capacitor.h.

double Xyce::Device::Capacitor::Instance::width
private

Definition at line 186 of file N_DEV_Capacitor.h.


The documentation for this class was generated from the following files: