public Propogation CurrentPropogation(string countryFixedName, RadioInfo.BandName band) { int hn = DateTime.UtcNow.Hour; int hf = hn == 24 ? 0 : hn + 1; try { Propogation psn = GetPropogationRel(countryFixedName, band, "S", hn); //psn = Prop Short Now Propogation pln = GetPropogationRel(countryFixedName, band, "L", hn); Propogation psf = GetPropogationRel(countryFixedName, band, "S", hf); Propogation plf = GetPropogationRel(countryFixedName, band, "L", hf); if (psn.Rel >= pln.Rel) { return(InterpolatePropogation(psn, psf)); } else { return(InterpolatePropogation(pln, plf)); } } catch (Exception) { return(new Propogation(countryFixedName, 0, "S", -1, band)); //Dont rethrow, just return the negative REL. } }
public Propogation(string country, float hour, string path, float rel, RadioInfo.BandName band) { Country = country; Hour = hour; Band = band; Path = path; Rel = rel; }
private Propogation GetPropogationRel(string countryFixedName, RadioInfo.BandName band, string path, int hour) { try { return(Propogations.Where(x => x.Country == countryFixedName && x.Band == band && x.Hour == hour && x.Path == path ).First()); } catch (Exception e) { throw e; } }
public SpotValueModel(string call, ICountryZone countryZone, RadioInfo.BandName band, int multiplier) { Call = call; Band = band; CountryZone = countryZone; Multiplier = multiplier; CountryScarcity = Math.Log10((double)CZLabelBand("Totals", Band) / (CZLabelBand(CountryZone.Country, Band) + 1)); //Prevent divide by zero ZoneScarcity = Math.Log10((double)CZLabelBand("Totals", Band) / (CZLabelBand(CountryZone.CQZone.ToString(), Band) + 1)); try { CallScarcity = (double)(PrecalculatedAnalysis.Call_Analysis.Where(x => x.Call == call).FirstOrDefault().HoursWorked) / 6; } catch (Exception) { CallScarcity = 8; } }
public int CZLabelBand(string label, RadioInfo.BandName band) { try { var o = PrecalculatedAnalysis.CountryZone_Analysis.Where(x => x.Label == label).First(); if (band == RadioInfo.BandName.OneSixtyMeters) { return(o.OnePointEightMHz); } else if (band == RadioInfo.BandName.EightyMeters) { return(o.ThreePointFiveMHz); } else if (band == RadioInfo.BandName.FourtyMeters) { return(o.SevenMHz); } else if (band == RadioInfo.BandName.TwentyMeters) { return(o.FourteenMHz); } else if (band == RadioInfo.BandName.FifteenMeters) { return(o.TwentyOneMHz); } else if (band == RadioInfo.BandName.TenMeters) { return(o.TwentyEightMHz); } //Ignoring the null calse return(0); } catch (Exception) { return(0); //Missing case, maybe a country that wasn't in the last contest? throw; } }