add cumulated energy to course of day

This commit is contained in:
woheller69 2023-05-16 08:49:28 +02:00
parent 428d59a2a5
commit 28aed88cea
9 changed files with 21 additions and 9 deletions

View file

@ -5,6 +5,7 @@
solXpect is an app that forecasts the output of your solar power plant by using direct and diffuse radiation data from Open-Meteo.com, calculating the position of the sun, and projecting the radiation on your solar panel.
It shows the estimated energy production for the next 16 days, with hourly values calculated for the preceding hour. As an example, if there are 150 Wh shown at 11:00 this means you can expect 150 Wh between 10:00 and 11:00.
The values starting with $\sum$ show the cumulated energy since midnight of the first day.
To use solXpect, you simply enter your latitude and longitude coordinates, as well as the azimuth and tilt of your solar panel.
You also enter information about the peak power, efficiency, temperature coefficient, and area of your solar panel, as well as the maximum power and efficiency of your inverter.
Additionally, solXpect allows you to define shading on your solar panels by specifying the minimum elevation of the sun necessary for the sun to hit the solar panels, as well as the percentage of shading for elevations below this value.

View file

@ -4,6 +4,7 @@
Diese App prognostiziert die Leistung Ihrer Solaranlage unter Verwendung von Direkt- und Diffusstrahlungsdaten von Open-Meteo.com, berechnet die Position der Sonne und projiziert die Strahlung auf Ihr Solarpanel.
Es zeigt die geschätzte Energieproduktion für die nächsten 16 Tage an, wobei stündliche Werte für die vorherige Stunde berechnet werden. Wenn zum Beispiel um 11:00 Uhr 150 Wh angezeigt werden, bedeutet dies, dass Sie zwischen 10:00 und 11:00 Uhr 150 Wh erwarten können.
Die mit &#8721 beginnenden Werte zeigen die kumulierte Energie seit Mitternacht des ersten Tages.
Um solXpect zu verwenden, geben Sie einfach Ihre Breiten- und Längenkoordinaten sowie den Azimut und die Neigung Ihres Solarpanels ein.
Sie geben auch Informationen über die Spitzenleistung, Effizienz, Temperaturkoeffizienten und Fläche Ihres Solarpanels sowie die maximale Leistung und Effizienz Ihres Wechselrichters an.
solXpect ermöglicht es Ihnen auch, Verschattungen auf Ihren Solarzellen zu definieren, indem Sie die minimale Sonnenhöhe angeben, die erforderlich ist, damit die Sonne auf die Solarzellen trifft, sowie den prozentualen Schatten für Höhen unter diesem Wert.

View file

@ -4,6 +4,7 @@
This app forecasts the output of your solar power plant by using direct and diffuse radiation data from Open-Meteo.com, calculating the position of the sun, and projecting the radiation on your solar panel.
It shows the estimated energy production for the next 16 days, with hourly values calculated for the preceding hour. As an example, if there are 150 Wh shown at 11:00 this means you can expect 150 Wh between 10:00 and 11:00.
The values starting with &#8721 show the cumulated energy since midnight of the first day.
To use solXpect, you simply enter your latitude and longitude coordinates, as well as the azimuth and tilt of your solar panel.
You also enter information about the peak power, efficiency, temperature coefficient, and area of your solar panel, as well as the maximum power and efficiency of your inverter.
Additionally, solXpect allows you to define shading on your solar panels by specifying the minimum elevation of the sun necessary for the sun to hit the solar panels, as well as the percentage of shading for elevations below this value.

View file

