Skip to content

Commit

Permalink
Add TRAN model for MLIN device
Browse files Browse the repository at this point in the history
  • Loading branch information
ra3xdh committed Jul 13, 2024
1 parent 6c558d5 commit df8c59a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
40 changes: 38 additions & 2 deletions src/components/microstrip/msline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ void msline::calcPropagation (nr_double_t frequency) {

// analyse dispersion of Zl and Er (use WEff here?)
analyseDispersion (W, h, er, ZlEff, ErEff, frequency, DModel,
ZlEffFreq, ErEffFreq);
ZlEffFreq, ErEffFreq);

// analyse losses of line
analyseLoss (W, t, er, rho, D, tand, ZlEff, ZlEff, ErEff,
frequency, "Hammerstad", ac, ad);
frequency, "Hammerstad", ac, ad);

// calculate propagation constants and reference impedance
zl = ZlEffFreq;
Expand Down Expand Up @@ -485,6 +485,42 @@ void msline::calcNoiseAC (nr_double_t) {
setMatrixN (4 * celsius2kelvin (T) / T0 * real (getMatrixY ()));
}


void msline::initTR (void) {
nr_double_t l = getPropertyDouble ("L");

calcPropagation(0.0);

deleteHistory ();
if (l > 0.0) {
setVoltageSources (2);
allocMatrixMNA ();
setHistory (true);
initHistory (l * qucs::sqrt(ereff) / C0);
setB (NODE_1, VSRC_1, +1); setB (NODE_2, VSRC_2, +1);
setC (VSRC_1, NODE_1, +1); setC (VSRC_2, NODE_2, +1);
setD (VSRC_1, VSRC_1, -zl); setD (VSRC_2, VSRC_2, -zl);
} else {
setVoltageSources (1);
allocMatrixMNA ();
voltageSource (VSRC_1, NODE_1, NODE_2);
}
}

void msline::calcTR (nr_double_t t) {
nr_double_t l = getPropertyDouble ("L");
nr_double_t T = l * qucs::sqrt(ereff) / C0;
nr_double_t a = alpha;
if (T > 0.0) {
T = t - T;
a = std::exp (-a / 2 * l);
setE (VSRC_1, a * (getV (NODE_2, T) + zl * getJ (VSRC_2, T)));
setE (VSRC_2, a * (getV (NODE_1, T) + zl * getJ (VSRC_1, T)));
}
}



// properties
PROP_REQ [] = {
{ "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
Expand Down
2 changes: 2 additions & 0 deletions src/components/microstrip/msline.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class msline : public qucs::circuit
void calcAC (nr_double_t);
void calcNoiseAC (nr_double_t);
void saveCharacteristics (nr_double_t);
void initTR();
void calcTR(nr_double_t);

static void analyseQuasiStatic (nr_double_t, nr_double_t, nr_double_t,
nr_double_t, const char * const,
Expand Down

0 comments on commit df8c59a

Please sign in to comment.