コード例 #1
0
void strafo::initSP (void) {

  nr_double_t t1 = getPropertyDouble ("T1");
  nr_double_t t2 = getPropertyDouble ("T2");

  nr_double_t  d = t1 * t1 + t2 * t2 + 1.0;
  nr_double_t z1 = t1 * t1 / d;
  nr_double_t z2 = t2 * t2 / d;
  nr_double_t z3 = 1.0 / d;
  nr_double_t z4 = t1 / d;
  nr_double_t z5 = t2 / d;
  nr_double_t z6 = t1 * t2 / d;

  allocMatrixS ();

  setS (NODE_1, NODE_1,  z1);    setS (NODE_1, NODE_2, z4);
  setS (NODE_1, NODE_3, -z4);    setS (NODE_1, NODE_4, -z6);
  setS (NODE_1, NODE_5, z6);     setS (NODE_1, NODE_6, 1 - z1);
  setS (NODE_2, NODE_1,  z4);    setS (NODE_2, NODE_2, z3);
  setS (NODE_2, NODE_3, 1 - z3); setS (NODE_2, NODE_4, -z5);
  setS (NODE_2, NODE_5, z5);     setS (NODE_2, NODE_6, -z4);
  setS (NODE_3, NODE_1, -z4);    setS (NODE_3, NODE_2, 1 - z3);
  setS (NODE_3, NODE_3, z3);     setS (NODE_3, NODE_4,  z5);
  setS (NODE_3, NODE_5, -z5);    setS (NODE_3, NODE_6, z4);
  setS (NODE_4, NODE_1, -z6);    setS (NODE_4, NODE_2, -z5);
  setS (NODE_4, NODE_3, z5);     setS (NODE_4, NODE_4,  z2);
  setS (NODE_4, NODE_5, 1 - z2); setS (NODE_4, NODE_6, z6);
  setS (NODE_5, NODE_1,  z6);    setS (NODE_5, NODE_2, z5);
  setS (NODE_5, NODE_3, -z5);    setS (NODE_5, NODE_4, 1 - z2);
  setS (NODE_5, NODE_5, z2);     setS (NODE_5, NODE_6, -z6);
  setS (NODE_6, NODE_1, 1 - z1); setS (NODE_6, NODE_2, -z4);
  setS (NODE_6, NODE_3, z4);     setS (NODE_6, NODE_4, z6);
  setS (NODE_6, NODE_5, -z6);    setS (NODE_6, NODE_6, z1);
}
コード例 #2
0
void iinoise::initSP (void) {
  allocMatrixS ();
  setS (NODE_I1P, NODE_I1P, 1.0);
  setS (NODE_I1N, NODE_I1N, 1.0);
  setS (NODE_I2P, NODE_I2P, 1.0);
  setS (NODE_I2N, NODE_I2N, 1.0);
}
コード例 #3
0
ファイル: digital.cpp プロジェクト: Freecore/qucs
// Setup constant S-parameter entries.
void digital::initSP (void) {
  allocMatrixS ();
  setS (NODE_OUT, NODE_OUT, -1);
  for (i = 0; i < getSize () - 1; i++) {
    setS (NODE_IN1 + i, NODE_IN1 + i, +1);
  }
}
コード例 #4
0
ファイル: iac.cpp プロジェクト: Tushar1313/qucs_cvs
void iac::initSP (void) {
  allocMatrixS ();
  setS (NODE_1, NODE_1, 1.0);
  setS (NODE_1, NODE_2, 0.0);
  setS (NODE_2, NODE_1, 0.0);
  setS (NODE_2, NODE_2, 1.0);
}
コード例 #5
0
ファイル: isolator.cpp プロジェクト: Freecore/qucs
void isolator::initSP (void) {
  nr_double_t z1 = getPropertyDouble ("Z1");
  nr_double_t z2 = getPropertyDouble ("Z2");
  nr_double_t s1 = (z1 - z0) / (z1 + z0);
  nr_double_t s2 = (z2 - z0) / (z2 + z0);
  allocMatrixS ();
  setS (NODE_1, NODE_1, s1);
  setS (NODE_2, NODE_2, s2);
  setS (NODE_1, NODE_2, 0);
  setS (NODE_2, NODE_1, sqrt (1 - s1 * s1) * sqrt (1 - s2 * s2));
}
コード例 #6
0
ファイル: opamp.cpp プロジェクト: Freecore/qucs
void opamp::initSP (void) {
  allocMatrixS ();
  setS (NODE_INP, NODE_INP, 1);
  setS (NODE_INP, NODE_OUT, 0);
  setS (NODE_INP, NODE_INM, 0);
  setS (NODE_INM, NODE_INP, 0);
  setS (NODE_INM, NODE_OUT, 0);
  setS (NODE_INM, NODE_INM, 1);
  setS (NODE_OUT, NODE_INP, +4 * gv);
  setS (NODE_OUT, NODE_OUT, -1);
  setS (NODE_OUT, NODE_INM, -4 * gv);
}
コード例 #7
0
ファイル: amplifier.cpp プロジェクト: Tushar1313/qucs_cvs
/*! Initialize S-parameter simulation. 
    An ideal amplifier is characterized by the following 
    S-matrix 
    \f[  
      S=\begin{pmatrix}
         \dfrac{Z_1-Z_0}{Z_1+Z_0} & 0 \\
	  \dfrac{4\cdot Z_0\cdot\sqrt{Z_1\cdot Z_2}\cdot G}{(Z_1+Z_0)\cdot(Z_2+Z_0)}
          & \dfrac{Z_2-Z_0}{Z_2+Z_0}
        \end{pmatrix}
    \f]
    With \f$Z_1\f$ and \f$Z_2\f$ the impedance of the port 1 and 2 and 
    \f$G\f$ the gain.
*/
void amplifier::initSP (void) {
  nr_double_t g = getPropertyDouble ("G");
  nr_double_t z1 = getPropertyDouble ("Z1");
  nr_double_t z2 = getPropertyDouble ("Z2");

  allocMatrixS ();

  setS (NODE_1, NODE_1, (z1 - z0) / (z1 + z0));
  setS (NODE_1, NODE_2, 0);
  setS (NODE_2, NODE_2, (z2 - z0) / (z2 + z0));
  setS (NODE_2, NODE_1, 4 * z0 * sqrt (z1 * z2) * g / (z1 + z0) / (z2 + z0));
}
コード例 #8
0
void biastee::initSP (void) {
  allocMatrixS ();
  setS (NODE_1, NODE_1, 0.0);
  setS (NODE_1, NODE_2, 1.0);
  setS (NODE_1, NODE_3, 0.0);
  setS (NODE_2, NODE_1, 1.0);
  setS (NODE_2, NODE_2, 0.0);
  setS (NODE_2, NODE_3, 0.0);
  setS (NODE_3, NODE_1, 0.0);
  setS (NODE_3, NODE_2, 0.0);
  setS (NODE_3, NODE_3, 1.0);
}
コード例 #9
0
ファイル: phaseshifter.cpp プロジェクト: Freecore/qucs
void phaseshifter::initSP (void) {
  nr_double_t p = rad (getPropertyDouble ("phi"));
  nr_double_t z = getPropertyDouble ("Zref");
  nr_double_t r = (z0 - z) / (z0 + z);
  nr_complex_t d = 1.0 - polar (r * r, 2 * p);
  nr_complex_t s11 = r * (polar (1.0, 2 * p) - 1.0) / d;
  nr_complex_t s21 = (1.0 - r * r) * polar (1.0, p) / d;
  allocMatrixS ();
  setS (NODE_1, NODE_1, s11);
  setS (NODE_2, NODE_2, s11);
  setS (NODE_1, NODE_2, s21);
  setS (NODE_2, NODE_1, s21);
}
コード例 #10
0
ファイル: itrafo.cpp プロジェクト: Tushar1313/qucs_cvs
void itrafo::initSP (void) {
  allocMatrixS ();
  nr_double_t z = getPropertyDouble ("Z");
  nr_double_t n = 2 * z0 + z;
  setS (NODE_1, NODE_1,  (2.0 * z0 - z) / n);
  setS (NODE_1, NODE_2,  (2.0 * sqrt (z0 * z)) / n);
  setS (NODE_1, NODE_3, -(2.0 * sqrt (z0 * z)) / n);
  setS (NODE_2, NODE_1,  (2.0 * sqrt (z0 * z)) / n);
  setS (NODE_2, NODE_2,  (z) / n);
  setS (NODE_2, NODE_3,  (2.0 * z0) / n);
  setS (NODE_3, NODE_1, -(2.0 * sqrt (z0 * z)) / n);
  setS (NODE_3, NODE_2,  (2.0 * z0) / n);
  setS (NODE_3, NODE_3,  (z) / n);
}
コード例 #11
0
ファイル: hybrid.cpp プロジェクト: Mehanik/qucs
void hybrid::initSP (void) {
  nr_complex_t p = polar (1.0, rad (getPropertyDouble ("phi")));
  nr_double_t  k = M_SQRT2;

  allocMatrixS ();
  setS (NODE_1, NODE_1, 0.0); setS (NODE_2, NODE_2, 0.0);
  setS (NODE_3, NODE_3, 0.0); setS (NODE_4, NODE_4, 0.0);

  setS (NODE_1, NODE_2, 0.0); setS (NODE_2, NODE_1, 0.0);
  setS (NODE_3, NODE_4, 0.0); setS (NODE_4, NODE_3, 0.0);

  setS (NODE_1, NODE_3, k); setS (NODE_3, NODE_1, k);
  setS (NODE_1, NODE_4, k); setS (NODE_4, NODE_1, k);
  setS (NODE_2, NODE_3, k); setS (NODE_3, NODE_2, k);

  setS (NODE_2, NODE_4, k * p);
  setS (NODE_4, NODE_2, k * p);
}
コード例 #12
0
ファイル: circuit.cpp プロジェクト: FoxMarts/qucs
/* With this function the number of ports of the circuit object can be
   changed.  Previously stored node and matrix information gets
   completely lost except the current size equals the given size. */
