45 #include <Xyce_config.h>
56 #include <N_ERH_ErrorMgr.h>
58 #include <N_LAS_Vector.h>
59 #include <N_LAS_Matrix.h>
60 #include <N_UTL_FeatureTest.h>
73 .setDescription(
"Gain");
95 :
DeviceInstance(IBref, configuration.getInstanceParameters(), factory_block),
105 ABraEquPosNodeOffset(-1),
106 ABraEquNegNodeOffset(-1),
107 ABraEquContPosNodeOffset(-1),
108 ABraEquContNegNodeOffset(-1),
109 APosEquBraVarOffset(-1),
110 ANegEquBraVarOffset(-1),
112 f_BraEquPosNodePtr(0),
113 f_BraEquNegNodePtr(0),
114 f_BraEquContPosNodePtr(0),
115 f_BraEquContNegNodePtr(0),
116 f_PosEquBraVarPtr(0),
149 UserError0(*
this) <<
"Could not find Gain parameter in instance.";
175 const std::vector<int> & extLIDVecRef )
179 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
181 Xyce::dout() << std::endl << section_divider << std::endl;
182 Xyce::dout() <<
" VcvsInstance::registerLIDs" << std::endl;
183 Xyce::dout() <<
" name = " <<
getName() << std::endl;
188 int numInt = intLIDVecRef.size();
189 int numExt = extLIDVecRef.size();
193 msg =
"Instance::registerLIDs:";
194 msg +=
"numInt != numIntVars";
195 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
200 msg =
"Instance::registerLIDs:";
201 msg +=
"numExt != numExtVars";
202 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
218 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
220 Xyce::dout() <<
" li_Pos = " <<
li_Pos << std::endl;
221 Xyce::dout() <<
" li_Neg = " <<
li_Neg << std::endl;
222 Xyce::dout() <<
" li_ContPos = " <<
li_ContPos << std::endl;
223 Xyce::dout() <<
" li_ContNeg = " <<
li_ContNeg << std::endl;
228 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
229 Xyce::dout() <<
" li_Bra = " <<
li_Bra << std::endl;
231 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
232 Xyce::dout() << section_divider << std::endl;
343 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
385 double v_pos = solVec[
li_Pos];
386 double v_neg = solVec[
li_Neg];
390 double i_bra = solVec[
li_Bra];
392 double c_tmp = i_bra;
393 double v_tmp = (v_pos-v_neg);
398 double src =
Gain * ( v_cont_pos - v_cont_neg ) - v_pos + v_neg;
449 varTypeVec.resize(1);
467 :
DeviceModel(MB, configuration.getModelParameters(), factory_block)
481 std::vector<Instance*>::iterator iter;
485 for (iter=first; iter!=last; ++iter)
501 std::vector<Instance*>::const_iterator iter;
507 os <<
" name model name Parameters" << std::endl;
508 for (i=0, iter=first; iter!=last; ++iter, ++i)
510 os <<
" " << i <<
": " << (*iter)->getName() <<
" ";
536 for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
564 bool Master::loadDAEVectors (
double * solVec,
double * fVec,
double *qVec,
double * bVec,
double * storeLeadF,
double * storeLeadQ,
double * leadF,
double * leadQ,
double * junctionV)
567 #pragma omp parallel for
573 double v_pos = solVec[vi.
li_Pos];
574 double v_neg = solVec[vi.
li_Neg];
578 double i_bra = solVec[vi.
li_Bra];
581 fVec[vi.
li_Neg] += -i_bra;
583 double src = vi.
Gain * ( v_cont_pos - v_cont_neg ) - v_pos + v_neg;
611 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
643 .registerDevice(
"e", 1)
644 .registerModelType(
"e", 1);
Instance(const Configuration &configuration, const InstanceBlock &IBref, Model &Viter, const FactoryBlock &factory_block)
const InstanceName & getName() const
const DeviceOptions & deviceOptions_
Descriptor & addPar(const char *parName, T default_value, T U::*varPtr)
Adds the parameter description to the parameter map.
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
virtual bool loadDAEVectors(double *solVec, double *fVec, double *qVec, double *bVec, double *storeLeadF, double *storeLeadQ, double *leadF, double *leadQ, double *junctionV)
Populates the device's ExternData object with these pointers.
bool given(const std::string ¶meter_name) const
Pure virtual class to augment a linear system.
void addInternalNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
double * f_BraEquNegNodePtr
static std::vector< std::vector< int > > jacStamp
virtual bool updateState(double *solVec, double *staVec, double *stoVec)
Updates the devices state information.
void addBranchDataNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
InstanceVector::const_iterator getInstanceEnd() const
Returns an iterator to the ending of the vector of all instances created for this device...
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
virtual void registerJacLIDs(const JacobianStamp &jacLIDVec)
double * nextJunctionVCompRawPtr
const std::vector< std::vector< int > > & jacobianStamp() const
bool updatePrimaryState()
int ABraEquContPosNodeOffset
void registerBranchDataLIDs(const std::vector< int > &branchLIDVecRef)
Register the local store IDs.
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
InstanceVector::const_iterator getInstanceBegin() const
Returns an iterator to the beginning of the vector of all instances created for this device...
double * f_BraEquContNegNodePtr
void setParams(const std::vector< Param > ¶ms)
const std::string & getName() const
double * daeFVectorRawPtr
static void loadModelParameters(ParametricData< Model > &model_parameters)
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
int numBranchDataVarsIfAllocated
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
static Config< T > & addConfiguration()
Adds the device to the Xyce device configuration.
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
void varTypes(std::vector< char > &varTypeVec)
Linear::Matrix * dFdxMatrixPtr
double * f_PosEquBraVarPtr
The Device class is an interface for device implementations.
const SolverState & solverState_
Class Configuration contains device configuration data.
double * f_BraEquContPosNodePtr
double * nextLeadCurrFCompRawPtr
int li_branch_data
Index for lead current and junction voltage (for power calculations)
virtual bool loadDAEMatrices(Linear::Matrix &dFdx, Linear::Matrix &dQdx)
Populates the device's Jacobian object with these pointers.
void setNumBranchDataVars(int num_branch_data_vars)
virtual std::ostream & printOutInstances(std::ostream &os) const
double * f_NegEquBraVarPtr
double * f_BraEquPosNodePtr
const ExternData & extData
int ABraEquContNegNodeOffset
ModelBlock represents a .MODEL line from the netlist.
Manages parameter binding for class C.
InstanceBlock represent a device instance line from the netlist.
std::vector< Param > params
std::vector< Instance * > instanceContainer
int getNumBranchDataVars() const
double * nextSolVectorRawPtr