@ -17,6 +17,7 @@ public class HourlyForecast {
private float diffuseRadiation;
private float shortwaveRadiation;
private float power;
private float energyCum;
private String city_name;
@ -109,4 +110,8 @@ public class HourlyForecast {
public void setShortwaveRadiation(float shortwaveRadiation) { this.shortwaveRadiation = shortwaveRadiation; }
public float getShortwaveRadiation() { return this.shortwaveRadiation; }
public float getEnergyCum() { return this.energyCum; }
public void setEnergyCum(float energy_cum) { this.energyCum = energy_cum;}
}

View file

@ -28,6 +28,12 @@ public final class StringFormatUtils {
return removeMinusIfZerosOnly(decimalFormat.format(decimal));
}
public static String formatEnergyCum(Context context, float energyCum) {
if (energyCum < 10000.0f) return formatInt(energyCum, context.getString(R.string.units_Wh));
else if (energyCum < 100000.0f) return formatDecimal(energyCum/1000,context.getString(R.string.units_kWh));
else return formatInt(energyCum/1000,context.getString(R.string.units_kWh));
}
public static String formatInt(float decimal) {
intFormat.setRoundingMode(RoundingMode.HALF_UP);
return removeMinusIfZerosOnly(intFormat.format(decimal));

View file

@ -100,7 +100,10 @@ public class CityWeatherAdapter extends RecyclerView.Adapter<CityWeatherAdapter.
courseDayList = new ArrayList<>();
float energyCumulated=0;
for (HourlyForecast f : hourlyForecasts) {
energyCumulated+=f.getPower();
f.setEnergyCum(energyCumulated);
if (sp.getBoolean("pref_debug",false)) {
courseDayList.add(f);
} else {

View file

@ -98,21 +98,16 @@ public class CourseOfDayAdapter extends RecyclerView.Adapter<CourseOfDayAdapter.
if (sp.getBoolean("pref_debug",false)) {
holder.diffuseRadiation.setVisibility(View.VISIBLE);
holder.directRadiationNormal.setVisibility(View.VISIBLE);
holder.energyCum.setVisibility(View.VISIBLE);
} else {
holder.diffuseRadiation.setVisibility(View.GONE);
holder.directRadiationNormal.setVisibility(View.GONE);
holder.energyCum.setVisibility(View.GONE);
}
holder.time.setText(StringFormatUtils.formatTimeWithoutZone(context, courseOfDayList.get(position).getLocalForecastTime(context)));
holder.directRadiationNormal.setText(StringFormatUtils.formatInt(courseOfDayList.get(position).getDirectRadiationNormal()," W/qm"));
holder.diffuseRadiation.setText(StringFormatUtils.formatInt(courseOfDayList.get(position).getDiffuseRadiation()," W/qm"));
holder.power.setText(StringFormatUtils.formatInt(courseOfDayList.get(position).getPower()," "+ context.getString(R.string.units_Wh)));
float energyCumulated=0;
for (int i=0; i<=position;i++)
energyCumulated+=courseOfDayList.get(i).getPower();
holder.energyCum.setText(StringFormatUtils.formatInt(energyCumulated," "+ context.getString(R.string.units_Wh)));
holder.energyCum.setText("\u03a3\u2009"+StringFormatUtils.formatEnergyCum(context, courseOfDayList.get(position).getEnergyCum()));
updateRecyclerViewHeader(); //update header according to date in first visible item on the left

View file

@ -38,7 +38,7 @@ public class WeekWeatherAdapter extends RecyclerView.Adapter<WeekWeatherAdapter.
this.context = context;
this.cityID = cityID;
this.weekForecastList = weekForecastList;
if (!weekForecastList.isEmpty()) {
if (weekForecastList!=null && !weekForecastList.isEmpty()) {
this.courseOfDayHeaderDate = new Date(weekForecastList.get(0).getLocalForecastTime(context)); //init with date of first weekday
} else this.courseOfDayHeaderDate = new Date(); //fallback if no data available
}
@ -114,7 +114,7 @@ public class WeekWeatherAdapter extends RecyclerView.Adapter<WeekWeatherAdapter.
@Override
public int getItemCount() {
if (!weekForecastList.isEmpty())
if (weekForecastList!=null && !weekForecastList.isEmpty())
return weekForecastList.size();
else
return 0;

View file

@ -57,7 +57,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:text="xy Wh"
android:text="\u03a3\u2009xy Wh"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/colorPrimaryDark" />