void circuit::setSize (int s) {
  // nothing to do here
  if (size == s) return;
  assert (s >= 0);

  if (size > 0) {
    // destroy any matrix and node information
    delete[] MatrixS;
    delete[] MatrixN;
    MatrixS = MatrixN = NULL;
    freeMatrixMNA ();
    delete[] nodes; nodes = NULL;
  }

  if ((size = s) > 0) {
    // re-create matrix and node information space
    nodes = new node[size];
    allocMatrixS ();
    allocMatrixN (nsources);
    allocMatrixMNA ();
  }
}
コード例 #13
0
ファイル: coaxline.cpp プロジェクト: Freecore/qucs
void coaxline::initSP (void) {
  // allocate S-parameter matrix
  allocMatrixS ();
  initCheck ();
}
コード例 #14
0
void twistedpair::initSP (void) {
  allocMatrixS ();
  calcLength ();
}
コード例 #15
0
ファイル: bondwire.cpp プロジェクト: Tushar1313/qucs_cvs
/*! Initialize S parameter simulation. */
void bondwire::initSP (void) {
  allocMatrixS ();
  getProperties ();
}
コード例 #16
0
ファイル: mscross.cpp プロジェクト: Freecore/qucs
void mscross::initSP (void) {
  initModel ();
  allocMatrixS ();
}
コード例 #17
0
ファイル: resistor.cpp プロジェクト: Freecore/qucs
void resistor::initSP (void) {
  initModel ();
  allocMatrixS ();
}
コード例 #18
0
void cpwstep::initSP (void) {
  allocMatrixS ();
  checkProperties ();
}
コード例 #19
0
void vam::initSP (void) {
  allocMatrixS ();
  setS (NODE_1, NODE_2, 1.0);
  setS (NODE_2, NODE_1, 1.0);
  setS (NODE_3, NODE_3, 1.0);
}
コード例 #20
0
ファイル: digisource.cpp プロジェクト: Tushar1313/qucs_cvs
void digisource::initSP (void) {
  allocMatrixS ();
  setS (NODE_1, NODE_1, -1.0);
}
コード例 #21
0
ファイル: msvia.cpp プロジェクト: Freecore/qucs
void msvia::initSP (void) {
  allocMatrixS ();
  R = calcResistance ();
}
コード例 #22
0
ファイル: circuit.cpp プロジェクト: FoxMarts/qucs
/* The copy constructor creates a new instance based on the given
   circuit object. */
