Xyce  6.1
N_DEV_MESFET.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_MESFET.C,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 02/28/00
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.129.2.1 $
40 //
41 // Revision Date : $Date: 2015/04/02 18:20:11 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-------------------------------------------------------------------------
45 
46 #include <Xyce_config.h>
47 
48 
49 // ---------- Standard Includes ----------
50 #include <N_UTL_Math.h>
51 
52 // ---------- Xyce Includes ----------
53 #include <N_DEV_Const.h>
54 #include <N_DEV_DeviceOptions.h>
55 #include <N_DEV_ExternData.h>
56 #include <N_DEV_MESFET.h>
57 #include <N_DEV_MatrixLoadData.h>
58 #include <N_DEV_SolverState.h>
59 #include <N_DEV_Message.h>
60 #include <N_ERH_ErrorMgr.h>
61 
62 #include <N_LAS_Matrix.h>
63 #include <N_LAS_Vector.h>
64 #include <N_UTL_FeatureTest.h>
65 
66 namespace Xyce {
67 namespace Device {
68 namespace MESFET {
69 
71 {
72  p.addPar("TEMP", 0.0, &MESFET::Instance::temp)
73  .setExpressionAccess(ParameterType::TIME_DEP)
74  .setDescription("Device temperature");
75 
76  p.addPar("AREA", 1.0, &MESFET::Instance::area)
77  .setUnit(U_METER2)
78  .setCategory(CAT_GEOMETRY)
79  .setDescription("device area");
80 }
81 
83 {
84  p.addPar("AF", 1.0, &MESFET::Model::AF)
85  .setUnit(U_NONE)
86  .setCategory(CAT_FLICKER)
87  .setDescription("Flicker noise exponent");
88 
89  p.addPar("B", 0.3, &MESFET::Model::B)
90  .setUnit(U_VOLTM1)
91  .setCategory(CAT_PROCESS)
92  .setDescription("Doping tail parameter");
93 
94  p.addPar("BETA", 2.5e-3, &MESFET::Model::BETA)
95  .setUnit(U_AMPVM2)
96  .setCategory(CAT_PROCESS)
97  .setDescription("Transconductance parameter");
98 
99  p.addPar("ALPHA", 2.0, &MESFET::Model::ALPHA)
100  .setUnit(U_VOLTM1)
101  .setCategory(CAT_PROCESS)
102  .setDescription("Saturation voltage parameter");
103 
104  p.addPar("CGS", 0.0, &MESFET::Model::CGS)
105  .setExpressionAccess(ParameterType::MIN_CAP)
106  .setUnit(U_FARAD)
107  .setCategory(CAT_CAP)
108  .setDescription("Zero-bias gate-source junction capacitance");
109 
110  p.addPar("CGD", 0.0, &MESFET::Model::CGD)
111  .setExpressionAccess(ParameterType::MIN_CAP)
112  .setUnit(U_FARAD)
113  .setCategory(CAT_CAP)
114  .setDescription("Zero-bias gate-drain junction capacitance");
115 
116  p.addPar("FC", 0.5, &MESFET::Model::FC)
117  .setUnit(U_FARAD)
118  .setCategory(CAT_CAP)
119  .setDescription("Coefficient for forward-bias depletion capacitance");
120 
121  p.addPar("IS", 1e-14, &MESFET::Model::IS)
122  .setUnit(U_AMP)
123  .setCategory(CAT_CURRENT)
124  .setDescription("Gate junction saturation current");
125 
126  p.addPar("KF", 0.05, &MESFET::Model::KF)
127  .setUnit(U_NONE)
128  .setCategory(CAT_FLICKER)
129  .setDescription("Flicker noise coefficient");
130 
131  p.addPar("LAMBDA",0.0, &MESFET::Model::LAMBDA)
132  .setUnit(U_VOLTM1)
133  .setCategory(CAT_VOLT)
134  .setDescription("Channel length modulation");
135 
136  p.addPar("PB", 1.0, &MESFET::Model::PB)
137  .setUnit(U_VOLT)
138  .setCategory(CAT_VOLT)
139  .setDescription("Gate junction potential");
140 
141  p.addPar("RD", 0.0, &MESFET::Model::RD)
142  .setExpressionAccess(ParameterType::MIN_RES)
143  .setUnit(U_OHM)
144  .setCategory(CAT_RES)
145  .setDescription("Drain ohmic resistance");
146 
147  p.addPar("RS", 0.0, &MESFET::Model::RS)
148  .setExpressionAccess(ParameterType::MIN_RES)
149  .setUnit(U_OHM)
150  .setCategory(CAT_RES)
151  .setDescription("Source ohmic resistance");
152 
153  p.addPar("TNOM", 0.0, &MESFET::Model::TNOM)
154  .setUnit(STANDARD)
155  .setCategory(CAT_NONE)
156  .setDescription("Parameter measurement temperature");
157 
158  p.addPar("VTO", 0.0, &MESFET::Model::VTO)
159  .setUnit(U_VOLT)
160  .setCategory(CAT_VOLT)
161  .setDescription("Threshold voltage");
162 
164 }
165 
166 std::vector< std::vector<int> > Instance::jacStamp_DC_SC;
167 std::vector< std::vector<int> > Instance::jacStamp_DC;
168 std::vector< std::vector<int> > Instance::jacStamp_SC;
169 std::vector< std::vector<int> > Instance::jacStamp;
170 
171 std::vector<int> Instance::jacMap_DC_SC;
172 std::vector<int> Instance::jacMap_DC;
173 std::vector<int> Instance::jacMap_SC;
174 std::vector<int> Instance::jacMap;
175 
176 std::vector< std::vector<int> > Instance::jacMap2_DC_SC;
177 std::vector< std::vector<int> > Instance::jacMap2_DC;
178 std::vector< std::vector<int> > Instance::jacMap2_SC;
179 std::vector< std::vector<int> > Instance::jacMap2;
180 
181 //------------------- Class Model ---------------------------------
182 //-----------------------------------------------------------------------------
183 // Function : Model::Model
184 // Purpose : model block constructor
185 // Special Notes :
186 // Scope : public
187 // Creator : pmc
188 // Creation Date : 11/16/2003
189 //-----------------------------------------------------------------------------
191  const Configuration & configuration,
192  const ModelBlock & MB,
193  const FactoryBlock & factory_block)
194  : DeviceModel(MB, configuration.getModelParameters(), factory_block),
195  AF(1.0),
196  B(0.3),
197  ALPHA(2.0),
198  BETA(2.5e-3),
199  CGS(0.0),
200  CGD(0.0),
201  FC(0.5),
202  IS(1.0e-14),
203  KF(0.0),
204  LAMBDA(0.0),
205  PB(1.0),
206  RD(0.0),
207  RS(0.0),
208  TNOM(CONSTREFTEMP),
209  VTO(-2.0),
210  fNcoef(0.0),
211  fNexp(1.0),
212  dtype(CONSTNMOS)
213 {
214  if (getType() != "")
215  {
216  if (getType() == "NMF") {
217  dtype = CONSTNMOS;
218  }
219  else if (getType() == "PMF") {
220  dtype = CONSTPMOS;
221  }
222  else
223  {
224  UserError0(*this) << "Could not recognize the type for model " << getName();
225  }
226  }
227 
228 
229  // Set params to constant default values:
230  setDefaultParams ();
231 
232  // Set params according to .model line and constant defaults from metadata:
233  setModParams (MB.params);
234 
235  // Set any non-constant parameter defaults:
236  if (!given("TNOM"))
238 
239  // Calculate any parameters specified as expressions:
241 
242  // calculate dependent (ie computed) params and check for errors:
243  processParams ();
244 }
245 
246 //-----------------------------------------------------------------------------
247 // Function : Model::~Model
248 // Purpose : destructor
249 // Special Notes :
250 // Scope : public
251 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
252 // Creation Date : 3/16/00
253 //-----------------------------------------------------------------------------
255 {
256  std::vector<Instance*>::iterator iter;
257  std::vector<Instance*>::iterator first = instanceContainer.begin();
258  std::vector<Instance*>::iterator last = instanceContainer.end();
259 
260  for (iter=first; iter!=last; ++iter)
261  {
262  delete (*iter);
263  }
264 
265 }
266 
267 
268 //-----------------------------------------------------------------------------
269 // Function : Model::printOutInstances
270 // Purpose : debugging tool.
271 // Special Notes :
272 // Scope : public
273 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
274 // Creation Date : 3/16/00
275 //-----------------------------------------------------------------------------
276 std::ostream &Model::printOutInstances(std::ostream &os) const
277 {
278  std::vector<Instance*>::const_iterator iter;
279  std::vector<Instance*>::const_iterator first = instanceContainer.begin();
280  std::vector<Instance*>::const_iterator last = instanceContainer.end();
281 
282  int i,isize;
283  isize = instanceContainer.size();
284  os << std::endl;
285  os << "Number of MESFET Instances: " << isize << std::endl;
286  os << " name model name Parameters" << std::endl;
287 
288  for (i=0, iter=first; iter!=last; ++iter, ++i)
289  {
290  os << " " << i << ": " << (*iter)->getName() << "\t";
291  os << getName();
292  os << std::endl;
293  }
294 
295  os << std::endl;
296 
297  return os;
298 }
299 
300 //-----------------------------------------------------------------------------
301 // Function : Model::forEachInstance
302 // Purpose :
303 // Special Notes :
304 // Scope : public
305 // Creator : David Baur
306 // Creation Date : 2/4/2014
307 //-----------------------------------------------------------------------------
308 /// Apply a device instance "op" to all instances associated with this
309 /// model
310 ///
311 /// @param[in] op Operator to apply to all instances.
312 ///
313 ///
314 void Model::forEachInstance(DeviceInstanceOp &op) const /* override */
315 {
316  for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
317  op(*it);
318 }
319 
320 
321 //-----------------------------------------------------------------------------
322 // Function : Model::processParams
323 // Purpose :
324 // Special Notes :
325 // Scope : public
326 // Creator : pmc
327 // Creation Date : 11/16/2003
328 //-----------------------------------------------------------------------------
330 {
331 
332  return true;
333 }
334 
335 //----------------------------------------------------------------------------
336 // Function : Model::processInstanceParams
337 // Purpose :
338 // Special Notes :
339 // Scope : public
340 // Creator : Dave Shirely, PSSI
341 // Creation Date : 03/23/06
342 //----------------------------------------------------------------------------
344 {
345 
346  std::vector<Instance*>::iterator iter;
347  std::vector<Instance*>::iterator first = instanceContainer.begin();
348  std::vector<Instance*>::iterator last = instanceContainer.end();
349 
350  for (iter=first; iter!=last; ++iter)
351  {
352  (*iter)->processParams();
353  }
354 
355  return true;
356 }
357 
358 //------------------------ Class Instance -------------------------
359 //-----------------------------------------------------------------------------
360 // Function : Instance::Instance
361 // Purpose : instance block constructor
362 // Special Notes :
363 // Scope : public
364 // Creator : pmc
365 // Creation Date : 11/16/2003
366 //-----------------------------------------------------------------------------
368  const Configuration & configuration,
369  const InstanceBlock & instance_block,
370  Model & model,
371  const FactoryBlock & factory_block)
372  : DeviceInstance(instance_block, configuration.getInstanceParameters(), factory_block),
373  model_(model),
374  limitedFlag(false),
375  off(0),
376  ic(0),
377  area(1.0),
378  ic_vds(0.0),
379  ic_vgs(0.0),
380  temp(getDeviceOptions().temp.getImmutableValue<double>()),
381  sourceCond(0.0),
382  drainCond(0.0),
383  tCGS(0.0),
384  tCGD(0.0),
385  tIS(0.0),
386  tPB(0.0),
387  tBeta(0.0),
388  tvt0(0.0),
389  tLambda(0.0),
390  tAlpha(0.0),
391  tRD(0.0),
392  tRS(0.0),
393  tMESb(0.0),
394  Bfac(0.0),
395  dNode(0),
396  gNode(0),
397  sNode(0),
398  dpNode(0),
399  spNode(0),
400  Vgs(0.0),
401  Vgd(0.0),
402  gm(0.0),
403  gds(0.0),
404  ggs(0.0),
405  ggd(0.0),
406  p(0.0),
407  // Solution variables and intermediate quantities
408  // drain,source,gate, drainprime and sourceprime voltages
409  Vd(0.0),
410  Vs(0.0),
411  Vg(0.0),
412  Vdp(0.0),
413  Vsp(0.0),
414  // vector local indices
415  li_Drain(-1),
416  li_DrainPrime(-1),
417  li_Source(-1),
418  li_SourcePrime(-1),
419  li_Gate(-1),
420  // Jacobian Matrix
421  // Jacobian Matrix Offset:
422  // V_d Row:
423  ADrainEquDrainNodeOffset(-1),
424  ADrainEquDrainPrimeNodeOffset(-1),
425  // V_g Row:
426  AGateEquGateNodeOffset(-1),
427  AGateEquDrainPrimeNodeOffset(-1),
428  AGateEquSourcePrimeNodeOffset(-1),
429  // V_s Row:
430  ASourceEquSourceNodeOffset(-1),
431  ASourceEquSourcePrimeNodeOffset(-1),
432  // V_d' Row:
433  ADrainPrimeEquDrainNodeOffset(-1),
434  ADrainPrimeEquGateNodeOffset(-1),
435  ADrainPrimeEquDrainPrimeNodeOffset(-1),
436  ADrainPrimeEquSourcePrimeNodeOffset(-1),
437  // V_s' Row:
438  ASourcePrimeEquGateNodeOffset(-1),
439  ASourcePrimeEquSourceNodeOffset(-1),
440  ASourcePrimeEquDrainPrimeNodeOffset(-1),
441  ASourcePrimeEquSourcePrimeNodeOffset(-1),
442 
444  // dFdx Matrix Ptr:
445  // V_d Row:
446  f_DrainEquDrainNodePtr(0),
447  f_DrainEquDrainPrimeNodePtr(0),
448  // V_g Row:
449  f_GateEquGateNodePtr(0),
450  f_GateEquDrainPrimeNodePtr(0),
451  f_GateEquSourcePrimeNodePtr(0),
452  // V_s Row:
453  f_SourceEquSourceNodePtr(0),
454  f_SourceEquSourcePrimeNodePtr(0),
455  // V_d' Row:
456  f_DrainPrimeEquDrainNodePtr(0),
457  f_DrainPrimeEquGateNodePtr(0),
458  f_DrainPrimeEquDrainPrimeNodePtr(0),
459  f_DrainPrimeEquSourcePrimeNodePtr(0),
460  // V_s' Row:
461  f_SourcePrimeEquGateNodePtr(0),
462  f_SourcePrimeEquSourceNodePtr(0),
463  f_SourcePrimeEquDrainPrimeNodePtr(0),
464  f_SourcePrimeEquSourcePrimeNodePtr(0),
465 
466  // dQdx Matrix Ptr:
467  // V_d Row:
468  q_DrainEquDrainNodePtr(0),
469  q_DrainEquDrainPrimeNodePtr(0),
470  // V_g Row:
471  q_GateEquGateNodePtr(0),
472  q_GateEquDrainPrimeNodePtr(0),
473  q_GateEquSourcePrimeNodePtr(0),
474  // V_s Row:
475  q_SourceEquSourceNodePtr(0),
476  q_SourceEquSourcePrimeNodePtr(0),
477  // V_d' Row:
478  q_DrainPrimeEquDrainNodePtr(0),
479  q_DrainPrimeEquGateNodePtr(0),
480  q_DrainPrimeEquDrainPrimeNodePtr(0),
481  q_DrainPrimeEquSourcePrimeNodePtr(0),
482  // V_s' Row:
483  q_SourcePrimeEquGateNodePtr(0),
484  q_SourcePrimeEquSourceNodePtr(0),
485  q_SourcePrimeEquDrainPrimeNodePtr(0),
486  q_SourcePrimeEquSourcePrimeNodePtr(0),
487 #endif
488  vgs(0.0),
489  vgd(0.0),
490  vgs_old(0.0),
491  vgd_old(0.0),
492  vds_old(0.0),
493  vgs_orig(0.0),
494  vgd_orig(0.0),
495 
496  capgs(0.0),
497  qgs(0.0),
498  cqgs(0.0),
499  capgd(0.0),
500  qgd(0.0),
501  cqgd(0.0),
502  mode(1),
503  // local indices
504  li_store_vgs(-1),
505  li_store_vgd(-1),
506  li_store_dev_id(-1),
507  li_store_dev_ig(-1),
508  li_store_dev_is(-1),
509  li_state_qgs(-1),
510  li_state_gcgs(-1),
511  li_state_qgd(-1),
512  li_state_gcgd(-1)
513 {
514  numIntVars = 2;
515  numExtVars = 3;
516  numStateVars = 4;
517  setNumStoreVars(2);
518  numLeadCurrentStoreVars = 3; // lead currents drain, gate and source
519 
520  devConMap.resize(3);
521  devConMap[0] = 1;
522  devConMap[1] = 2;
523  devConMap[2] = 1;
524 
525  if( jacStamp.empty() )
526  {
527  // stamp for RS!=0, RD!=0
528  jacStamp_DC_SC.resize(5);
529  jacStamp_DC_SC[0].resize(2); // Drain row
530  jacStamp_DC_SC[0][0]=0; // d-d
531  jacStamp_DC_SC[0][1]=3; // d-d'
532  jacStamp_DC_SC[1].resize(3); // Gate row
533  jacStamp_DC_SC[1][0]=1; // g-g
534  jacStamp_DC_SC[1][1]=3; // g-d'
535  jacStamp_DC_SC[1][2]=4; // g-s'
536  jacStamp_DC_SC[2].resize(2); // Source row
537  jacStamp_DC_SC[2][0]=2; // s-s
538  jacStamp_DC_SC[2][1]=4; // s-s'
539  jacStamp_DC_SC[3].resize(4); // Drain' row
540  jacStamp_DC_SC[3][0]=0; // d'-d
541  jacStamp_DC_SC[3][1]=1; // d'-g
542  jacStamp_DC_SC[3][2]=3; // d'-d'
543  jacStamp_DC_SC[3][3]=4; // d'-s'
544  jacStamp_DC_SC[4].resize(4); // Source' row
545  jacStamp_DC_SC[4][0]=1; // s'-g
546  jacStamp_DC_SC[4][1]=2; // s'-s
547  jacStamp_DC_SC[4][2]=3; // s'-d'
548  jacStamp_DC_SC[4][3]=4; // s'-s'
549 
550  jacMap_DC_SC.clear();
552  jacStamp_DC, jacMap_DC, jacMap2_DC, 4, 2, 5);
553 
555  jacStamp_SC, jacMap_SC, jacMap2_SC, 3, 0, 5);
556 
558  jacStamp, jacMap, jacMap2, 3, 0, 5);
559 
560  }
561 
562  // Set params to constant default values:
563  setDefaultParams ();
564 
565  // Set params according to instance line and constant defaults from metadata:
566  setParams(instance_block.params);
567 
568  // Set any non-constant parameter defaults:
569  if (!given("TEMP"))
570  temp = getDeviceOptions().temp.getImmutableValue<double>();
571 
573 
574  // Calculate any parameters specified as expressions:
575  processParams ();
576 
577  // process source/drain series resistance
578  drainCond = 0;
579  if (model_.RD != 0)
581  sourceCond = 0;
582  if (model_.RS != 0)
584 
585  numIntVars = (((sourceCond == 0.0)?0:1)+((drainCond == 0.0)?0:1));
586 
587 }
588 
589 //-----------------------------------------------------------------------------
590 // Function : Instance::~Instance
591 // Purpose : destructor
592 // Special Notes :
593 // Scope : public
594 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
595 // Creation Date : 3/16/00
596 //-----------------------------------------------------------------------------
598 {
599 }
600 
601 //----------------------------------------------------------------------------
602 // Function : Instance::registerLIDs
603 // Purpose :
604 // Special Notes :
605 // Scope : public
606 // Creator : pmc
607 // Creation Date : 11/16/2003
608 //----------------------------------------------------------------------------
609 void Instance::registerLIDs( const std::vector<int> & intLIDVecRef,
610  const std::vector<int> & extLIDVecRef )
611 {
612  numIntVars = (((sourceCond == 0.0)?0:1)+((drainCond == 0.0)?0:1));
613 
614  AssertLIDs(intLIDVecRef.size() == numIntVars);
615  AssertLIDs(extLIDVecRef.size() == numExtVars);
616 
617  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
618  {
619  Xyce::dout() << std::endl << section_divider << std::endl;
620  Xyce::dout() << " Instance::registerLIDs" << std::endl;
621  Xyce::dout() << " name = " << getName() << std::endl;
622  Xyce::dout() << " number of internal variables: " << numIntVars << std::endl;
623  Xyce::dout() << " number of external variables: " << numExtVars << std::endl;
624  }
625 
626  // copy over the global ID lists.
627  intLIDVec = intLIDVecRef;
628  extLIDVec = extLIDVecRef;
629 
630  // now use these lists to obtain the indices into the
631  // linear algebra entities. This assumes an order.
632  // For the matrix indices, first do the rows.
633 
634  li_Drain = extLIDVec[0];
635  li_Gate = extLIDVec[1];
636  li_Source = extLIDVec[2];
637 
638  int intLoc = 0;
639 
640  if( drainCond )
641  li_DrainPrime = intLIDVec[intLoc++];
642  else
644 
645  if( sourceCond )
646  li_SourcePrime = intLIDVec[intLoc];
647  else
649 
650  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
651  {
652  Xyce::dout() << "\n variable local indices:\n";
653  Xyce::dout() << " li_Drain = " << li_Drain << std::endl;
654  Xyce::dout() << " li_DrainPrime = " << li_DrainPrime << std::endl;
655  Xyce::dout() << " li_Source = " << li_Source << std::endl;
656  Xyce::dout() << " li_SourcePrime = " << li_SourcePrime << std::endl;
657  Xyce::dout() << " li_Gate = " << li_Gate << std::endl;
658 
659  Xyce::dout() << section_divider << std::endl;
660  }
661 }
662 
663 //-----------------------------------------------------------------------------
664 // Function : Instance::loadNodeSymbols
665 // Purpose :
666 // Special Notes :
667 // Scope : public
668 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
669 // Creation Date : 05/13/05
670 //-----------------------------------------------------------------------------
671 void Instance::loadNodeSymbols(Util::SymbolTable &symbol_table) const
672 {
673  if (drainCond != 0.0)
674  addInternalNode(symbol_table, li_DrainPrime, getName(), "drainprime");
675 
676  if (sourceCond != 0.0)
677  addInternalNode(symbol_table, li_SourcePrime, getName(), "sourceprime");
678 
679  if (loadLeadCurrent)
680  {
681  addStoreNode(symbol_table, li_store_dev_id, getName(), "DEV_ID");
682  addStoreNode(symbol_table, li_store_dev_is, getName(), "DEV_IS");
683  addStoreNode(symbol_table, li_store_dev_ig, getName(), "DEV_IG");
684  }
685 }
686 
687 //----------------------------------------------------------------------------
688 // Function : Instance::registerStateLIDs
689 // Purpose :
690 // Special Notes :
691 // Scope : public
692 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
693 // Creation Date : 3/16/00
694 //----------------------------------------------------------------------------
695 void Instance::registerStateLIDs(const std::vector<int> & staLIDVecRef)
696 {
697  AssertLIDs(staLIDVecRef.size() == numStateVars);
698 
699  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
700  {
701  Xyce::dout() << std::endl;
702  Xyce::dout() << section_divider << std::endl;
703  Xyce::dout() << " In Instance::registerStateLIDs\n\n";
704  Xyce::dout() << " name = " << getName() << std::endl;
705  Xyce::dout() << " Number of State LIDs: " << numStateVars << std::endl;
706  }
707 
708  // Copy over the global ID lists:
709  staLIDVec = staLIDVecRef;
710 
711  int lid=0;
712  li_state_qgs = staLIDVec[lid++];
713  li_state_gcgs = staLIDVec[lid++];
714 
715  li_state_qgd = staLIDVec[lid++];
716  li_state_gcgd = staLIDVec[lid++];
717 
718  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
719  {
720  Xyce::dout() << " State local indices:" << std::endl;
721  Xyce::dout() << std::endl;
722 
723  Xyce::dout() << " li_state_qgs = " << li_state_qgs << std::endl;
724  Xyce::dout() << " li_state_gcgs = " << li_state_gcgs;
725  Xyce::dout() << " li_state_qgd = " << li_state_qgd;
726  Xyce::dout() << " li_state_gcgd = " << li_state_gcgd << std::endl;;
727 
728  Xyce::dout() << section_divider << std::endl;
729  }
730 
731 }
732 
733 //----------------------------------------------------------------------------
734 // Function : Instance::registerStoreLIDs
735 // Purpose :
736 // Special Notes :
737 // Scope : public
738 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
739 // Creation Date : 12/9/11
740 //----------------------------------------------------------------------------
741 void Instance::registerStoreLIDs(const std::vector<int> & stoLIDVecRef)
742 {
743  AssertLIDs(stoLIDVecRef.size() == getNumStoreVars());
744 
745  // Copy over the global ID lists:
746  stoLIDVec = stoLIDVecRef;
747 
748  int lid=0;
749  li_store_vgs = stoLIDVec[lid++];
750  li_store_vgd = stoLIDVec[lid++];
751 
752  if( loadLeadCurrent )
753  {
754  li_store_dev_id = stoLIDVec[lid++];
755  li_store_dev_ig = stoLIDVec[lid++];
756  li_store_dev_is = stoLIDVec[lid++];
757  }
758 }
759 
760 //----------------------------------------------------------------------------
761 // Function : Instance::jacobianStamp
762 // Purpose :
763 // Special Notes :
764 // Scope : public
765 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
766 // Creation Date : 3/16/00
767 //----------------------------------------------------------------------------
768 const std::vector< std::vector<int> > & Instance::jacobianStamp() const
769 {
770  if( drainCond != 0.0 && sourceCond != 0.0 )
771  return jacStamp_DC_SC;
772  else if( drainCond != 0.0 && sourceCond == 0.0 )
773  return jacStamp_DC;
774  else if( drainCond == 0.0 && sourceCond != 0.0 )
775  return jacStamp_SC;
776  else if( drainCond == 0.0 && sourceCond == 0.0 )
777  return jacStamp;
778  else
779  return jacStamp;
780 }
781 
782 //----------------------------------------------------------------------------
783 // Function : Instance::registerJacLIDs
784 // Special Notes :
785 // Scope : public
786 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
787 // Creation Date : 3/16/00
788 //----------------------------------------------------------------------------
789 void Instance::registerJacLIDs( const std::vector< std::vector<int> > & jacLIDVec )
790 {
791  DeviceInstance::registerJacLIDs( jacLIDVec );
792  std::vector<int> map;
793  std::vector< std::vector<int> > map2;
794 
795  if (drainCond != 0.0)
796  {
797  if (sourceCond != 0.0)
798  {
799  map = jacMap_DC_SC;
800  map2 = jacMap2_DC_SC;
801  }
802  else
803  {
804  map = jacMap_DC;
805  map2 = jacMap2_DC;
806  }
807  }
808  else
809  {
810  if (sourceCond != 0.0)
811  {
812  map = jacMap_SC;
813  map2 = jacMap2_SC;
814  }
815  else
816  {
817  map = jacMap;
818  map2 = jacMap2;
819  }
820  }
821 
822  ADrainEquDrainNodeOffset = jacLIDVec[map[0]][map2[0][0]];
823  ADrainEquDrainPrimeNodeOffset = jacLIDVec[map[0]][map2[0][1]];
824 
825  AGateEquGateNodeOffset = jacLIDVec[map[1]][map2[1][0]];
826  AGateEquDrainPrimeNodeOffset = jacLIDVec[map[1]][map2[1][1]];
827  AGateEquSourcePrimeNodeOffset = jacLIDVec[map[1]][map2[1][2]];
828 
829  ASourceEquSourceNodeOffset = jacLIDVec[map[2]][map2[2][0]];
830  ASourceEquSourcePrimeNodeOffset = jacLIDVec[map[2]][map2[2][1]];
831 
832  ADrainPrimeEquDrainNodeOffset = jacLIDVec[map[3]][map2[3][0]];
833  ADrainPrimeEquGateNodeOffset = jacLIDVec[map[3]][map2[3][1]];
834  ADrainPrimeEquDrainPrimeNodeOffset = jacLIDVec[map[3]][map2[3][2]];
835  ADrainPrimeEquSourcePrimeNodeOffset = jacLIDVec[map[3]][map2[3][3]];
836 
837  ASourcePrimeEquGateNodeOffset = jacLIDVec[map[4]][map2[4][0]];
838  ASourcePrimeEquSourceNodeOffset = jacLIDVec[map[4]][map2[4][1]];
839  ASourcePrimeEquDrainPrimeNodeOffset = jacLIDVec[map[4]][map2[4][2]];
840  ASourcePrimeEquSourcePrimeNodeOffset = jacLIDVec[map[4]][map2[4][3]];
841 }
842 
843 //-----------------------------------------------------------------------------
844 // Function : Instance::setupPointers
845 // Purpose :
846 // Special Notes :
847 // Scope : public
848 // Creator : Eric Keiter, SNL
849 // Creation Date : 11/30/08
850 //-----------------------------------------------------------------------------
852 {
853 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
854  Linear::Matrix & dFdx = *(extData.dFdxMatrixPtr);
855  Linear::Matrix & dQdx = *(extData.dQdxMatrixPtr);
856 
857  // F-matrix:
860 
864 
867 
872 
877 
878  // Q-matrix:
881 
885 
888 
893 
898 
899 #endif
900 }
901 
902 //----------------------------------------------------------------------------
903 // Function : Instance::updatePrimaryState
904 // Purpose :
905 // Special Notes :
906 // Scope : public
907 // Creator : pmc
908 // Creation Date : 11/16/2003
909 //----------------------------------------------------------------------------
911 {
912  double * staVec = extData.nextStaVectorRawPtr;
913  bool bsuccess = updateIntermediateVars ();
914 
915  double * stoVec = extData.nextStoVectorRawPtr;
916  stoVec[li_store_vgs] = vgs;
917  stoVec[li_store_vgd] = vgd;
918  staVec[li_state_qgs] = qgs;
919  staVec[li_state_qgd] = qgd;
920 
921  return bsuccess;
922 }
923 
924 //-----------------------------------------------------------------------------
925 // Function : Instance::updateIntermediateVars
926 // Purpose :
927 // Special Notes :
928 // Scope : public
929 // Creator : pmc
930 // Creation Date : 11/16/2003
931 //-----------------------------------------------------------------------------
933 {
934  double * solVec = extData.nextSolVectorRawPtr;
935  double * currStaVec = extData.currStaVectorRawPtr;
936 
937  int dtype;
938  double csat, betap;
939  double vgst, vgdt;
940  double evgs, evgd;
941  double sarg, vtf;;
942 
943 // from the spice jfet
944  double czgd, czgs;
945  double czgdf2, czgsf2;
946  double fcpb2;
947  double twop;
948  int icheck, ichk1;
949 
950 // for the Shockley version
951 // double A, B, C, B12, C12, D, Vdsat;
952 // double delta;
953  double prod, denom, invdenom, afact, lfact;
954 
955  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) && getSolverState().debugTimeFlag)
956  {
957  Xyce::dout() << subsection_divider << std::endl;
958  Xyce::dout() <<" Instance::updateIntermediateVars.\n"<<std::endl;
959  Xyce::dout() <<" name = " << getName() << std::endl;
960  Xyce::dout() <<" Model name = " << model_.getName() << std::endl;
961  Xyce::dout() <<" dtype is " << model_.dtype << std::endl;
962  Xyce::dout() << std::endl;
963  Xyce::dout().width(25); Xyce::dout().precision(17); Xyce::dout().setf(std::ios::scientific);
964  }
965 
966  icheck = 1;
967  dtype = model_.dtype;
968 
969  // we need our solution variables for any of this stuff
970  Vd = 0.0;
971  Vs = 0.0;
972  Vg = 0.0;
973  Vdp = 0.0;
974  Vsp = 0.0;
975 
976  Vd = solVec[li_Drain];
977  Vg = solVec[li_Gate];
978  Vs = solVec[li_Source];
979  Vsp = solVec[li_SourcePrime];
980  Vdp = solVec[li_DrainPrime];
981 
982  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) && getSolverState().debugTimeFlag)
983  {
984  Xyce::dout() << " " << std::endl;
985  Xyce::dout() << " Vg = " << Vg << std::endl;
986  Xyce::dout() << " Vd = " << Vd << std::endl;
987  Xyce::dout() << " Vs = " << Vs << std::endl;
988  Xyce::dout() << " Vdp = " << Vdp << std::endl;
989  Xyce::dout() << " Vsp = " << Vsp << std::endl;
990  }
991 
992  // now we need voltage drops
993  Vddp = Vd - Vdp;
994  Vssp = Vs - Vsp;
995  Vgsp = Vg - Vsp;
996  Vgdp = Vg - Vdp;
997  Vdpsp = Vdp - Vsp;
998 
999  // Now the things that the 3f5 code really uses
1000  vgs = dtype * Vgsp;
1001  vgd = dtype * Vgdp;
1002  vds = vgs-vgd;
1003 
1004  origFlag = 1;
1005  limitedFlag = false;
1006  vgs_orig = vgs;
1007  vgd_orig = vgd;
1008  vds_orig = vds;
1009 
1010  if (getSolverState().newtonIter == 0)
1011  {
1012  if (getSolverState().initJctFlag && getDeviceOptions().voltageLimiterFlag)
1013  {
1014  if (getSolverState().inputOPFlag)
1015  {
1016  Linear::Vector * flagSolVectorPtr = extData.flagSolVectorPtr;
1017  if ((*flagSolVectorPtr)[li_Drain] == 0 || (*flagSolVectorPtr)[li_Gate] == 0 ||
1018  (*flagSolVectorPtr)[li_Source] == 0 || (*flagSolVectorPtr)[li_SourcePrime] ||
1019  (*flagSolVectorPtr)[li_DrainPrime] )
1020  {
1021  vgs = 0;
1022  vgd = 0;
1023  vds = vgs-vgd;
1024  }
1025  }
1026  else
1027  {
1028  vgs = 0;
1029  vgd = 0;
1030  vds = vgs-vgd;
1031  }
1032  }
1033  if (!(getSolverState().dcopFlag)||(getSolverState().locaEnabledFlag && getSolverState().dcopFlag))
1034  {
1035  double * currStoVec = extData.currStoVectorRawPtr;
1036  vgs_old = currStoVec[li_store_vgs];
1037  vgd_old = currStoVec[li_store_vgd];
1038  }
1039  else
1040  { // there is no history
1041  vgs_old = vgs;
1042  vgd_old = vgd;
1043  }
1044  }
1045  else
1046  {
1047  double *stoVec = extData.nextStoVectorRawPtr;
1048  vgs_old = stoVec[li_store_vgs];
1049  vgd_old = stoVec[li_store_vgd];
1050  }
1051 
1052  // SPICE-type Voltage Limiting
1053  ///////////////////////////////
1054 
1055  if (getDeviceOptions().voltageLimiterFlag)
1056  {
1057  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) && getSolverState().debugTimeFlag)
1058  {
1059  Xyce::dout() << " before limiting: " << std::endl;
1060  Xyce::dout() << " vgs = " << vgs << " vgs_old = " << vgs_old << std::endl;
1061  Xyce::dout() << " vgd = " << vgd << " vgd_old = " << vgd_old << std::endl;
1062  }
1063 
1064  ichk1=1;
1065  vgs = devSupport.pnjlim(vgs, vgs_old, vt, vcrit, &icheck);
1066  vgd = devSupport.pnjlim(vgd, vgd_old, vt, vcrit, &ichk1);
1067 
1068  if (ichk1 == 1) {icheck=1;}
1069  if (icheck == 1) limitedFlag=true;
1070 
1072  vgd = devSupport.fetlim(vgd, vgd_old, tvt0);
1073  vds = vgs-vgd;
1074 
1075  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) && getSolverState().debugTimeFlag)
1076  {
1077  Xyce::dout() << " After limiting: " << std::endl;
1078  Xyce::dout() << " vgs = " << vgs << std::endl;
1079  Xyce::dout() << " vgd = " << vgd << std::endl;
1080  Xyce::dout() << " " << std::endl;
1081  }
1082  }
1083 
1084  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) && getSolverState().debugTimeFlag)
1085  {
1086  Xyce::dout() << "vgs = " << vgs << std::endl;
1087  Xyce::dout() << "vgd = " << vgd << std::endl;
1088  Xyce::dout() << "vds = " << vds << std::endl;
1089  Xyce::dout() << "Vddp = " << Vddp << std::endl;
1090  Xyce::dout() << "Vssp = " << Vssp << std::endl;
1091  Xyce::dout() << "Vgsp = " << Vgsp << std::endl;
1092  Xyce::dout() << "Vgdp = " << Vgdp << std::endl;
1093  Xyce::dout() << "Vdpsp = " << Vdpsp << std::endl;
1094  Xyce::dout() << " " << std::endl;
1095  }
1096  // Now set the origFlag
1097  if (vgs_orig != vgs || vds_orig != vds || vgd_orig != vgd) origFlag = 0;
1098 
1099  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) && getSolverState().debugTimeFlag)
1100  {
1101  if (origFlag == 0)
1102  {
1103  Xyce::dout() << " Something modified the voltages. " << std::endl;
1104  Xyce::dout() << " Voltage before after diff " << std::endl;
1105  Xyce::dout() << " vgs " << vgs_orig << " " << vgs << " " << vgs-vgs_orig << std::endl;
1106  Xyce::dout() << " vgd " << vgd_orig << " " << vgd << " " << vgd-vgd_orig << std::endl;
1107  Xyce::dout() << " vds " << vds_orig << " " << vds << " " << vds-vds_orig << std::endl;
1108  Xyce::dout() << " " << std::endl;
1109  }
1110  }
1111 
1112  //
1113  // the following block of code evaluates the dc current and its
1114  // derivatives and the charges associated with the gate and
1115  // channel
1116  //
1117 
1118  // vt set in updateTemperature
1119  vtf = 5.0*vt;
1120  csat = tIS;
1121  if (vgs <= -vtf)
1122  {
1123  ggs = -csat/vgs + getDeviceOptions().gmin;
1124  cg = ggs*vgs;
1125  }
1126  else
1127  {
1128  evgs = exp(vgs/vt);
1129  ggs = csat*evgs/vt + getDeviceOptions().gmin;
1130  cg = csat*(evgs-1) + getDeviceOptions().gmin*vgs;
1131  }
1132  if (vgd <= -vtf)
1133  {
1134  ggd = -csat/vgd + getDeviceOptions().gmin;
1135  cgd = ggd*vgd;
1136  }
1137  else
1138  {
1139  evgd = exp(vgd/vt);
1140  ggd = csat*evgd/vt + getDeviceOptions().gmin;
1141  cgd = csat*(evgd-1) + getDeviceOptions().gmin*vgd;
1142  }
1143  cg = cg + cgd;
1144 
1145  // 3f5 does this simple stuff
1146  if (vds >= 0)
1147  mode = 1;
1148  else
1149  mode = -1;
1150 
1151  if (vds >= 0) // normal mode
1152  {
1153  vgst = vgs-tvt0;
1154  if (vgst <= 0)
1155  {
1156  //
1157  // normal mode, cutoff region
1158  //
1159  cdrain = 0;
1160  gm = 0;
1161  gds = 0;
1162  }
1163  else
1164  {
1165  prod = 1 + tLambda*vds;
1166  betap = tBeta*prod;
1167  denom = 1 + tMESb*vgst;
1168  invdenom = 1/denom;
1169  if (vds >= ( 3/tAlpha ) )
1170  {
1171  //
1172  // normal mode, saturation region
1173  //
1174  cdrain = betap*vgst*vgst*invdenom;
1175  gm = betap*vgst*(1 + denom)*invdenom*invdenom;
1176  gds = tLambda*tBeta*vgst*vgst*invdenom;
1177  }
1178  else
1179  {
1180  //
1181  // normal mode, linear region
1182  //
1183  afact = 1 - tAlpha*vds/3;
1184  lfact = 1 - afact*afact*afact;
1185  cdrain = betap*vgst*vgst*invdenom*lfact;
1186  gm = betap*vgst*(1 + denom)*invdenom*invdenom*lfact;
1187  gds = tBeta*vgst*vgst*invdenom*(tAlpha*afact*afact*prod + lfact*tLambda);
1188  }
1189  }
1190  }
1191  else // inverse mode
1192  {
1193  vgdt = vgd - tvt0;
1194  if (vgdt <= 0)
1195  {
1196  //
1197  // inverse mode, cutoff region
1198  //
1199  cdrain = 0;
1200  gm = 0;
1201  gds = 0;
1202  }
1203  else
1204  {
1205  //
1206  // inverse mode, saturation region
1207  //
1208  prod = 1 - tLambda*vds;
1209  betap = tBeta*prod;
1210  denom = 1 + tMESb*vgdt;
1211  invdenom = 1/denom;
1212  if ( -vds >= 3/tAlpha )
1213  {
1214  cdrain = -betap*vgdt*vgdt*invdenom;
1215  gm = -betap*vgdt*(1 + denom)*invdenom*invdenom;
1216  gds = tLambda*tBeta*vgdt*vgdt*invdenom - gm;
1217  }
1218  else
1219  {
1220  //
1221  // inverse mode, linear region
1222  //
1223  afact = 1 + tAlpha*vds/3;
1224  lfact = 1 - afact*afact*afact;
1225  cdrain = -betap*vgdt*vgdt*invdenom*lfact;
1226  gm = -betap*vgdt*(1 + denom)*invdenom*invdenom*lfact;
1227  gds = tBeta*vgdt*vgdt*invdenom*(tAlpha*afact*afact*prod
1228  + lfact*tLambda) - gm;
1229  }
1230  }
1231  }
1232  cd = cdrain-cgd;
1233 
1234  //
1235  // charge storage elements
1236  //
1237  twop = 2.0*tPB;
1238  fcpb2 = corDepCap*corDepCap;
1239  czgs = tCGS;
1240  czgd = tCGD;
1241  if(czgs != 0)
1242  {
1243  czgsf2=czgs/f2;
1244  if (vgs < corDepCap)
1245  {
1246  sarg=sqrt(1-vgs/tPB);
1247  qgs = twop*czgs*(1-sarg);
1248  capgs=czgs/sarg;
1249  }
1250  else
1251  {
1252  qgs = czgs*f1 + czgsf2*(f3 *(vgs - corDepCap)
1253  +(vgs*vgs - fcpb2)/(2*twop));
1254  capgs=czgsf2*(f3 + vgs/twop);
1255  }
1256  }
1257  else
1258  {
1259  qgs=0.0;
1260  capgs=0.0;
1261  }
1262 
1263  if(czgd != 0)
1264  {
1265  czgdf2=czgd/f2;
1266  if (vgd < corDepCap)
1267  {
1268  sarg=sqrt(1-vgd/tPB);
1269  qgd = twop*czgd*(1-sarg);
1270  capgd=czgd/sarg;
1271  }
1272  else
1273  {
1274  qgd = czgd*f1 + czgdf2*( f3*(vgd - corDepCap)
1275  +(vgd*vgd - fcpb2)/(2*twop) );
1276  capgd=czgdf2*(f3 + vgd/twop);
1277  }
1278  }
1279  else
1280  {
1281  qgd=0.0;
1282  capgd=0.0;
1283  }
1284 
1285  Idrain = drainCond * Vddp;
1286  Isource = sourceCond * Vssp;
1287 
1288  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) && getSolverState().debugTimeFlag)
1289  {
1290  Xyce::dout() << " Done with Instance::updateIntermediateVars." << std::endl;
1291  Xyce::dout() << " mode = " << mode << std::endl;
1292  Xyce::dout() << " tBeta = " << tBeta << std::endl;
1293  Xyce::dout() << " Idrain = " << Idrain << std::endl;
1294  Xyce::dout() << " Isource = " << Isource << std::endl;
1295  Xyce::dout() << " gds = " << gds << std::endl;
1296  Xyce::dout() << " gm = " << gm << std::endl;
1297  }
1298 
1299  /// CURRENTS to load into RHS:
1300 
1301  // so at this point:
1302 
1303  // current out of drain is
1304  // Idrain
1305 
1306  // current out of gate:
1307  // dtype*( d/dt(qgs) + d/dt(qgd) )
1308 
1309  // the current *out of* the source should be simply
1310  // Isource
1311 
1312  // current out of drain' is
1313  // -Idrain - dtype*( d/dt(qgd) - cdrain )
1314 
1315  // the current out of the source' is
1316  // -Isource - dtype*( d/dt(qgs) + cdrain )
1317 
1318  return true;
1319 }
1320 
1321 //-----------------------------------------------------------------------------
1322 // Function : Instance::loadDAEQVector
1323 //
1324 // Purpose : Loads the Q-vector contributions for a single
1325 // voltage source instance.
1326 //
1327 // Special Notes : The "Q" vector is part of a standard DAE formalism in
1328 // which the system of equations is represented as:
1329 //
1330 // f(x) = dQ(x)/dt + F(x) + B(t) = 0
1331 //
1332 // The "Q" vector contains charges and fluxes, mostly.
1333 // The voltage source will not make any contributions to Q,
1334 // so this function does nothing.
1335 //
1336 // from updateSecondaryState:
1337 //
1338 // ggd = ggd + capgd*(getSolverState().pdt);
1339 // ggs = ggs + capgs*(getSolverState().pdt);
1340 //
1341 // // Sum the capacitor currents into the DC currents.
1342 // cg = cg + cqgs + cqgd;
1343 // cd = cd - cqgd;
1344 // cgd = cgd + cqgd;
1345 //
1346 // So:
1347 //
1348 // replace ggd with capgd.
1349 // replace ggs with capgs
1350 //
1351 // replace cg with qgs+qgd
1352 // replace cd with -qgd
1353 // replace cgd with qgd.
1354 //
1355 //
1356 // Scope : public
1357 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1358 // Creation Date : 06/01/05
1359 //-----------------------------------------------------------------------------
1361 {
1362  double * qVec = extData.daeQVectorRawPtr;
1363  double * dQdxdVp = extData.dQdxdVpVectorRawPtr;
1364 
1365  // set up the final load variables:
1366  int Dtype = model_.dtype;
1367  double ceqgd = Dtype*(qgd);
1368  double ceqgs = Dtype*(((qgs+qgd)-qgd));
1369  double cdreq = Dtype*(((-qgd)+qgd));
1370 
1371  double ceqgd_Jdxp = -Dtype*(capgd*(vgd-vgd_orig));
1372  double ceqgs_Jdxp = -Dtype*(capgs*(vgs-vgs_orig));
1373  double cdreq_Jdxp = 0.0;
1374 
1375  qVec[li_Gate ] += ( ceqgs+ceqgd);
1376  qVec[li_DrainPrime ] -= (-cdreq+ceqgd);
1377  qVec[li_SourcePrime] -= ( cdreq+ceqgs);
1378 
1379  if (!origFlag)
1380  {
1381  dQdxdVp[li_Gate ] -= ( ceqgs_Jdxp+ceqgd_Jdxp);
1382  dQdxdVp[li_DrainPrime ] += (-cdreq_Jdxp+ceqgd_Jdxp);
1383  dQdxdVp[li_SourcePrime] += ( cdreq_Jdxp+ceqgs_Jdxp);
1384  }
1385 
1386  return true;
1387 }
1388 
1389 //-----------------------------------------------------------------------------
1390 // Function : Instance::loadDAEFVector
1391 //
1392 // Purpose : Loads the F-vector contributions for a single
1393 // MESFET instance.
1394 //
1395 // Special Notes :
1396 //
1397 // Scope : public
1398 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1399 // Creation Date : 06/01/05
1400 //-----------------------------------------------------------------------------
1402 {
1403  double * fVec = extData.daeFVectorRawPtr;
1404  double * dFdxdVp = extData.dFdxdVpVectorRawPtr;
1405 
1406  // set up the final load variables:
1407  int Dtype = model_.dtype;
1408  double ceqgd = Dtype*(cgd);
1409  double ceqgs = Dtype*((cg-cgd));
1410  double cdreq = Dtype*((cd+cgd));
1411 
1412  double ceqgd_Jdxp = -Dtype*(ggd*(vgd-vgd_orig));
1413  double ceqgs_Jdxp = -Dtype*(ggs*(vgs-vgs_orig));
1414  double cdreq_Jdxp = -Dtype*(gds*(vds-vds_orig)+gm*(vgs-vgs_orig));
1415 
1416  // optional load resistors:
1417  if (drainCond != 0.0)
1418  {
1419  fVec[li_Drain ] += Idrain;
1420  }
1421  if (sourceCond != 0.0)
1422  {
1423  fVec[li_Source] += Isource;
1424  }
1425 
1426  fVec[li_Gate ] += (ceqgs+ceqgd);
1427  fVec[li_DrainPrime ] -= (Idrain +(-cdreq+ceqgd));
1428  fVec[li_SourcePrime] -= (Isource+(cdreq+ceqgs));
1429 
1430  if (!origFlag)
1431  {
1432  dFdxdVp[li_Gate ] -= ( ceqgs_Jdxp+ceqgd_Jdxp);
1433  dFdxdVp[li_DrainPrime ] += (-cdreq_Jdxp+ceqgd_Jdxp);
1434  dFdxdVp[li_SourcePrime] += ( cdreq_Jdxp+ceqgs_Jdxp);
1435  }
1436 
1437  return true;
1438 }
1439 
1440 //-----------------------------------------------------------------------------
1441 // Function : Instance::loadDAEdQdx
1442 //
1443 // Purpose : Loads the Q-vector contributions for a single
1444 // MESFET instance.
1445 //
1446 // Special Notes : The "Q" vector is part of a standard DAE formalism in
1447 // which the system of equations is represented as:
1448 //
1449 // f(x) = dQ(x)/dt + F(x) - B(t) = 0
1450 //
1451 // Scope : public
1452 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1453 // Creation Date : 06/01/05
1454 //-----------------------------------------------------------------------------
1456 {
1457  Linear::Matrix & dQdx = *(extData.dQdxMatrixPtr);
1458 
1466 
1467  return true;
1468 }
1469 
1470 //-----------------------------------------------------------------------------
1471 // Function : Instance::loadDAEdFdx ()
1472 //
1473 // Purpose : Loads the F-vector contributions for a single
1474 // resistor instance.
1475 //
1476 // Special Notes : The F-vector is an algebraic constaint.
1477 //
1478 // Scope : public
1479 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
1480 // Creation Date : 06/01/05
1481 //-----------------------------------------------------------------------------
1483 {
1484  Linear::Matrix & dFdx = *(extData.dFdxMatrixPtr);
1485 
1488 
1492 
1495 
1499  drainCond+gds+ggd;
1501 
1506  += sourceCond+gds+gm+ggs;
1507 
1508  return true;
1509 }
1510 
1511 //-----------------------------------------------------------------------------
1512 // Function : Instance::updateTemperature
1513 // Purpose :
1514 // Special Notes :
1515 // Scope : public
1516 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1517 // Creation Date : 3/16/00
1518 //-----------------------------------------------------------------------------
1519 bool Instance::updateTemperature ( const double & temp_tmp)
1520 {
1521  bool bsuccess = true;
1522  double tnom, ratio;
1523  double arg, arg1;
1524  double ratio1;
1525  double fact1, fact2;
1526  double kt, kt1;
1527  double vtnom;
1528  double egfet, egfet1;
1529  double pbfact;
1530  double cjfact, cjfact1;
1531  double gmanew, gmaold;
1532  double pbo;
1533  double xfc;
1534  double Pb;
1535 
1536  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) && getSolverState().debugTimeFlag)
1537  {
1538 // Xyce::dout() << subsection_divider << std::endl;
1539  Xyce::dout() << " Instance::Begin of updateTemperature. \n";
1540  Xyce::dout() << " name = " << getName() << std::endl;
1541  Xyce::dout() << std::endl;
1542  }
1543 
1544  // first set the instance temperature to the new temperature:
1545  if (temp_tmp != -999.0) temp = temp_tmp;
1547  {
1548  // make sure interpolation doesn't take any resistance negative
1549  if(model_.RD < 0) model_.RD = 0;
1550  if(model_.RS < 0) model_.RS = 0;
1551 
1552  // some params may have changed during interpolation
1553  // model_.processParams();
1554  }
1555 
1556  Pb = model_.PB;
1557  tnom = model_.TNOM;
1558  ratio = temp/tnom;
1559 
1560  // first do the model stuff
1561 
1562  vtnom = tnom*CONSTKoverQ;
1563  fact1 = tnom/CONSTREFTEMP;
1564  kt1 = CONSTboltz*tnom;
1565  egfet1 = 1.16 - (7.02e-4*tnom*tnom)/(tnom + 1108);
1566  arg1 = -egfet1/(2.0*kt1) + 1.1150877/(CONSTboltz*2.0*CONSTREFTEMP);
1567  pbfact = -2.0*vtnom*(1.5*log(fact1) + CONSTQ*arg1);
1568  pbo = (Pb - pbfact)/fact1;
1569  gmaold = (Pb - pbo)/pbo;
1570  cjfact = 1.0/(1.0 + 0.5*(4e-4*(tnom - CONSTREFTEMP) - gmaold));
1571 
1572  if(model_.FC >.95) {
1573  Xyce::dout() << "Depletion cap. coeff. FC too large, limited to .95" <<
1574  Xyce::dout() << std::endl;
1575  model_.FC = .95;
1576  }
1577  xfc = log(1.0 - model_.FC);
1578  f2 = exp(1.5*xfc);
1579  f3 = 1.0 - 1.5*model_.FC;
1580  // skip bFac
1581 
1582  // now do the instance stuff
1583 
1584  vt = temp*CONSTKoverQ;
1585  kt = temp*CONSTboltz;
1586  fact2 = temp/CONSTREFTEMP;
1587  ratio1 = ratio - 1.0;
1588  tIS = model_.IS*exp(ratio1*1.11/vt)*area;
1589 
1590  tCGS = model_.CGS*cjfact*area;
1591  tCGD = model_.CGD*cjfact*area;
1592  egfet = 1.16 - (7.02e-4*temp*temp)/(temp + 1108);
1593  arg = -egfet/(2.0*kt) + 1.1150877/(CONSTboltz*2.0*CONSTREFTEMP);
1594  pbfact = -2.0*vt*(1.5*log(fact2) + CONSTQ*arg);
1595  tPB = fact2*pbo + pbfact;
1596  gmanew = (tPB - pbo)/pbo;
1597  cjfact1 = 1.0 + 0.5*(4e-4*(temp - CONSTREFTEMP) - gmanew);
1598  tCGS *= cjfact1;
1599  tCGD *= cjfact1;
1600 
1601  corDepCap = model_.FC*tPB;
1602  f1 = tPB*(1.0 - exp((0.5)*xfc))/(0.5);
1603  vcrit = vt * log(vt/(CONSTroot2 * tIS));
1604 
1605  // the following parameters have no temperature dependence in Spice 3f5
1606  //
1607  tBeta = model_.BETA*area; // transconductance parameter
1608  tvt0 = model_.VTO; // threshold voltage
1609  tLambda = model_.LAMBDA; // channel-length modulation
1610  tAlpha = model_.ALPHA; // saturation voltage parameter
1611  tRD = model_.RD/area; // drain ohmic resistance
1612  tRS = model_.RS/area; // source ohmic resistance
1613  tMESb = model_.B; // dopinng tail parameter
1614 
1615  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) && getSolverState().debugTimeFlag)
1616  {
1617  Xyce::dout() << "temp = "<< temp << std::endl;
1618  Xyce::dout() << "tnom = " << tnom << std::endl;
1619  Xyce::dout() << "ratio = " << ratio << std::endl;
1620  Xyce::dout() << "vt = " << vt << std::endl;
1621  Xyce::dout() << "kt = " << kt << std::endl;
1622  Xyce::dout() << "fact2 = " << fact2 << std::endl;
1623  Xyce::dout() << "egfet = " << egfet << std::endl;
1624  Xyce::dout() << "arg = " << arg << std::endl;
1625  Xyce::dout() << "pbfact = " << pbfact << std::endl;
1626  Xyce::dout() << "PB = " << Pb << std::endl;
1627  Xyce::dout() << "pbo = " << pbo << std::endl;
1628  Xyce::dout() << "f2 = " << f2 << std::endl;
1629  Xyce::dout() << "f3 = " << f3 << std::endl;
1630  Xyce::dout() << "corDepCap= " << corDepCap << std::endl;
1631  Xyce::dout() << "tBeta = " << tBeta << std::endl;
1632  Xyce::dout() << "tvt0 = " << tvt0 << std::endl;
1633  Xyce::dout() << "tPB = " << tPB << std::endl;
1634  Xyce::dout() << "tMESb = " << tMESb << std::endl;
1635  Xyce::dout() << "tLambda = " << tLambda << std::endl;
1636  //Xyce::dout() << "tTheta = " << tTheta << std::endl;
1637  Xyce::dout() << "tRD = " << tRD << std::endl;
1638  Xyce::dout() << "tRS = " << tRS << std::endl;
1639  Xyce::dout() << " " << std::endl;
1640  }
1641 
1642  return bsuccess;
1643 }
1644 
1645 //-----------------------------------------------------------------------------
1646 // Function : Instance::processParams
1647 // Purpose :
1648 // Special Notes :
1649 // Scope : public
1650 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1651 // Creation Date : 3/16/00
1652 //-----------------------------------------------------------------------------
1654 {
1656 
1657  return true;
1658 }
1659 
1660 // MESFET Master functions:
1661 
1662 //-----------------------------------------------------------------------------
1663 // Function : Master::updateState
1664 // Purpose :
1665 // Special Notes :
1666 // Scope : public
1667 // Creator : Eric Keiter, SNL
1668 // Creation Date : 11/26/08
1669 //-----------------------------------------------------------------------------
1670 bool Master::updateState (double * solVec, double * staVec, double * stoVec)
1671 {
1672  bool bsuccess = true;
1673 
1674  for (InstanceVector::const_iterator it = getInstanceBegin(); it != getInstanceEnd(); ++it)
1675  {
1676  Instance & ji = *(*it);
1677 
1678  bool btmp = ji.updateIntermediateVars ();
1679  bsuccess = bsuccess && btmp;
1680 
1681  double * stoVec = ji.extData.nextStoVectorRawPtr;
1682  stoVec[ji.li_store_vgs] = ji.vgs;
1683  stoVec[ji.li_store_vgd] = ji.vgd;
1684  staVec[ji.li_state_qgs] = ji.qgs;
1685  staVec[ji.li_state_qgd] = ji.qgd;
1686  }
1687 
1688  return bsuccess;
1689 }
1690 
1691 //-----------------------------------------------------------------------------
1692 // Function : Master::loadDAEVectors
1693 // Purpose :
1694 // Special Notes :
1695 // Scope : public
1696 // Creator : Eric Keiter, SNL
1697 // Creation Date : 11/26/08
1698 //-----------------------------------------------------------------------------
1699 bool Master::loadDAEVectors (double * solVec, double * fVec, double *qVec, double * bVec, double * storeLeadF, double * storeLeadQ, double * leadF, double * leadQ, double * junctionV)
1700 {
1701  for (InstanceVector::const_iterator it = getInstanceBegin(); it != getInstanceEnd(); ++it)
1702  {
1703  Instance & ji = *(*it);
1704 
1705  // F-vector:
1706  double * dFdxdVp = ji.extData.dFdxdVpVectorRawPtr;
1707 
1708  // set up the final load variables:
1709  int Dtype = ji.getModel().dtype;
1710  double f_ceqgd = Dtype*(ji.cgd);
1711  double f_ceqgs = Dtype*((ji.cg-ji.cgd));
1712  double f_cdreq = Dtype*((ji.cd+ji.cgd));
1713 
1714  double f_ceqgd_Jdxp = -Dtype*(ji.ggd*(ji.vgd-ji.vgd_orig));
1715  double f_ceqgs_Jdxp = -Dtype*(ji.ggs*(ji.vgs-ji.vgs_orig));
1716  double f_cdreq_Jdxp = -Dtype*(ji.gds*(ji.vds-ji.vds_orig)+ji.gm*(ji.vgs-ji.vgs_orig));
1717 
1718  // optional load resistors:
1719  if (ji.drainCond != 0.0)
1720  {
1721  fVec[ji.li_Drain ] += ji.Idrain;
1722  }
1723  if (ji.sourceCond != 0.0)
1724  {
1725  fVec[ji.li_Source] += ji.Isource;
1726  }
1727  fVec[ji.li_Gate ] += (f_ceqgs+f_ceqgd);
1728  fVec[ji.li_DrainPrime ] -= (ji.Idrain +(-f_cdreq+f_ceqgd));
1729  fVec[ji.li_SourcePrime] -= (ji.Isource+(f_cdreq+f_ceqgs));
1730 
1731  if (!ji.origFlag)
1732  {
1733  dFdxdVp[ji.li_Gate ] -= ( f_ceqgs_Jdxp+f_ceqgd_Jdxp);
1734  dFdxdVp[ji.li_DrainPrime ] += (-f_cdreq_Jdxp+f_ceqgd_Jdxp);
1735  dFdxdVp[ji.li_SourcePrime] += ( f_cdreq_Jdxp+f_ceqgs_Jdxp);
1736  }
1737 
1738  // Q-vector:
1739  double * dQdxdVp = ji.extData.dQdxdVpVectorRawPtr;
1740 
1741  // set up the final load variables:
1742  double q_ceqgd = Dtype*(ji.qgd);
1743  double q_ceqgs = Dtype*(((ji.qgs+ji.qgd)-ji.qgd));
1744  double q_cdreq = Dtype*(((-ji.qgd)+ji.qgd));
1745 
1746  double q_ceqgd_Jdxp = -Dtype*(ji.capgd*(ji.vgd-ji.vgd_orig));
1747  double q_ceqgs_Jdxp = -Dtype*(ji.capgs*(ji.vgs-ji.vgs_orig));
1748  double q_cdreq_Jdxp = 0.0;
1749 
1750  qVec[ji.li_Gate ] += ( q_ceqgs+q_ceqgd);
1751  qVec[ji.li_DrainPrime ] -= (-q_cdreq+q_ceqgd);
1752  qVec[ji.li_SourcePrime] -= ( q_cdreq+q_ceqgs);
1753 
1754  if (!ji.origFlag)
1755  {
1756  dQdxdVp[ji.li_Gate ] -= ( q_ceqgs_Jdxp+q_ceqgd_Jdxp);
1757  dQdxdVp[ji.li_DrainPrime ] += (-q_cdreq_Jdxp+q_ceqgd_Jdxp);
1758  dQdxdVp[ji.li_SourcePrime] += ( q_cdreq_Jdxp+q_ceqgs_Jdxp);
1759  }
1760 
1761  if( ji.loadLeadCurrent )
1762  {
1763  if (ji.drainCond != 0.0)
1764  {
1765  storeLeadF[ji.li_store_dev_id] = ji.Idrain;
1766  }
1767  else
1768  {
1769  storeLeadF[ji.li_store_dev_id] = -(ji.Idrain +(-f_cdreq+f_ceqgd));
1770  storeLeadQ[ji.li_store_dev_id] = -(-q_cdreq+q_ceqgd);
1771  }
1772  if (ji.sourceCond != 0.0)
1773  {
1774  storeLeadF[ji.li_store_dev_is] = ji.Isource;
1775  }
1776  else
1777  {
1778  storeLeadF[ji.li_store_dev_is] = -(ji.Isource+(f_cdreq+f_ceqgs));
1779  storeLeadQ[ji.li_store_dev_is] = -( q_cdreq+q_ceqgs);
1780  }
1781  storeLeadF[ji.li_store_dev_ig] = (f_ceqgs+f_ceqgd);
1782  storeLeadQ[ji.li_store_dev_ig] = (q_ceqgs+q_ceqgd);
1783  }
1784 
1785  }
1786 
1787  return true;
1788 }
1789 
1790 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
1791 //-----------------------------------------------------------------------------
1792 // Function : Master::loadDAEMatrices
1793 // Purpose :
1794 // Special Notes :
1795 // Scope : public
1796 // Creator : Eric Keiter, SNL
1797 // Creation Date : 12/12/08
1798 //-----------------------------------------------------------------------------
1799 bool Master::loadDAEMatrices (Linear::Matrix & dFdx, Linear::Matrix & dQdx)
1800 {
1801  for (InstanceVector::const_iterator it = getInstanceBegin(); it != getInstanceEnd(); ++it)
1802  {
1803  Instance & ji = *(*it);
1804 
1805  // F-matrix:
1806 
1808 
1810 
1811 
1812  *ji.f_GateEquGateNodePtr += ji.ggd+ji.ggs;
1813 
1814  *ji.f_GateEquDrainPrimeNodePtr -= ji.ggd;
1815 
1816  *ji.f_GateEquSourcePrimeNodePtr -= ji.ggs;
1817 
1818 
1820 
1822 
1823 
1825 
1826  *ji.f_DrainPrimeEquGateNodePtr += ji.gm-ji.ggd;
1827 
1829 
1831 
1832 
1833  *ji.f_SourcePrimeEquGateNodePtr -= ji.gm+ji.ggs;
1834 
1836 
1838 
1840 
1841  // Q-matrix:
1842 
1843  *ji.q_GateEquGateNodePtr += ji.capgd+ji.capgs;
1844 
1846 
1848 
1850 
1852 
1854 
1856  }
1857 
1858  return true;
1859 }
1860 
1861 #else
1862 //-----------------------------------------------------------------------------
1863 // Function : Master::loadDAEMatrices
1864 // Purpose :
1865 // Special Notes :
1866 // Scope : public
1867 // Creator : Eric Keiter, SNL
1868 // Creation Date : 12/12/08
1869 //-----------------------------------------------------------------------------
1870 bool Master::loadDAEMatrices (Linear::Matrix & dFdx, Linear::Matrix & dQdx)
1871 {
1872  int sizeInstances = instanceContainer_.size();
1873  for (int i=0; i<sizeInstances; ++i)
1874  {
1875  Instance & ji = *(instanceContainer_.at(i));
1876 
1877  // dFdx matrix:
1878 
1879  dFdx[ji.li_Drain][ji.ADrainEquDrainNodeOffset] += ji.drainCond;
1880 
1882 
1883 
1884  dFdx[ji.li_Gate][ji.AGateEquGateNodeOffset] += ji.ggd+ji.ggs;
1885 
1886  dFdx[ji.li_Gate][ji.AGateEquDrainPrimeNodeOffset] -= ji.ggd;
1887 
1888  dFdx[ji.li_Gate][ji.AGateEquSourcePrimeNodeOffset] -= ji.ggs;
1889 
1890 
1891  dFdx[ji.li_Source][ji.ASourceEquSourceNodeOffset] += ji.sourceCond;
1892 
1894 
1895 
1897 
1898  dFdx[ji.li_DrainPrime][ji.ADrainPrimeEquGateNodeOffset] += ji.gm-ji.ggd;
1899 
1901  ji.drainCond+ji.gds+ji.ggd;
1902 
1904 
1905 
1906  dFdx[ji.li_SourcePrime][ji.ASourcePrimeEquGateNodeOffset] -= ji.gm+ji.ggs;
1907 
1909 
1911 
1913  += ji.sourceCond+ji.gds+ji.gm+ji.ggs;
1914 
1915  // dQdx matrix:
1916 
1917  dQdx[ji.li_Gate ][ji.AGateEquGateNodeOffset ] += ji.capgd+ji.capgs;
1918 
1919  dQdx[ji.li_Gate ][ji.AGateEquDrainPrimeNodeOffset ] -= ji.capgd;
1920 
1921  dQdx[ji.li_Gate ][ji.AGateEquSourcePrimeNodeOffset ] -= ji.capgs;
1922 
1923  dQdx[ji.li_DrainPrime ][ji.ADrainPrimeEquGateNodeOffset ] -= ji.capgd;
1924 
1926 
1928 
1930  }
1931 
1932  return true;
1933 }
1934 #endif
1935 
1936 Device *Traits::factory(const Configuration &configuration, const FactoryBlock &factory_block)
1937 {
1938 
1939  return new Master(configuration, factory_block, factory_block.solverState_, factory_block.deviceOptions_);
1940 }
1941 
1943 {
1945  .registerDevice("z", 1)
1946  .registerModelType("nmf", 1)
1947  .registerModelType("pmf", 1);
1948 }
1949 
1950 } // namespace MESFET
1951 } // namespace Device
1952 } // namespace Xyce
const InstanceName & getName() const
#define CONSTPMOS
Definition: N_DEV_Const.h:77
static std::vector< std::vector< int > > jacMap2_DC_SC
Definition: N_DEV_MESFET.h:150
static void initThermalModel(ParametricData< T > &parametric_data)
Add the parameter "TEMPMODEL" to the parametric_data.
static std::vector< std::vector< int > > jacStamp_SC
Definition: N_DEV_MESFET.h:142
static std::vector< std::vector< int > > jacStamp_DC
Definition: N_DEV_MESFET.h:141
std::vector< Instance * > instanceContainer
Definition: N_DEV_MESFET.h:423
const DeviceOptions & deviceOptions_
Descriptor & addPar(const char *parName, T default_value, T U::*varPtr)
Adds the parameter description to the parameter map.
Definition: N_DEV_Pars.h:1429
#define CONSTQ
Definition: N_DEV_Const.h:51
#define CONSTREFTEMP
Definition: N_DEV_Const.h:56
#define RD
double pnjlim(double vnew, double vold, double vt, double vcrit, int *icheck)
bool given(const std::string &parameter_name) const
Pure virtual class to augment a linear system.
Parameter may be specified as time dependent expression from netlist.
Definition: N_DEV_Pars.h:67
void addInternalNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
virtual bool loadDAEMatrices(Linear::Matrix &dFdx, Linear::Matrix &dQdx)
Populates the device's Jacobian object with these pointers.
void setNumStoreVars(int num_store_vars)
InstanceVector::const_iterator getInstanceEnd() const
Returns an iterator to the ending of the vector of all instances created for this device...
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
Definition: N_DEV_MESFET.C:671
#define AssertLIDs(cmp)
#define CONSTNMOS
Definition: N_DEV_Const.h:76
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
Parameter is subject to being set to minimum junction capacitance.
Definition: N_DEV_Pars.h:71
virtual void registerJacLIDs(const JacobianStamp &jacLIDVec)
Parameter is subject to being set to minimum lead resistance.
Definition: N_DEV_Pars.h:70
bool updateTemperature(const double &temp_tmp)
double fetlim(double vnew, double vold, double vto)
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
Definition: N_DEV_MESFET.C:789
static std::vector< int > jacMap_DC
Definition: N_DEV_MESFET.h:146
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
Definition: N_DEV_MESFET.C:695
InstanceVector::const_iterator getInstanceBegin() const
Returns an iterator to the beginning of the vector of all instances created for this device...
std::vector< Param > params
Parameters from the line.
static std::vector< std::vector< int > > jacStamp
Definition: N_DEV_MESFET.h:143
virtual bool updateState(double *solVec, double *staVec, double *stoVec)
Updates the devices state information.
static std::vector< std::vector< int > > jacMap2
Definition: N_DEV_MESFET.h:153
void setParams(const std::vector< Param > &params)
const std::string & getName() const
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.
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
const DeviceOptions & getDeviceOptions() const
#define CONSTroot2
Definition: N_DEV_Const.h:50
static std::vector< std::vector< int > > jacMap2_SC
Definition: N_DEV_MESFET.h:152
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
Definition: N_DEV_MESFET.C:70
static Config< T > & addConfiguration()
Adds the device to the Xyce device configuration.
Linear::Matrix * dFdxMatrixPtr
The Device class is an interface for device implementations.
Definition: N_DEV_Device.h:101
void addStoreNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
static std::vector< int > jacMap_DC_SC
Definition: N_DEV_MESFET.h:145
const SolverState & solverState_
Class Configuration contains device configuration data.
void registerStoreLIDs(const std::vector< int > &stoLIDVecRef)
Definition: N_DEV_MESFET.C:741
virtual std::ostream & printOutInstances(std::ostream &os) const
Definition: N_DEV_MESFET.C:276
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)
const std::vector< std::vector< int > > & jacobianStamp() const
Definition: N_DEV_MESFET.C:768
const SolverState & getSolverState() const
static std::vector< std::vector< int > > jacMap2_DC
Definition: N_DEV_MESFET.h:151
static void loadModelParameters(ParametricData< Model > &model_parameters)
Definition: N_DEV_MESFET.C:82
static std::vector< int > jacMap
Definition: N_DEV_MESFET.h:148
#define Xyce_NONPOINTER_MATRIX_LOAD
Definition: N_DEV_Bsrc.C:92
bool processInstanceParams()
processInstanceParams
Definition: N_DEV_MESFET.C:343
Instance(const Configuration &configuration, const InstanceBlock &instance_block, Model &model, const FactoryBlock &factory_block)
Definition: N_DEV_MESFET.C:367
const std::string & getType() const
#define RS
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
Definition: N_DEV_MESFET.C:314
#define CONSTKoverQ
Definition: N_DEV_Const.h:58
static std::vector< int > jacMap_SC
Definition: N_DEV_MESFET.h:147
ModelBlock represents a .MODEL line from the netlist.
Manages parameter binding for class C.
Definition: N_DEV_Pars.h:214
InstanceBlock represent a device instance line from the netlist.
std::vector< Param > params
Linear::Matrix * dQdxMatrixPtr
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
Definition: N_DEV_MESFET.C:609
static std::vector< std::vector< int > > jacStamp_DC_SC
Definition: N_DEV_MESFET.h:140
Linear::Vector * flagSolVectorPtr
bool processParams()
processParams
Definition: N_DEV_MESFET.C:329
#define LAMBDA
void setModParams(const std::vector< Param > &params)
#define CONSTboltz
Definition: N_DEV_Const.h:53
#define ALPHA