diff --git a/app/src/main/java/org/woheller69/weather/SolarPowerPlant.java b/app/src/main/java/org/woheller69/weather/SolarPowerPlant.java index 2b319ac..1b48601 100644 --- a/app/src/main/java/org/woheller69/weather/SolarPowerPlant.java +++ b/app/src/main/java/org/woheller69/weather/SolarPowerPlant.java @@ -19,12 +19,13 @@ public class SolarPowerPlant { double diffuseEfficiency; double inverterPowerLimit; double inverterEfficiency; + boolean isCentralInverter; double azimuthAngle; double tiltAngle; private final int[] shadingElevation; private final int[] shadingOpacity; - public SolarPowerPlant(double latitude, double longitude, double cellsMaxPower, double cellsArea, double cellsEfficiency, double cellsTempCoeff, double diffuseEfficiency, double inverterPowerLimit, double inverterEfficiency, double azimuthAngle, double tiltAngle, int[] shadingElevation, int[] shadingOpacity, double albedo ) { + public SolarPowerPlant(double latitude, double longitude, double cellsMaxPower, double cellsArea, double cellsEfficiency, double cellsTempCoeff, double diffuseEfficiency, double inverterPowerLimit, double inverterEfficiency,boolean isCentralInverter, double azimuthAngle, double tiltAngle, int[] shadingElevation, int[] shadingOpacity, double albedo ) { this.albedo = albedo; this.latitude = latitude; this.longitude = longitude; @@ -39,6 +40,7 @@ public class SolarPowerPlant { this.shadingElevation = shadingElevation; this.shadingOpacity = shadingOpacity; this.cellsTempCoeff = cellsTempCoeff / 100; + this.isCentralInverter = isCentralInverter; } @@ -111,7 +113,11 @@ public class SolarPowerPlant { dcPower = totalRadiationOnCell/1000 * (1+(cellTemperature - 25)*cellsTempCoeff) * cellsMaxPower; } - double acPower = Math.min(dcPower * inverterEfficiency, inverterPowerLimit); + double acPower; + if (!isCentralInverter) + acPower = Math.min(dcPower * inverterEfficiency, inverterPowerLimit); + else + acPower = dcPower * inverterEfficiency; //do limiting on system level return (float) acPower; } diff --git a/app/src/main/java/org/woheller69/weather/activities/ForecastCityActivity.java b/app/src/main/java/org/woheller69/weather/activities/ForecastCityActivity.java index 2175c5b..7bda47e 100644 --- a/app/src/main/java/org/woheller69/weather/activities/ForecastCityActivity.java +++ b/app/src/main/java/org/woheller69/weather/activities/ForecastCityActivity.java @@ -219,12 +219,7 @@ public class ForecastCityActivity extends NavigationActivity implements IUpdatea } @Override - public void processNewWeekForecasts(List forecasts) { - stopRefreshAnimation(); - } - - @Override - public void processNewForecasts(List hourlyForecasts) { + public void processNewForecasts(List hourlyForecasts, List weekForecasts) { stopRefreshAnimation(); } diff --git a/app/src/main/java/org/woheller69/weather/activities/ManageLocationsActivity.java b/app/src/main/java/org/woheller69/weather/activities/ManageLocationsActivity.java index a6df83b..b1a059a 100644 --- a/app/src/main/java/org/woheller69/weather/activities/ManageLocationsActivity.java +++ b/app/src/main/java/org/woheller69/weather/activities/ManageLocationsActivity.java @@ -18,6 +18,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; +import android.widget.CheckBox; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; @@ -202,6 +203,7 @@ public class ManageLocationsActivity extends NavigationActivity { EditText editAlbedo = (EditText) dialogView.findViewById(R.id.EditLocation_Albedo); EditText editInverterPowerLimit = (EditText) dialogView.findViewById(R.id.EditLocation_Inverter_Power_Limit); EditText editInverterEfficiency = (EditText) dialogView.findViewById(R.id.EditLocation_Inverter_Efficiency); + CheckBox editIsCentralInverter = (CheckBox) dialogView.findViewById(R.id.EditLocation_Central_Inverter); TextView currentAzimuth = (TextView) dialogView.findViewById(R.id.edit_current_azi_ele); Long time = System.currentTimeMillis()/1000; @@ -251,6 +253,7 @@ public class ManageLocationsActivity extends NavigationActivity { editAlbedo.setFilters(new InputFilter[]{ new InputFilterMinMax(0,1)}); editInverterPowerLimit.setText(Float.toString(city.getInverterPowerLimit())); editInverterEfficiency.setText(Float.toString(city.getInverterEfficiency())); + editIsCentralInverter.setChecked(city.isCentralInverter()); editInverterEfficiency.setFilters(new InputFilter[]{ new InputFilterMinMax(0, 100)}); editTilt.addTextChangedListener(new TextWatcher() { @Override @@ -285,6 +288,7 @@ public class ManageLocationsActivity extends NavigationActivity { Float.parseFloat(editAlbedo.getText().toString().isEmpty() ? "0" : editAlbedo.getText().toString()), Float.parseFloat(editInverterPowerLimit.getText().toString().isEmpty() ? "0" : editInverterPowerLimit.getText().toString()), Float.parseFloat(editInverterEfficiency.getText().toString().isEmpty() ? "0" : editInverterEfficiency.getText().toString()), + editIsCentralInverter.isChecked(), shadingElevation, shadingOpacity ); @@ -321,6 +325,7 @@ public class ManageLocationsActivity extends NavigationActivity { Float.parseFloat(editAlbedo.getText().toString().isEmpty() ? "0" : editAlbedo.getText().toString()), Float.parseFloat(editInverterPowerLimit.getText().toString().isEmpty() ? "0" : editInverterPowerLimit.getText().toString()), Float.parseFloat(editInverterEfficiency.getText().toString().isEmpty() ? "0" : editInverterEfficiency.getText().toString()), + editIsCentralInverter.isChecked(), shadingElevation, shadingOpacity ); diff --git a/app/src/main/java/org/woheller69/weather/database/CityToWatch.java b/app/src/main/java/org/woheller69/weather/database/CityToWatch.java index b66d91a..819aa22 100644 --- a/app/src/main/java/org/woheller69/weather/database/CityToWatch.java +++ b/app/src/main/java/org/woheller69/weather/database/CityToWatch.java @@ -24,6 +24,7 @@ public class CityToWatch { private float azimuthAngle; private float tiltAngle; private float albedo; + private boolean isCentralInverter; private int rank; private int[] shadingElevation = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; private int[] shadingOpacity = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; @@ -147,6 +148,11 @@ public class CityToWatch { this.inverterPowerLimit = inverterPowerLimit; } + public void setIsCentralInverter(boolean isCentralInverter) { + this.isCentralInverter = isCentralInverter; + } + public boolean isCentralInverter() {return isCentralInverter;} + public void setDiffuseEfficiency(float diffuseEfficiency) { this.diffuseEfficiency = diffuseEfficiency; } diff --git a/app/src/main/java/org/woheller69/weather/database/SQLiteHelper.java b/app/src/main/java/org/woheller69/weather/database/SQLiteHelper.java index 83cb220..1a29934 100644 --- a/app/src/main/java/org/woheller69/weather/database/SQLiteHelper.java +++ b/app/src/main/java/org/woheller69/weather/database/SQLiteHelper.java @@ -20,7 +20,7 @@ import static androidx.core.app.JobIntentService.enqueueWork; */ public class SQLiteHelper extends SQLiteOpenHelper { - private static final int DATABASE_VERSION = 3; + private static final int DATABASE_VERSION = 4; private Context context; private List allCities = new ArrayList<>(); @@ -55,6 +55,7 @@ public class SQLiteHelper extends SQLiteOpenHelper { private static final String CITIES_TO_WATCH_SHADING_OPACITY = "shading_opacity"; private static final String CITIES_TO_WATCH_CELLS_TEMP_COEFF = "cells_temp_coeff"; private static final String CITIES_TO_WATCH_ALBEDO = "albedo"; + private static final String CITIES_TO_WATCH_IS_CENTRAL_INVERTER = "is_central_inverter"; //Names of columns in TABLE_FORECAST private static final String FORECAST_ID = "forecast_id"; @@ -139,7 +140,8 @@ public class SQLiteHelper extends SQLiteOpenHelper { CITIES_TO_WATCH_SHADING_ELEVATION + " VARCHAR(255) NOT NULL," + CITIES_TO_WATCH_SHADING_OPACITY + " VARCHAR(255) NOT NULL," + CITIES_TO_WATCH_CELLS_TEMP_COEFF + " REAL NOT NULL," + - CITIES_TO_WATCH_ALBEDO + " REAL NOT NULL)"; + CITIES_TO_WATCH_ALBEDO + " REAL NOT NULL," + + CITIES_TO_WATCH_IS_CENTRAL_INVERTER + " INTEGER)"; public static SQLiteHelper getInstance(Context context) { if (instance == null && context != null) { @@ -170,6 +172,8 @@ public class SQLiteHelper extends SQLiteOpenHelper { // we want both updates, so no break statement here... case 2: db.execSQL("ALTER TABLE "+TABLE_CITIES_TO_WATCH+" ADD COLUMN "+CITIES_TO_WATCH_ALBEDO+" REAL DEFAULT 0"); + case 3: + db.execSQL("ALTER TABLE "+TABLE_CITIES_TO_WATCH+" ADD COLUMN "+CITIES_TO_WATCH_IS_CENTRAL_INVERTER+" INTEGER DEFAULT 0"); } } @@ -199,6 +203,7 @@ public class SQLiteHelper extends SQLiteOpenHelper { values.put(CITIES_TO_WATCH_SHADING_OPACITY,city.getShadingOpacityString()); values.put(CITIES_TO_WATCH_CELLS_TEMP_COEFF,city.getCellsTempCoeff()); values.put(CITIES_TO_WATCH_ALBEDO,city.getAlbedo()); + values.put(CITIES_TO_WATCH_IS_CENTRAL_INVERTER,city.isCentralInverter() ? 1 : 0); long id=database.insert(TABLE_CITIES_TO_WATCH, null, values); @@ -234,6 +239,7 @@ public class SQLiteHelper extends SQLiteOpenHelper { ", " + CITIES_TO_WATCH_SHADING_OPACITY + ", " + CITIES_TO_WATCH_CELLS_TEMP_COEFF + ", " + CITIES_TO_WATCH_ALBEDO + + ", " + CITIES_TO_WATCH_IS_CENTRAL_INVERTER + ", " + CITIES_TO_WATCH_COLUMN_RANK + " FROM " + TABLE_CITIES_TO_WATCH + " WHERE " + CITIES_TO_WATCH_CITY_ID + " = ?", arguments); @@ -258,7 +264,8 @@ public class SQLiteHelper extends SQLiteOpenHelper { cityToWatch.setShadingOpacity(cursor.getString(14)); cityToWatch.setCellsTempCoeff(Float.parseFloat(cursor.getString(15))); cityToWatch.setAlbedo(Float.parseFloat(cursor.getString(16))); - cityToWatch.setRank(Integer.parseInt(cursor.getString(17))); + cityToWatch.setIsCentralInverter(Integer.parseInt(cursor.getString(17)) == 1); + cityToWatch.setRank(Integer.parseInt(cursor.getString(18))); cursor.close(); } @@ -291,6 +298,7 @@ public class SQLiteHelper extends SQLiteOpenHelper { ", " + CITIES_TO_WATCH_SHADING_OPACITY + ", " + CITIES_TO_WATCH_CELLS_TEMP_COEFF + ", " + CITIES_TO_WATCH_ALBEDO + + ", " + CITIES_TO_WATCH_IS_CENTRAL_INVERTER + ", " + CITIES_TO_WATCH_COLUMN_RANK + " FROM " + TABLE_CITIES_TO_WATCH , new String[]{}); @@ -317,7 +325,8 @@ public class SQLiteHelper extends SQLiteOpenHelper { cityToWatch.setShadingOpacity(cursor.getString(14)); cityToWatch.setCellsTempCoeff(Float.parseFloat(cursor.getString(15))); cityToWatch.setAlbedo(Float.parseFloat(cursor.getString(16))); - cityToWatch.setRank(Integer.parseInt(cursor.getString(17))); + cityToWatch.setIsCentralInverter(Integer.parseInt(cursor.getString(17)) == 1); + cityToWatch.setRank(Integer.parseInt(cursor.getString(18))); cityToWatchList.add(cityToWatch); } while (cursor.moveToNext()); @@ -349,6 +358,7 @@ public class SQLiteHelper extends SQLiteOpenHelper { values.put(CITIES_TO_WATCH_SHADING_OPACITY,cityToWatch.getShadingOpacityString()); values.put(CITIES_TO_WATCH_CELLS_TEMP_COEFF,cityToWatch.getCellsTempCoeff()); values.put(CITIES_TO_WATCH_ALBEDO,cityToWatch.getAlbedo()); + values.put(CITIES_TO_WATCH_IS_CENTRAL_INVERTER,cityToWatch.isCentralInverter() ? 1 : 0); database.update(TABLE_CITIES_TO_WATCH, values, CITIES_TO_WATCH_ID + " = ?", new String[]{String.valueOf(cityToWatch.getId())}); diff --git a/app/src/main/java/org/woheller69/weather/ui/RecycleList/CityWeatherAdapter.java b/app/src/main/java/org/woheller69/weather/ui/RecycleList/CityWeatherAdapter.java index ab01a9c..ec577b8 100644 --- a/app/src/main/java/org/woheller69/weather/ui/RecycleList/CityWeatherAdapter.java +++ b/app/src/main/java/org/woheller69/weather/ui/RecycleList/CityWeatherAdapter.java @@ -12,6 +12,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; import com.db.chart.Tools; import com.db.chart.model.BarSet; @@ -62,27 +63,30 @@ public class CityWeatherAdapter extends RecyclerView.Adapter hourlyForecasts = database.getForecastsByCityId(generalDataList.getCity_id()); List weekforecasts = database.getWeekForecastsByCityId(generalDataList.getCity_id()); - updateForecastData(hourlyForecasts); - updateWeekForecastData(weekforecasts); + updateForecastData(hourlyForecasts, weekforecasts); } // function update 3-hour or 1-hour forecast list - public void updateForecastData(List hourlyForecasts) { - if (hourlyForecasts.isEmpty()) return; + public void updateForecastData(List hourlyForecasts, List weekForecasts) { + if (hourlyForecasts.isEmpty() || weekForecasts.isEmpty()) return; SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); + int cityId = hourlyForecasts.get(0).getCity_id(); + SQLiteHelper dbHelper = SQLiteHelper.getInstance(context.getApplicationContext()); + CityToWatch requestedCity = dbHelper.getCityToWatch(cityId); + + Float centralInverterLimit = requestedCity.isCentralInverter() ? requestedCity.getInverterPowerLimit() : 0; if (sp.getBoolean("pref_summarize",false)){ - int cityId = hourlyForecasts.get(0).getCity_id(); ArrayList CityIDList = new ArrayList(); - SQLiteHelper dbHelper = SQLiteHelper.getInstance(context.getApplicationContext()); hourlyForecasts = dbHelper.getForecastsByCityId(cityId); //get fresh values from database to make sure we do add new values to sum values from last update List citiesToWatch = dbHelper.getAllCitiesToWatch(); - CityToWatch requestedCity = dbHelper.getCityToWatch(cityId); + for (int i = 0; i < citiesToWatch.size(); i++) { CityToWatch city = citiesToWatch.get(i); if (city.getCityId()!=requestedCity.getCityId() && city.getLatitude() == requestedCity.getLatitude() && city.getLongitude() == requestedCity.getLongitude()) { CityIDList.add(city.getCityId()); + if (city.isCentralInverter()) centralInverterLimit += city.getInverterPowerLimit(); } } if (CityIDList.size()>0){ @@ -97,6 +101,7 @@ public class CityWeatherAdapter extends RecyclerView.Adapter(); float energyCumulated=0; @@ -104,6 +109,7 @@ public class CityWeatherAdapter extends RecyclerView.Adapter0) f.setPower(Math.min(f.getPower(),centralInverterLimit)); //apply central inverter limit if there is one float power = f.getPower(); if (stepCounter > 0) energyCumulated += power; //Ignore first value because power values are for preceding hour f.setEnergyCum(energyCumulated); @@ -119,47 +125,25 @@ public class CityWeatherAdapter extends RecyclerView.Adapter forecasts) { - if (forecasts.isEmpty()) return; - int cityId = forecasts.get(0).getCity_id(); - - SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); - if (sp.getBoolean("pref_summarize",false)){ - ArrayList CityIDList = new ArrayList(); - SQLiteHelper dbHelper = SQLiteHelper.getInstance(context.getApplicationContext()); - forecasts = dbHelper.getWeekForecastsByCityId(cityId); //get fresh values from database to make sure we do add new values to sum values from last update - List citiesToWatch = dbHelper.getAllCitiesToWatch(); - CityToWatch requestedCity = dbHelper.getCityToWatch(cityId); - for (int i = 0; i < citiesToWatch.size(); i++) { - CityToWatch city = citiesToWatch.get(i); - if (city.getCityId()!=requestedCity.getCityId() && city.getLatitude() == requestedCity.getLatitude() && city.getLongitude() == requestedCity.getLongitude()) { - CityIDList.add(city.getCityId()); - } - } - if (CityIDList.size()>0){ - for (int c=0; c wfc = dbHelper.getWeekForecastsByCityId(iteratorCityId); - if (wfc.size() != forecasts.size()) break; //maybe something went wrong during update or city is not yet updated - for (int i=0;i=timeNoon-11*3600*1000L) && (hourlyForecast.getForecastTime()< timeNoon + 13*3600*1000L)){ //values are for preceding hour! + totalEnergy+=hourlyForecast.getPower(); } } + weekForecast.setEnergyDay(totalEnergy/1000); } - weekForecastList = forecasts; - + weekForecastList = weekForecasts; notifyDataSetChanged(); } - static class ViewHolder extends RecyclerView.ViewHolder { ViewHolder(View v) { super(v); diff --git a/app/src/main/java/org/woheller69/weather/ui/RecycleList/RecyclerOverviewListAdapter.java b/app/src/main/java/org/woheller69/weather/ui/RecycleList/RecyclerOverviewListAdapter.java index 7edc976..3c17457 100644 --- a/app/src/main/java/org/woheller69/weather/ui/RecycleList/RecyclerOverviewListAdapter.java +++ b/app/src/main/java/org/woheller69/weather/ui/RecycleList/RecyclerOverviewListAdapter.java @@ -128,7 +128,7 @@ public class RecyclerOverviewListAdapter extends RecyclerView.Adapter hourlyForecasts) { + public void processNewForecasts(List hourlyForecasts, List weekForecasts) { if (hourlyForecasts != null && hourlyForecasts.size() > 0 && hourlyForecasts.get(0).getCity_id() == mCityId) { if (mAdapter != null) { - mAdapter.updateForecastData(hourlyForecasts); - } - } - } - - @Override - public void processNewWeekForecasts(List forecasts) { - if (forecasts != null && forecasts.size() > 0 && forecasts.get(0).getCity_id() == mCityId) { - if (mAdapter != null) { - mAdapter.updateWeekForecastData(forecasts); + mAdapter.updateForecastData(hourlyForecasts, weekForecasts); } } } diff --git a/app/src/main/java/org/woheller69/weather/ui/updater/IUpdateableCityUI.java b/app/src/main/java/org/woheller69/weather/ui/updater/IUpdateableCityUI.java index 305f095..527916c 100644 --- a/app/src/main/java/org/woheller69/weather/ui/updater/IUpdateableCityUI.java +++ b/app/src/main/java/org/woheller69/weather/ui/updater/IUpdateableCityUI.java @@ -12,7 +12,6 @@ import java.util.List; public interface IUpdateableCityUI { void processNewGeneralData(GeneralData data); - void processNewForecasts(List hourlyForecasts); + void processNewForecasts(List hourlyForecasts, List weekForecasts); - void processNewWeekForecasts(List forecasts); } diff --git a/app/src/main/java/org/woheller69/weather/ui/updater/ViewUpdater.java b/app/src/main/java/org/woheller69/weather/ui/updater/ViewUpdater.java index 8db5c96..959e29f 100644 --- a/app/src/main/java/org/woheller69/weather/ui/updater/ViewUpdater.java +++ b/app/src/main/java/org/woheller69/weather/ui/updater/ViewUpdater.java @@ -31,17 +31,11 @@ public class ViewUpdater { } } - public static void updateWeekForecasts(List forecasts) { - ArrayList subcopy = new ArrayList<>(subscribers); - for (IUpdateableCityUI sub : subcopy) { - sub.processNewWeekForecasts(forecasts); - } - } - public static void updateForecasts(List hourlyForecasts) { + public static void updateForecasts(List hourlyForecasts, List weekForecasts) { ArrayList subcopy = new ArrayList<>(subscribers); for (IUpdateableCityUI sub : subcopy) { - sub.processNewForecasts(hourlyForecasts); + sub.processNewForecasts(hourlyForecasts, weekForecasts); } } } diff --git a/app/src/main/java/org/woheller69/weather/ui/viewPager/WeatherPagerAdapter.java b/app/src/main/java/org/woheller69/weather/ui/viewPager/WeatherPagerAdapter.java index 09dbb63..c95b2fd 100644 --- a/app/src/main/java/org/woheller69/weather/ui/viewPager/WeatherPagerAdapter.java +++ b/app/src/main/java/org/woheller69/weather/ui/viewPager/WeatherPagerAdapter.java @@ -118,14 +118,10 @@ public class WeatherPagerAdapter extends FragmentStateAdapter implements IUpdate } @Override - public void processNewForecasts(List hourlyForecasts) { + public void processNewForecasts(List hourlyForecasts, List weekForecasts) { //empty because Fragments are subscribers themselves } - @Override - public void processNewWeekForecasts(List forecasts) { - //empty because Fragments are subscribers themselves - } public int getCityIDForPos(int pos) { CityToWatch city = cities.get(pos); diff --git a/app/src/main/java/org/woheller69/weather/weather_api/open_meteo/OMDataExtractor.java b/app/src/main/java/org/woheller69/weather/weather_api/open_meteo/OMDataExtractor.java index a886fbc..6eb8422 100644 --- a/app/src/main/java/org/woheller69/weather/weather_api/open_meteo/OMDataExtractor.java +++ b/app/src/main/java/org/woheller69/weather/weather_api/open_meteo/OMDataExtractor.java @@ -75,7 +75,7 @@ public class OMDataExtractor implements IDataExtractor { SQLiteHelper dbhelper = SQLiteHelper.getInstance(context); CityToWatch city = dbhelper.getCityToWatch(cityID); - SolarPowerPlant spp = new SolarPowerPlant(city.getLatitude(), city.getLongitude(), city.getCellsMaxPower(), city.getCellsArea(), city.getCellsEfficiency(), city.getCellsTempCoeff(), city.getDiffuseEfficiency(), city.getInverterPowerLimit(), city.getInverterEfficiency(), city.getAzimuthAngle(), city.getTiltAngle(), city.getShadingElevation(), city.getShadingOpacity(), city.getAlbedo()); + SolarPowerPlant spp = new SolarPowerPlant(city.getLatitude(), city.getLongitude(), city.getCellsMaxPower(), city.getCellsArea(), city.getCellsEfficiency(), city.getCellsTempCoeff(), city.getDiffuseEfficiency(), city.getInverterPowerLimit(), city.getInverterEfficiency(), city.isCentralInverter(), city.getAzimuthAngle(), city.getTiltAngle(), city.getShadingElevation(), city.getShadingOpacity(), city.getAlbedo()); IApiToDatabaseConversion conversion = new OMToDatabaseConversion(); diff --git a/app/src/main/java/org/woheller69/weather/weather_api/open_meteo/ProcessOMweatherAPIRequest.java b/app/src/main/java/org/woheller69/weather/weather_api/open_meteo/ProcessOMweatherAPIRequest.java index a433b74..9684446 100644 --- a/app/src/main/java/org/woheller69/weather/weather_api/open_meteo/ProcessOMweatherAPIRequest.java +++ b/app/src/main/java/org/woheller69/weather/weather_api/open_meteo/ProcessOMweatherAPIRequest.java @@ -141,8 +141,7 @@ public class ProcessOMweatherAPIRequest implements IProcessHttpRequest { dbHelper.addWeekForecasts(weekforecasts); if (c == CityIDList.size()-1) ViewUpdater.updateGeneralDataData(generalData); // Call Viewupdater if last (requested) city is updated - if (c == CityIDList.size()-1) ViewUpdater.updateWeekForecasts(weekforecasts); - if (c == CityIDList.size()-1) ViewUpdater.updateForecasts(hourlyforecasts); + if (c == CityIDList.size()-1) ViewUpdater.updateForecasts(hourlyforecasts, weekforecasts); } catch (JSONException e) { e.printStackTrace(); @@ -194,17 +193,6 @@ public class ProcessOMweatherAPIRequest implements IProcessHttpRequest { } } - for (WeekForecast weekForecast: weekforecasts){ - float totalEnergy = 0; - Long timeNoon = weekForecast.getForecastTime(); - for (HourlyForecast hourlyForecast: hourlyforecasts){ - if ((hourlyForecast.getForecastTime()>=timeNoon-11*3600*1000L) && (hourlyForecast.getForecastTime()< timeNoon + 13*3600*1000L)){ //values are for preceding hour! - totalEnergy+=hourlyForecast.getPower(); - } - } - weekForecast.setEnergyDay(totalEnergy/1000); - } - return weekforecasts; } diff --git a/app/src/main/res/layout/dialog_edit_location.xml b/app/src/main/res/layout/dialog_edit_location.xml index ce88ea2..0dee8c1 100644 --- a/app/src/main/res/layout/dialog_edit_location.xml +++ b/app/src/main/res/layout/dialog_edit_location.xml @@ -168,7 +168,15 @@ android:layout_height="wrap_content" android:inputType="numberDecimal" android:hint="@string/edit_location_hint_inverter_efficiency"/> - + + Albedo [0..1] Server URLs Nur ändern, wenn Sie Ihre eigenen Server betreiben wollen + Zentralwechselrichter diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index d54c65b..82b093d 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -113,5 +113,6 @@ GitHub Server URLs Cambia solo se vuoi ospitare un tuo server + Invertitore centrale diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 8b7db3a..fbd6324 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -109,4 +109,5 @@ Albedo [0..1] Sunucu URL\'leri Yalnızca kendi sunucularınızı barındırmak istiyorsanız değiştirin + Merkezi invertör diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 39fe573..368ff81 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -113,5 +113,6 @@ GitHub Server URLs Only change if you want to host your own servers + Central Inverter