Fix matching calculation order for remote port
This commit is contained in:
parent
77f73d3e05
commit
32a5fac5ef
@ -38,13 +38,16 @@ void MatchingNetwork::transformDatapoint(VirtualDevice::VNAMeasurement &p)
|
|||||||
// this point is not calculated yet
|
// this point is not calculated yet
|
||||||
MatchingPoint m;
|
MatchingPoint m;
|
||||||
// start with identiy matrix
|
// start with identiy matrix
|
||||||
m.p = ABCDparam(1.0,0.0,0.0,1.0);
|
m.forward = ABCDparam(1.0,0.0,0.0,1.0);
|
||||||
for(auto c : network) {
|
m.reverse = ABCDparam(1.0,0.0,0.0,1.0);
|
||||||
m.p = m.p * c->parameters(p.frequency);
|
for(unsigned int i=0;i<network.size();i++) {
|
||||||
|
m.forward = m.forward * network[i]->parameters(p.frequency);
|
||||||
|
m.reverse = m.reverse * network[network.size()-i-1]->parameters(p.frequency);
|
||||||
}
|
}
|
||||||
if(!addNetwork) {
|
if(!addNetwork) {
|
||||||
// need to remove the effect of the network, invert matrix
|
// need to remove the effect of the network, invert matrix
|
||||||
m.p = m.p.inverse();
|
m.forward = m.forward.inverse();
|
||||||
|
m.reverse = m.reverse.inverse();
|
||||||
}
|
}
|
||||||
matching[p.frequency] = m;
|
matching[p.frequency] = m;
|
||||||
}
|
}
|
||||||
@ -61,13 +64,13 @@ void MatchingNetwork::transformDatapoint(VirtualDevice::VNAMeasurement &p)
|
|||||||
if(i == port) {
|
if(i == port) {
|
||||||
// the port of the matching network itself
|
// the port of the matching network itself
|
||||||
auto S = Sparam(uncorrected.measurements[name], 1.0, 1.0, 0.0);
|
auto S = Sparam(uncorrected.measurements[name], 1.0, 1.0, 0.0);
|
||||||
auto corrected = Sparam(m.p * ABCDparam(S, p.Z0), p.Z0);
|
auto corrected = Sparam(m.forward * ABCDparam(S, p.Z0), p.Z0);
|
||||||
p.measurements[name] = corrected.m11;
|
p.measurements[name] = corrected.m11;
|
||||||
} else {
|
} else {
|
||||||
// another reflection measurement
|
// another reflection measurement
|
||||||
try {
|
try {
|
||||||
auto S = uncorrected.toSparam(i, port);
|
auto S = uncorrected.toSparam(i, port);
|
||||||
auto corrected = Sparam(ABCDparam(S, p.Z0) * m.p, p.Z0);
|
auto corrected = Sparam(ABCDparam(S, p.Z0) * m.reverse, p.Z0);
|
||||||
p.fromSparam(corrected, i, port);
|
p.fromSparam(corrected, i, port);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
// missing measurements, nothing can be done
|
// missing measurements, nothing can be done
|
||||||
|
@ -94,7 +94,8 @@ private:
|
|||||||
|
|
||||||
class MatchingPoint {
|
class MatchingPoint {
|
||||||
public:
|
public:
|
||||||
ABCDparam p;
|
ABCDparam forward;
|
||||||
|
ABCDparam reverse;
|
||||||
};
|
};
|
||||||
std::map<double, MatchingPoint> matching;
|
std::map<double, MatchingPoint> matching;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user