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),
104 ABraEquPosNodeOffset(-1),
105 ABraEquNegNodeOffset(-1),
106 ABraEquContPosNodeOffset(-1),
107 ABraEquContNegNodeOffset(-1),
108 APosEquBraVarOffset(-1),
109 ANegEquBraVarOffset(-1),
111 f_BraEquPosNodePtr(0),
112 f_BraEquNegNodePtr(0),
113 f_BraEquContPosNodePtr(0),
114 f_BraEquContNegNodePtr(0),
115 f_PosEquBraVarPtr(0),
146 UserError0(*
this) <<
"Could not find Gain parameter in instance.";
172 const std::vector<int> & extLIDVecRef )
176 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
178 Xyce::dout() << std::endl << section_divider << std::endl;
179 Xyce::dout() <<
" VcvsInstance::registerLIDs" << std::endl;
180 Xyce::dout() <<
" name = " <<
getName() << std::endl;
185 int numInt = intLIDVecRef.size();
186 int numExt = extLIDVecRef.size();
190 msg =
"Instance::registerLIDs:";
191 msg +=
"numInt != numIntVars";
192 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
197 msg =
"Instance::registerLIDs:";
198 msg +=
"numExt != numExtVars";
199 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
215 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
217 Xyce::dout() <<
" li_Pos = " <<
li_Pos << std::endl;
218 Xyce::dout() <<
" li_Neg = " <<
li_Neg << std::endl;
219 Xyce::dout() <<
" li_ContPos = " <<
li_ContPos << std::endl;
220 Xyce::dout() <<
" li_ContNeg = " <<
li_ContNeg << std::endl;
225 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
226 Xyce::dout() <<
" li_Bra = " <<
li_Bra << std::endl;
228 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
229 Xyce::dout() << section_divider << std::endl;
301 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
343 double v_pos = solVec[
li_Pos];
344 double v_neg = solVec[
li_Neg];
348 double i_bra = solVec[
li_Bra];
353 double src =
Gain * ( v_cont_pos - v_cont_neg ) - v_pos + v_neg;
396 varTypeVec.resize(1);
414 :
DeviceModel(MB, configuration.getModelParameters(), factory_block)
428 std::vector<Instance*>::iterator iter;
432 for (iter=first; iter!=last; ++iter)
448 std::vector<Instance*>::const_iterator iter;
454 os <<
" name model name Parameters" << std::endl;
455 for (i=0, iter=first; iter!=last; ++iter, ++i)
457 os <<
" " << i <<
": " << (*iter)->getName() <<
" ";
483 for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
511 bool Master::loadDAEVectors (
double * solVec,
double * fVec,
double *qVec,
double * bVec,
double * storeLeadF,
double * storeLeadQ,
double * leadF,
double * leadQ,
double * junctionV)
514 #pragma omp parallel for
520 double v_pos = solVec[vi.
li_Pos];
521 double v_neg = solVec[vi.
li_Neg];
525 double i_bra = solVec[vi.
li_Bra];
528 fVec[vi.
li_Neg] += -i_bra;
530 double src = vi.
Gain * ( v_cont_pos - v_cont_neg ) - v_pos + v_neg;
552 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
584 .registerDevice(
"e", 1)
585 .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.
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)
const std::vector< std::vector< int > > & jacobianStamp() const
bool updatePrimaryState()
int ABraEquContPosNodeOffset
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.
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
virtual bool loadDAEMatrices(Linear::Matrix &dFdx, Linear::Matrix &dQdx)
Populates the device's Jacobian object with these pointers.
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
double * nextSolVectorRawPtr