circuit::circuit (const circuit & c) : object (c), integrator (c) {
  next = c.next;
  prev = c.prev;
  size = c.size;
  pol = c.pol;
  pacport = c.pacport;
  flag = c.flag;
  type = c.type;
  subst = c.subst;
  vsource = c.vsource;
  vsources = c.vsources;
  nsources = c.nsources;
  inserted = c.inserted;
  subnet = c.subnet;
  deltas = c.deltas;
  nHistories = c.nHistories;
  histories = NULL;
  subcircuit = c.subcircuit;

  if (size > 0) {
    // copy each node and set its circuit to the current circuit object
    nodes = new node[size];
    for (int i = 0; i < size; i++) {
      nodes[i] = node (c.nodes[i]);;
      nodes[i].setCircuit (this);
    }
    // copy each s-parameter
    if (c.MatrixS) {
      allocMatrixS ();
      memcpy (MatrixS, c.MatrixS, size * size * sizeof (nr_complex_t));
    }
    // copy each noise-correlation parameter
    if (c.MatrixN) {
      allocMatrixN (nsources);
      int i = size + nsources;
      memcpy (MatrixN, c.MatrixN, i * i * sizeof (nr_complex_t));
    }
    // copy each HB-matrix entry
    if (c.MatrixQV) {
      allocMatrixHB ();
      memcpy (MatrixQV, c.MatrixQV, size * size * sizeof (nr_complex_t));
      memcpy (VectorGV, c.VectorGV, size * sizeof (nr_complex_t));
      memcpy (VectorCV, c.VectorCV, size * sizeof (nr_complex_t));
      memcpy (VectorQ, c.VectorQ, size * sizeof (nr_complex_t));
    }
    // copy each G-MNA matrix entry
    if (c.MatrixY) {
      allocMatrixMNA ();
      memcpy (MatrixY, c.MatrixY, size * size * sizeof (nr_complex_t));
      memcpy (VectorI, c.VectorI, size * sizeof (nr_complex_t));
      memcpy (VectorV, c.VectorV, size * sizeof (nr_complex_t));
      if (vsources > 0) {
	memcpy (MatrixB, c.MatrixB, vsources * size * sizeof (nr_complex_t));
	memcpy (MatrixC, c.MatrixC, vsources * size * sizeof (nr_complex_t));
	memcpy (MatrixD, c.MatrixD, vsources * vsources * sizeof (nr_complex_t));
	memcpy (VectorE, c.VectorE, vsources * sizeof (nr_complex_t));
	memcpy (VectorJ, c.VectorJ, vsources * sizeof (nr_complex_t));
      }
    }
  }
  else {
    nodes = NULL;
    MatrixS = MatrixN = MatrixY = NULL;
    MatrixB = MatrixC = MatrixD = NULL;
    VectorQ = VectorE = VectorI = VectorV = VectorJ = NULL;
    MatrixQV = NULL;
    VectorCV = VectorGV = NULL;
  }

  // copy operating points
  oper = valuelist<operatingpoint> (c.oper);
}