¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Phase of very high quality N short


 

On 8/18/20 1:15 PM, Dr. David Kirkby, Kirkby Microwave Ltd wrote:
On Tue, 18 Aug 2020 at 16:28, Jerry Gaffke via groups.io <jgaffke=
[email protected]> wrote:

David,

Having O-S-L correction factors only available in host software like
nanovna-saver
Not if you want to take the unit mobile and use it without a computer,
which for me at least is the big attraction of a NanoVNA.
Jerry, KE7ER
If I want a laboratory, I own two HP ones, have access to a PNA-X. (I also
have a VNWA which I have never used) The big attraction to me for the
NanoVNA is its portability, and that gets lost if you have to hook it up to
external software.
Everyones uses are different. But IMHO, the thing the NanoVNA lacks most is
any sensible form of calibration, in the firmware. That would require one
to enter calibration kit parameters.
And is probably a non trivial modification - you'd need a UI for entering and editing the parameters, a UI to select them (not so tough), and a way to preserve them across power cycles.




In main.c (working from hugen's repo), here's probably where you need to fool with it..


static void apply_error_term_at(int i)
{
// S11m' = S11m - Ed
// S11a = S11m' / (Er + Es S11m')
float s11mr = measured[0][i][0] - cal_data[ETERM_ED][i][0];
float s11mi = measured[0][i][1] - cal_data[ETERM_ED][i][1];
float err = cal_data[ETERM_ER][i][0] + s11mr * cal_data[ETERM_ES][i][0] - s11mi * cal_data[ETERM_ES][i][1];
float eri = cal_data[ETERM_ER][i][1] + s11mr * cal_data[ETERM_ES][i][1] + s11mi * cal_data[ETERM_ES][i][0];
float sq = err*err + eri*eri;
float s11ar = (s11mr * err + s11mi * eri) / sq;
float s11ai = (s11mi * err - s11mr * eri) / sq;
measured[0][i][0] = s11ar;
measured[0][i][1] = s11ai;

// CAUTION: Et is inversed for efficiency
// S21m' = S21m - Ex
// S21a = S21m' (1-EsS11a)Et
float s21mr = measured[1][i][0] - cal_data[ETERM_EX][i][0];
float s21mi = measured[1][i][1] - cal_data[ETERM_EX][i][1];
float esr = 1 - (cal_data[ETERM_ES][i][0] * s11ar - cal_data[ETERM_ES][i][1] * s11ai);
float esi = - (cal_data[ETERM_ES][i][1] * s11ar + cal_data[ETERM_ES][i][0] * s11ai);
float etr = esr * cal_data[ETERM_ET][i][0] - esi * cal_data[ETERM_ET][i][1];
float eti = esr * cal_data[ETERM_ET][i][1] + esi * cal_data[ETERM_ET][i][0];
float s21ar = s21mr * etr - s21mi * eti;
float s21ai = s21mi * etr + s21mr * eti;
measured[1][i][0] = s21ar;
measured[1][i][1] = s21ai;
}


and here, after the measurements are made, where the measurements are turned into cal parameters.



void cal_done(void)
{
chMtxLock(&mutex_sweep);
ensure_edit_config();
if (!(cal_status & CALSTAT_LOAD))
eterm_set(ETERM_ED, 0.0, 0.0);
//adjust_ed();
if ((cal_status & CALSTAT_SHORT) && (cal_status & CALSTAT_OPEN)) {
eterm_calc_es();
eterm_calc_er(-1);
} else if (cal_status & CALSTAT_OPEN) {
eterm_copy(CAL_SHORT, CAL_OPEN);
eterm_set(ETERM_ES, 0.0, 0.0);
eterm_calc_er(1);
} else if (cal_status & CALSTAT_SHORT) {
eterm_set(ETERM_ES, 0.0, 0.0);
cal_status &= ~CALSTAT_SHORT;
eterm_calc_er(-1);
} else {
eterm_set(ETERM_ER, 1.0, 0.0);
eterm_set(ETERM_ES, 0.0, 0.0);
}

if (!(cal_status & CALSTAT_ISOLN))
eterm_set(ETERM_EX, 0.0, 0.0);
if (cal_status & CALSTAT_THRU) {
eterm_calc_et();
} else {
eterm_set(ETERM_ET, 1.0, 0.0);
}

cal_status |= CALSTAT_APPLY;
redraw_request |= REDRAW_CAL_STATUS;
chMtxUnlock(&mutex_sweep);
}

Join [email protected] to automatically receive all group messages.