Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 ()
 
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...
 
std::map< int, std::string > & getIntNameMap ()
 Set up names for purely internal solution variables. More...
 
std::map< int, std::string > & getStoreNameMap ()
 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 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 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 DeviceStategetInternalState ()
 
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 > & 
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 ()
 
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 MatrixLoadDatagetMatrixLoadData () const
 
MatrixLoadDatagetMatrixLoadData ()
 
- Public Member Functions inherited from Xyce::Device::DeviceEntity
 DeviceEntity (const char *const entity_type, const std::string &device_name, ParametricData< void > &parametric_data, const SolverState &solver_state, const DeviceOptions &device_options, const std::string &netlist_path, int netlist_line)
 
virtual ~DeviceEntity ()
 
virtual CompositeParamconstructComposite (const std::string &composite_name, const std::string &param_name)
 
bool setDefaultParam (double val)
 
double getDefaultParam ()
 
bool scaleParam (const std::string &paramName, double val, double val0)
 
bool scaleParam (const std::string &paramName, double val)
 
bool scaleDefaultParam (double val)
 
bool setParam (const std::string &paramName, double val)
 
bool getParam (const std::string &paramName, 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 > &params)
 
bool given (const std::string &parameter_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 DeviceOptionsgetDeviceOptions () const
 
const SolverStategetSolverState () const
 
const NetlistLocation & netlistLocation () const
 
const ParameterMapgetParameterMap () const
 
- Public Member Functions inherited from Xyce::Device::ParameterBase
 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_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
 

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 numLeadCurrentStoreVars
 
bool loadLeadCurrent
 
std::vector< int > devConMap
 
bool mergeRowColChecked
 
- Protected Member Functions inherited from Xyce::Device::DeviceInstance
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)
 
- Protected Attributes inherited from Xyce::Device::DeviceInstance
const ExternDataextData
 
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
 

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 89 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}{cc} 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}{ccc} 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}{ccc} 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}{ccc} 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 314 of file N_DEV_Capacitor.C.

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

Definition at line 612 of file N_DEV_Capacitor.C.

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

Member Function Documentation

std::map< int, std::string > & Xyce::Device::Capacitor::Instance::getIntNameMap ( )
virtual

Set up names for purely internal solution variables.

The capacitor device's initial condition code is implemented as putting a DC voltage source of the given value across the capacitor, to assure that the circuit is completely consistent at the operating point with having that voltage across the capacitor.

In the event that an initial condition is given, there is an extra solution variable, the branch current of the voltage source. We give it name that is the name of this capacitor with "_branch" appended.

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 807 of file N_DEV_Capacitor.C.

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

Definition at line 141 of file N_DEV_Capacitor.h.

std::map< int, std::string > & Xyce::Device::Capacitor::Instance::getStoreNameMap ( )
virtual

Populates and returns the store name map.

If the DeviceInstance::storeNameMap is empty, populate it.

Returns
reference to the DeviceInstance::storeNameMap

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(C1)" the output code looks for an entry in the store vector named C1:DEV_I.

This method does the assignment of names to store vector elements.

Author
Richard Schiek, Electrical Systems Modeling
Date
1/23/2013

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 847 of file N_DEV_Capacitor.C.

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 886 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 1516 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 1431 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 1346 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 1288 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 194 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 933 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 651 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 721 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 777 of file N_DEV_Capacitor.C.

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

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 1545 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 1028 of file N_DEV_Capacitor.C.

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

Implements Xyce::Device::DeviceInstance.

Definition at line 123 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.

Reimplemented from Xyce::Device::DeviceInstance.

Definition at line 1102 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 266 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 1583 of file N_DEV_Capacitor.C.

Friends And Related Function Documentation

friend class Master
friend

Definition at line 94 of file N_DEV_Capacitor.h.

friend class Model
friend

Definition at line 92 of file N_DEV_Capacitor.h.

friend class ParametricData< Instance >
friend

