public void Initialize(PluginConfiguration configuration, Action<Action<ISystemController, IRaceController>> queueCommand)
        {
            _components = new List<IPluginComponent>();
        
            _initialized = false;

			_tsaGeoMag = new TSAGeoMag(_cofFilePath,_logger);

            var magvarCalc = new MagneticVariationCalculator(_logger, this, _tsaGeoMag);
            _components.Add(magvarCalc);
            configuration.Calculators.Add(magvarCalc);

            _initialized = true;
        }
Esempio n. 2
0
        public void Initialize(PluginConfiguration configuration, Action <Action <ISystemController, IRaceController> > queueCommand)
        {
            _components = new List <IPluginComponent>();

            _initialized = false;

            _tsaGeoMag = new TSAGeoMag(_cofFilePath, _logger);

            var magvarCalc = new MagneticVariationCalculator(_logger, this, _tsaGeoMag);

            _components.Add(magvarCalc);
            configuration.Calculators.Add(magvarCalc);

            _initialized = true;
        }
Esempio n. 3
0
        /// <inheritdoc />
        public void Calculate(State state)
        {
            if (state.Location != null &&
                state.Location.Latitude != null &&
                state.Location.Longitude != null &&
                state.StateValues.ContainsKey(StateValue.AltitudeInMeters))
            {
                double now = TSAGeoMag.decimalYear(state.BestTime);
                state.StateValues[StateValue.MagneticDeviation] = _tsaGeoMag.getDeclination(state.Location.Latitude.Value, state.Location.Longitude.Value, now, state.StateValues[StateValue.AltitudeInMeters] / 1000.0);

                if (state.StateValues.ContainsKey(StateValue.MagneticHeading))
                {
                    state.StateValues[StateValue.MagneticHeadingWithVariation] = state.StateValues[StateValue.MagneticHeading] + state.StateValues[StateValue.MagneticDeviation];
                }

                _logger.Debug("Calculated Magnetic Deviation as " + state.StateValues[StateValue.MagneticDeviation] + " for " + state.Location.Latitude.Value + "," + state.Location.Longitude.Value + " altitude " + state.StateValues[StateValue.AltitudeInMeters]);
            }
        }
Esempio n. 4
0
 public MagneticVariationCalculator(ILogger logger, IPlugin plugin, TSAGeoMag tsaGeoMag)
 {
     _plugin    = plugin;
     _tsaGeoMag = tsaGeoMag;
     _logger    = logger;
 }
 public MagneticVariationCalculator(ILogger logger, IPlugin plugin, TSAGeoMag tsaGeoMag)
 {
     _plugin = plugin;
     _tsaGeoMag = tsaGeoMag;
     _logger = logger;
 }