Table of Contents

Device plugins

Implementation

Probes

double tr_probe_num(const std::string&)const

This function returns a probe value for DC, OP, and transient analysis, selected by a string argument. Any state variable or parameter may be selected.

Usually the code consists of a string of if - elseif statements. If none match, in most cases it should call BASE::tr_probe_num and return its result.

double DEV_CAPACITANCE::tr_probe_num(const std::string& x)const
{
  if (Umatch(x, "q{cap} |ch{arge} ")) {
    return _y[0].f0;
  }else if (Umatch(x, "c{apacitance} ")) {
    return _y[0].f1;
  }else{
    return STORAGE::tr_probe_num(x);
  }
}
XPROBE ac_probe_ext(const std::string&)const

This function returns a probe value for AC analysis, selected by a string argument. Any state variable or parameter may be selected.

It returns an XPROBE object:

enum mod_t {mtNONE, mtMAG, mtPHASE, mtREAL, mtIMAG};
class XPROBE{
private:
  COMPLEX _value;
  mod_t   _modifier; // default
  double  _dbscale;  // 20 for voltage, 10 for power, etc.
// .....
}

Usually, the returned value is made by a constructor with one argument, using defaults for _modifier and _dbscale. The value is a COMPLEX number.