Definition at line 91 of file N_DEV_Capacitor.h.

friend class Traits
friend

Definition at line 93 of file N_DEV_Capacitor.h.

Member Data Documentation

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

Definition at line 214 of file N_DEV_Capacitor.h.

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

Definition at line 213 of file N_DEV_Capacitor.h.

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

Definition at line 212 of file N_DEV_Capacitor.h.

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

age in hours

Definition at line 175 of file N_DEV_Capacitor.h.

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

degradation coeficient.

Definition at line 176 of file N_DEV_Capacitor.h.

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

Definition at line 216 of file N_DEV_Capacitor.h.

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

Definition at line 210 of file N_DEV_Capacitor.h.

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

Definition at line 206 of file N_DEV_Capacitor.h.

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

Definition at line 204 of file N_DEV_Capacitor.h.

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

Definition at line 215 of file N_DEV_Capacitor.h.

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

Definition at line 209 of file N_DEV_Capacitor.h.

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

Definition at line 205 of file N_DEV_Capacitor.h.

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

Definition at line 203 of file N_DEV_Capacitor.h.

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

the baseline capacitance before aging

Definition at line 177 of file N_DEV_Capacitor.h.

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

Definition at line 156 of file N_DEV_Capacitor.h.

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

Definition at line 151 of file N_DEV_Capacitor.h.

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

Definition at line 150 of file N_DEV_Capacitor.h.

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

Definition at line 153 of file N_DEV_Capacitor.h.

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

Definition at line 227 of file N_DEV_Capacitor.h.

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

Definition at line 226 of file N_DEV_Capacitor.h.

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

Definition at line 225 of file N_DEV_Capacitor.h.

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

Definition at line 229 of file N_DEV_Capacitor.h.

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

Definition at line 228 of file N_DEV_Capacitor.h.

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

Definition at line 157 of file N_DEV_Capacitor.h.

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

Definition at line 180 of file N_DEV_Capacitor.h.

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

Definition at line 235 of file N_DEV_Capacitor.h.

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

Definition at line 236 of file N_DEV_Capacitor.h.

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

Definition at line 160 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 191 of file N_DEV_Capacitor.h.

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

Definition at line 198 of file N_DEV_Capacitor.h.

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

Definition at line 196 of file N_DEV_Capacitor.h.

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

Definition at line 195 of file N_DEV_Capacitor.h.

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

Definition at line 190 of file N_DEV_Capacitor.h.

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

Definition at line 189 of file N_DEV_Capacitor.h.

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

Definition at line 193 of file N_DEV_Capacitor.h.

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

Definition at line 200 of file N_DEV_Capacitor.h.

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

Definition at line 197 of file N_DEV_Capacitor.h.

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

Definition at line 147 of file N_DEV_Capacitor.h.

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

charge in the capacitor

Definition at line 184 of file N_DEV_Capacitor.h.

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

Definition at line 232 of file N_DEV_Capacitor.h.

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

Definition at line 223 of file N_DEV_Capacitor.h.

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

Definition at line 221 of file N_DEV_Capacitor.h.

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

Definition at line 231 of file N_DEV_Capacitor.h.

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

Definition at line 222 of file N_DEV_Capacitor.h.

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

Definition at line 220 of file N_DEV_Capacitor.h.

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

Definition at line 181 of file N_DEV_Capacitor.h.

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

Definition at line 162 of file N_DEV_Capacitor.h.

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

Definition at line 166 of file N_DEV_Capacitor.h.

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

Definition at line 171 of file N_DEV_Capacitor.h.

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

Definition at line 167 of file N_DEV_Capacitor.h.

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

Definition at line 172 of file N_DEV_Capacitor.h.

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

Definition at line 179 of file N_DEV_Capacitor.h.

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

Definition at line 186 of file N_DEV_Capacitor.h.

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

Definition at line 161 of file N_DEV_Capacitor.h.


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