private void SolarCalculation(int k, DateTime timer) { _solarModel.Year = timer.Year; _solarModel.Month = timer.Month; _solarModel.Day = timer.Day; _solarModel.Hour = timer.Hour; _solarModel.Minute = timer.Minute; _solarModel.Second = timer.Second; // _solarModel.Delta_ut1 = -0.3; _solarModel.DeltaT = 67; _solarModel.Timezone = +2; _solarModel.Longitude = _track[k].Point1.Longitude; _solarModel.Latitude = _track[k].Point1.Latitude; _solarModel.Elevation = _track[k].Point1.Elevation; _solarModel.Pressure = 1025; _solarModel.Temperature = 30; _solarModel.Slope = GradientFilter(_track, k); _solarModel.AzmRotation = _track[k].Azimuth; _solarModel.AtmosRefract = 0.5667; _solarModel.Function = (int)SpaSelect.SpaAll; _solarModelService.SpaValues = _solarModel; _solarModelService.SpaDataCalculate(_solarModelService.SpaValues); _solarModel = _solarModelService.SpaValues; }
public OptimalDrivingStrategy() { _vehicleState = new States(); _vehicleStates = new ObservableCollection <States>(); _solarModel = new SpaData(); _solarModelCollection = new ObservableCollection <SpaData>(); _solarModelService = new SpaService(); _sampleStats = new SampleStats(); _combinedTrack = new ObservableCollection <RouteSegmentVector>(); _finishTime = DateTime.Now.ToLocalTime(); _velocityReference = 19.0; _brightnessFactor = 0.8; _numberOfLoops = 0; }
public int SpaDataCalculate(SpaData spaValues) { //declare the SPA structure int result; double min, sec; /* //_spaValues = new Spa_Data(); * * ////enter required input values into SPA structure * //_spaValues.Function = (int)SpaSelect.SPA_ALL; * //_spaValues.Year = _spaDataLink.SpaDataProp.Year; * //_spaValues.Month = _spaDataLink.SpaDataProp.Month; * //_spaValues.Day = _spaDataLink.SpaDataProp.Day; * //_spaValues.Hour = _spaDataLink.SpaDataProp.Hour; * //_spaValues.Minute = _spaDataLink.SpaDataProp.Minute; * //_spaValues.Second = _spaDataLink.SpaDataProp.Second; * //_spaValues.Timezone = _spaDataLink.SpaDataProp.Timezone; * //_spaValues.Delta_ut1 = _spaDataLink.SpaDataProp.Delta_ut1; * //_spaValues.Delta_t = _spaDataLink.SpaDataProp.Delta_t; * //_spaValues.Longitude = _spaDataLink.SpaDataProp.Longitude; * //_spaValues.Latitude = _spaDataLink.SpaDataProp.Latitude; * //_spaValues.Elevation = _spaDataLink.SpaDataProp.Elevation; * //_spaValues.Pressure = _spaDataLink.SpaDataProp.Pressure; * //_spaValues.Temperature = _spaDataLink.SpaDataProp.Temperature; * //_spaValues.Slope = _spaDataLink.SpaDataProp.Slope; * //_spaValues.Azm_rotation = _spaDataLink.SpaDataProp.Azm_rotation; * //_spaValues.Atmos_refract = _spaDataLink.SpaDataProp.Atmos_refract; * //_spaValues.Function = _spaDataLink.SpaDataProp.Function; * //call the _spaValues calculate function and pass the _spaValues structure*/ Spa spawork = new Spa(); result = spawork.spa_calculate(ref spaValues); if (result == 0) //check for SPA errors { //display the results inside the SPA structure //Console.WriteLine("Julian Day: {0}", _spaValues.jd); //Console.WriteLine("L: {0} degrees", _spaValues.l); //Console.WriteLine("B: {0} degrees", _spaValues.b); //Console.WriteLine("R: {0} AU", _spaValues.r); //Console.WriteLine("H: {0} degrees", _spaValues.h); //Console.WriteLine("Delta Psi: {0} degrees", _spaValues.del_psi); //Console.WriteLine("Delta Epsilon: {0} degrees", _spaValues.del_epsilon); //Console.WriteLine("Epsilon: {0} degrees", _spaValues.epsilon); //Console.WriteLine("Zenith: {0} degrees", _spaValues.zenith); //Console.WriteLine("Azimuth: {0} degrees", _spaValues.azimuth); //Console.WriteLine("Incidence: {0} degrees", _spaValues.incidence); min = 60.0 * (spaValues.Sunrise - (int)(spaValues.Sunrise)); sec = 60.0 * (min - (int)min); //Console.Write("Sunrise: {0}:{1}:{2} Local Time\n", (int)(_spaValues.sunrise), (int)min, (int)sec); min = 60.0 * (spaValues.Sunset - (int)(spaValues.Sunset)); sec = 60.0 * (min - (int)min); //Console.Write("Sunset: {0}:{1}:{2} Local Time\n", (int)(_spaValues.sunset), (int)min, (int)sec); //_spaDataLink.SpaDataProp = _spaValues; } else { return(result); } return(0); }
public SpaService() { SpaValues = new SpaData(); }