private async Task UpdateSummaryAsync() { var estDaily = FindViewById <TextView>(Resource.Id.estimated_daily); var estMonthly = FindViewById <TextView>(Resource.Id.estimated_monthly); var estAnnual = FindViewById <TextView>(Resource.Id.estimated_annual); PVSystemInfo systemInfo = await PVSystemInfo.FromDBAsync(db, sn.ID); var panelSummary = await systemInfo.GetPanelSummaryAsync( panel, powerCalc, pvWattsApiClient, new GeoCoords(sn.Latitude, sn.Longtitude), GetZenith(), DateTime.Now, GetTimeZoneOffset(), tempCelsius : 25.0); estDaily.Text = (panelSummary.TodayDCArrayOutput).ToString("0.00") + "kW"; estMonthly.Text = (panelSummary.MonthlyDCArrayOutput).ToString("0.00") + "kW"; estAnnual.Text = (panelSummary.AnnualDCArrayOutput).ToString("0.00") + "kW"; }
private async Task UpdateCardsAsync() { try { bool hasConnection = await CheckInternetConnectionAsync(); if (!hasConnection) { Snackbar.Make(FindViewById(Resource.Id.main_content), "No internet connection.", Snackbar.LengthShort).Show(); CallOnReconnect(async delegate { await UpdateCardsAsync(); }); return; } GeoCoords geoCoords = new GeoCoords { Latitude = solarNetwork.Latitude, Longitude = solarNetwork.Longtitude }; PVSystemInfo systemInfo = await PVSystemInfo.FromDBAsync(db, solarNetwork.ID); UpdatePVSystemInfo(systemInfo); WeatherInfo weatherInfo = await weatherProvider.GetWeatherInfoAsync(geoCoords); UpdateWeatherInfoView(weatherInfo); ConsumerInfo consumerInfo = await ConsumerInfo.FromDBAsync(db, solarNetwork.ID); UpdateConsumerInfo(consumerInfo); SystemSummary arraySummary = await GetArraySummaryAsync(weatherInfo); UpdateArraySummary(arraySummary, consumerInfo); } catch (Exception e) { Log.Error(ToString(), e.ToString()); } }
private async Task <SystemSummary> GetArraySummaryAsync(WeatherInfo weatherInfo) { GeoCoords coords = new GeoCoords { Latitude = solarNetwork.Latitude, Longitude = solarNetwork.Longtitude }; TimeZone timeZone = TimeZone.CurrentTimeZone; TimeSpan timeZoneOffset = timeZone.GetUtcOffset(DateTime.Now); double timeZoneOffsetHours = timeZoneOffset.Hours + timeZoneOffset.Minutes / 30.0; PVSystemInfo systemInfo = await PVSystemInfo.FromDBAsync(db, solarNetwork.ID); return(await systemInfo.GetSystemSummaryAsync( powerCalculator, pvWattsApiClient, coords, DateTime.Now, timeZoneOffsetHours, tempCelsius : weatherInfo.Temperature.Value - 273.15 )); }