I'm trying to simulate a nonideal directional coupler in QUCS. Unfortunately, the only model available is the ideal one without taking into account the isolation or insertion loss values.
Initially, I tried to model these effects with attenuators, but comparing the results from different simulators (which have the nonideal models) I can see some crucial differences in the final circuit attenuation plot. Probably my equivalent circuit is wrong.
Schematic of the circuit with my coupler model:
I'm starting to think that the right way to model the nonideal coupler is only by modifying the source code of the component. I already considered this, and the parameters are easily accessible. This is for example the admittance matrix for AC analysis:
void coupler::initAC (void) {
setVoltageSources (0);
allocMatrixMNA ();
nr_double_t k = getPropertyDouble ("k"); //coupling factor i.e. 0.707
nr_double_t z = getPropertyDouble ("Z"); // reference impedance i.e. 50 Ohm
nr_double_t p = deg2rad (getPropertyDouble ("phi")); //coupler phase shift i.e. 90 deg.
nr_double_t b = 2 * std::sqrt (1 - k * k);
nr_complex_t a = k * k * (qucs::polar (1.0, 2 * p) + 1.0);
nr_complex_t c = qucs::polar (2 * k, p);
nr_complex_t d = z * (a * a - c * c);
nr_complex_t y;
y = a * (2.0 - a) / d;
setY (NODE_1, NODE_1, y); setY (NODE_2, NODE_2, y);
setY (NODE_3, NODE_3, y); setY (NODE_4, NODE_4, y);
y = -a * b / d;
setY (NODE_1, NODE_2, y); setY (NODE_2, NODE_1, y);
setY (NODE_3, NODE_4, y); setY (NODE_4, NODE_3, y);
y = c * (a - 2.0) / d;
setY (NODE_1, NODE_3, y); setY (NODE_3, NODE_1, y);
setY (NODE_2, NODE_4, y); setY (NODE_4, NODE_2, y);
y = b * c / d;
setY (NODE_1, NODE_4, y); setY (NODE_4, NODE_1, y);
setY (NODE_2, NODE_3, y); setY (NODE_3, NODE_2, y);
}
The problem is that I don't know which values to modify or what to add. I have not derived this admittance matrix and after searching the literature (Pozar) I couldn't find any example similar to this.
Do I really need to modify this admittance matrix (in AC and then S-params model) or there is a different equivalent circuit to model the nonideal isolation in coupler? If I really need to modify the matrix could You suggest some steps?
Edit:
The directional coupler in my circuit is discrete "Ultra Low Profile 0805 3 dB, 90° Hybrid Coupler" (https://cdn.ttm.com/repository/products/wireless-xinger/3db-hybrid-couplers/C2327J5003AHF/C2327J5003AHF_Datasheet(Rev_I).pdf) I have revisited the Annaren site which was changed to TTM Technologies and found the S-parameter files to be easily accessible now (must have missed it before or something changed on the website) The S-parameter model is all I need. Before, I checked for the s4p file and didn't find it so I tried to model it with this nonideal discrete approach or by trying to modify the admittance matrix.