add shading to database for future use

rename to pvCaster
This commit is contained in:
woheller69 2023-04-04 18:20:02 +02:00
parent 443a9144e3
commit e989b873f6
12 changed files with 73 additions and 21 deletions

View file

@ -1,9 +1,9 @@
<pre>Send a coffee to woheller69@t-online.de
<a href= "https://www.paypal.com/signin"><img align="left" src="https://www.paypalobjects.com/webstatic/de_DE/i/de-pp-logo-150px.png"></a></pre>
# solarCast
# pvCaster
solarCast forecasts the output of your solar power plant
pvCaster forecasts the output of your solar power plant
This app takes direct and diffuse radiation data from Open-Meteo.com, calculates the position
of the sun and projects the radiation on your solar panel.

View file

@ -16,7 +16,7 @@ android {
versionName "1.0"
buildConfigField "String", "BASE_URL", "\"https://api.open-meteo.com/v1/\""
buildConfigField "String", "GITHUB_URL","\"https://github.com/woheller69/solarcast/\""
buildConfigField "String", "GITHUB_URL","\"https://github.com/woheller69/pvcaster/\""
}
buildTypes {

View file

@ -1,5 +1,7 @@
package org.woheller69.weather.database;
import java.util.Arrays;
/**
* This class is the database model for the cities to watch. 'Cities to watch' means the locations
* for which a user would like to see the weather for. This includes those locations that will be
@ -21,6 +23,8 @@ public class CityToWatch {
private float azimuthAngle;
private float tiltAngle;
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};
public CityToWatch() {
}
@ -146,4 +150,36 @@ public class CityToWatch {
public void setTiltAngle(float tiltAngle) {
this.tiltAngle = tiltAngle;
}
public void setShadingElevation(String string) {
shadingElevation = Arrays.stream(string.split(",")).mapToInt(Integer::parseInt).toArray();
}
public void setShadingElevation(int[] shadingElevation){
this.shadingElevation = shadingElevation;
}
public void setShadingOpacity(String string) {
shadingOpacity = Arrays.stream(string.split(",")).mapToInt(Integer::parseInt).toArray();
}
public void setShadingOpacity(int[] shadingOpacity){
this.shadingOpacity = shadingOpacity;
}
public int[] getShadingElevation(){
return shadingElevation;
}
public int[] getShadingOpacity(){
return shadingOpacity;
}
public String getShadingElevationString() {
return Arrays.toString(shadingElevation).replaceAll("\\[|\\]|\\s", "");
}
public String getShadingOpacityString() {
return Arrays.toString(shadingOpacity).replaceAll("\\[|\\]|\\s", "");
}
}

View file

@ -51,6 +51,8 @@ public class SQLiteHelper extends SQLiteOpenHelper {
private static final String CITIES_TO_WATCH_INVERTER_EFFICIENCY = "inverter_efficiency";
private static final String CITIES_TO_WATCH_AZIMUTH_ANGLE = "azimuth_angle";
private static final String CITIES_TO_WATCH_TILT_ANGLE = "tilt_angle";
private static final String CITIES_TO_WATCH_SHADING_ELEVATION = "shading_elevation";
private static final String CITIES_TO_WATCH_SHADING_OPACITY = "shading_opacity";
//Names of columns in TABLE_FORECAST
private static final String FORECAST_ID = "forecast_id";
@ -131,7 +133,9 @@ public class SQLiteHelper extends SQLiteOpenHelper {
CITIES_TO_WATCH_INVERTER_POWER_LIMIT + " REAL NOT NULL," +
CITIES_TO_WATCH_INVERTER_EFFICIENCY + " REAL NOT NULL," +
CITIES_TO_WATCH_AZIMUTH_ANGLE + " REAL NOT NULL," +
CITIES_TO_WATCH_TILT_ANGLE + " REAL NOT NULL)";
CITIES_TO_WATCH_TILT_ANGLE + " REAL NOT NULL," +
CITIES_TO_WATCH_SHADING_ELEVATION + " VARCHAR(255) NOT NULL," +
CITIES_TO_WATCH_SHADING_OPACITY + " VARCHAR(255) NOT NULL)";
public static SQLiteHelper getInstance(Context context) {
if (instance == null && context != null) {
@ -179,6 +183,8 @@ public class SQLiteHelper extends SQLiteOpenHelper {
values.put(CITIES_TO_WATCH_INVERTER_EFFICIENCY,city.getInverterEfficiency());
values.put(CITIES_TO_WATCH_AZIMUTH_ANGLE,city.getAzimuthAngle());
values.put(CITIES_TO_WATCH_TILT_ANGLE,city.getTiltAngle());
values.put(CITIES_TO_WATCH_SHADING_ELEVATION,city.getShadingElevationString());
values.put(CITIES_TO_WATCH_SHADING_OPACITY,city.getShadingOpacityString());
long id=database.insert(TABLE_CITIES_TO_WATCH, null, values);
@ -210,6 +216,8 @@ public class SQLiteHelper extends SQLiteOpenHelper {
", " + CITIES_TO_WATCH_INVERTER_EFFICIENCY +
", " + CITIES_TO_WATCH_AZIMUTH_ANGLE +
", " + CITIES_TO_WATCH_TILT_ANGLE +
", " + CITIES_TO_WATCH_SHADING_ELEVATION +
", " + CITIES_TO_WATCH_SHADING_OPACITY +
", " + CITIES_TO_WATCH_COLUMN_RANK +
" FROM " + TABLE_CITIES_TO_WATCH +
" WHERE " + CITIES_TO_WATCH_CITY_ID + " = ?", arguments);
@ -230,7 +238,9 @@ public class SQLiteHelper extends SQLiteOpenHelper {
cityToWatch.setInverterEfficiency(Float.parseFloat(cursor.getString(10)));
cityToWatch.setAzimuthAngle(Float.parseFloat(cursor.getString(11)));
cityToWatch.setTiltAngle(Float.parseFloat(cursor.getString(12)));
cityToWatch.setRank(Integer.parseInt(cursor.getString(13)));
cityToWatch.setShadingElevation(cursor.getString(13));
cityToWatch.setShadingOpacity(cursor.getString(14));
cityToWatch.setRank(Integer.parseInt(cursor.getString(15)));
cursor.close();
}
@ -259,6 +269,8 @@ public class SQLiteHelper extends SQLiteOpenHelper {
", " + CITIES_TO_WATCH_INVERTER_EFFICIENCY +
", " + CITIES_TO_WATCH_AZIMUTH_ANGLE +
", " + CITIES_TO_WATCH_TILT_ANGLE +
", " + CITIES_TO_WATCH_SHADING_ELEVATION +
", " + CITIES_TO_WATCH_SHADING_OPACITY +
", " + CITIES_TO_WATCH_COLUMN_RANK +
" FROM " + TABLE_CITIES_TO_WATCH
, new String[]{});
@ -281,7 +293,9 @@ public class SQLiteHelper extends SQLiteOpenHelper {
cityToWatch.setInverterEfficiency(Float.parseFloat(cursor.getString(10)));
cityToWatch.setAzimuthAngle(Float.parseFloat(cursor.getString(11)));
cityToWatch.setTiltAngle(Float.parseFloat(cursor.getString(12)));
cityToWatch.setRank(Integer.parseInt(cursor.getString(13)));
cityToWatch.setShadingElevation(cursor.getString(13));
cityToWatch.setShadingOpacity(cursor.getString(14));
cityToWatch.setRank(Integer.parseInt(cursor.getString(15)));
cityToWatchList.add(cityToWatch);
} while (cursor.moveToNext());
@ -309,6 +323,8 @@ public class SQLiteHelper extends SQLiteOpenHelper {
values.put(CITIES_TO_WATCH_INVERTER_EFFICIENCY,cityToWatch.getInverterEfficiency());
values.put(CITIES_TO_WATCH_AZIMUTH_ANGLE,cityToWatch.getAzimuthAngle());
values.put(CITIES_TO_WATCH_TILT_ANGLE,cityToWatch.getTiltAngle());
values.put(CITIES_TO_WATCH_SHADING_ELEVATION,cityToWatch.getShadingElevationString());
values.put(CITIES_TO_WATCH_SHADING_OPACITY,cityToWatch.getShadingOpacityString());
database.update(TABLE_CITIES_TO_WATCH, values, CITIES_TO_WATCH_ID + " = ?",
new String[]{String.valueOf(cityToWatch.getId())});

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">solarCast</string>
<string name="app_name">pvCaster</string>
<string name="about">Über</string>
<string name="about_privacy_heading">Privatsphäre-Informationen</string>
<string name="about_more_info">Mehr Informationen können gefunden werden auf:</string>
<string name="about_license_text">Diese App ist abgeleitet von Privacy Friendly Weather, entwickelt von der Forschungsgruppe SECUSO. Quelltext lizenziert unter GPLv3. Die App benutzt Icons von Google Material Design Icons, lizenziert unter Apache License Version 2.0, die Leaflet Bibliothek, lizenziert unter 2-clause BSD License, AutoSuggestTextViewAPICall, lizenziert unter der Apache License Version 2.0, Solarpositioning (net.e175.klaus:solarpositioning), lizenziert unter MIT Lizenz und die WilliamChart Bibliothek (com.db.chart), lizenziert unter der Apache License Version 2.0</string>
<string name="about_license">Lizenz</string>
<string name="about_privacy_answer">solarCast benötigt nur Zugang zum Internet. Es werden weder persönliche Daten gesammelt, noch wird Werbung angezeigt.</string>
<string name="about_privacy_answer">pvCaster benötigt nur Zugang zum Internet. Es werden weder persönliche Daten gesammelt, noch wird Werbung angezeigt.</string>
<string name="about_where_from">Woher kommen die Wetterinformationen?</string>
<string name="about_where_from_answer">Die Wetterinformationen stammen von</string>
<string name="activity_about">Über</string>
@ -55,7 +55,7 @@
<string name="next">Weiter</string>
<string name="okay">OK</string>
<string name="slide1_heading">Willkommen!</string>
<string name="slide1_text">solarCast prognostiziert den Ertrag Ihrer PV Anlage</string>
<string name="slide1_text">pvCaster prognostiziert den Ertrag Ihrer PV Anlage</string>
<string name="slide2_text">Der Quellcode ist auf GitHub verfügbar. Weitere Informationen finden Sie auf der Über-Seite</string>
<string name="card_error_content">Bitte versuchen Sie zu aktualisieren!</string>
<string name="card_error_heading">Fehler beim Abrufen der Wetterdaten</string>

View file

@ -1,5 +1,5 @@
<resources>
<string name="app_name">solarCast</string>
<string name="app_name">pvCaster</string>
<string name="activity_about">About</string>
<string name="activity_settings">Settings</string>
<string name="activity_weather">Forecast</string>
@ -10,7 +10,7 @@
<string name="next">Next</string>
<string name="okay">Okay</string>
<string name="slide1_heading">Welcome!</string>
<string name="slide1_text">solarCast forecasts the output of your solar power plant</string>
<string name="slide1_text">pvCaster forecasts the output of your solar power plant</string>
<string name="slide2_heading" translatable="false">Github</string>
<string name="slide2_text">The sourcecode of this app is available at GitHub. For further explanations have a look at the About Page.</string>
<string name="card_details_heading">Now</string>
@ -27,7 +27,7 @@
<string name="about_license">License</string>
<string name="about_license_text">This application is derived from Privacy Friendly Weather, developed by the research group SECUSO. Sourcecode licensed under GPLv3. The app uses icons from Google Material Design Icons licensed under Apache License Version 2.0, the Leaflet library which is licensed under 2-clause BSD License, AutoSuggestTextViewAPICall which is licensed under Apache License Version 2.0, Solarpositioning (net.e175.klaus:solarpositioning) which is licensed under MIT License, and WilliamChart library (com.db.chart) which is licensed under Apache License Version 2.0</string>
<string name="about_more_info">More information can be found on:</string>
<string name="about_github" translatable="false"><a href="https://github.com/woheller69/solarcast">Github-Repo</a></string>
<string name="about_github" translatable="false"><a href="https://github.com/woheller69/pvcaster">Github-Repo</a></string>
<string name="about_openmeteo" translatable="false"><a href="https://open-meteo.com">Open-Meteo \n(Attribution 4.0 International CC BY 4.0)</a></string>
<string name="activity_settings_title">Settings</string>
<string name="settings_title_units">Units</string>
@ -64,7 +64,7 @@
<string name="settings_intervals">Intervals</string>
<string name="settings_update_interval">Update interval</string>
<string name="settings_interval_summary">Set the interval of automatic updates</string>
<string name="about_privacy_answer">solarCast only uses the permission \"Internet\" to retrieve weather data. It further does not include any tracking mechanisms or advertisement.</string>
<string name="about_privacy_answer">pvCaster only uses the permission \"Internet\" to retrieve weather data. It further does not include any tracking mechanisms or advertisement.</string>
<string name="about_where_from">Where do the weather informations come from?</string>
<string name="about_where_from_answer">Weather information is fetched from</string>
<string name="long_press_text">Hold and drag to sort.</string>

View file

@ -1,4 +1,4 @@
solarCast prognostiziert den Ertrag Ihrer PV Anlage
pvCaster prognostiziert den Ertrag Ihrer PV Anlage
Diese App nimmt direkte und diffuse Strahlungsdaten von Open-Meteo.com, berechnet die Position
der Sonne und projiziert die Strahlung auf Ihr Solarpanel.
@ -9,7 +9,7 @@ Features:
- Keine Werbung
Minimale Berechtigungen:
solarCast benötigt nur ein Minimum an Berechtigungen, nämlich nur die INTERNET-Berechtigung. Diese ist nötig, um Wetterdaten zu erhalten.
pvCaster benötigt nur ein Minimum an Berechtigungen, nämlich nur die INTERNET-Berechtigung. Diese ist nötig, um Wetterdaten zu erhalten.

View file

@ -1 +1 @@
solarCast prognostiziert den Ertrag Ihrer PV Anlage
pvCaster prognostiziert den Ertrag Ihrer PV Anlage

View file

@ -1 +1 @@
solarCast
pvCaster

View file

@ -1,4 +1,4 @@
solarCast forecasts the output of your solar power plant
pvCaster forecasts the output of your solar power plant
This app takes direct and diffuse radiation data from Open-Meteo.com, calculates the position
of the sun and projects the radiation on your solar panel.
@ -9,4 +9,4 @@ Features:
- No advertisement
Minimum permissions:
omWeather only requires the minimum amount of permission, namely only the INTERNET permission. This permission is necessary for retrieving weather data.
pvCaster only requires the minimum amount of permission, namely only the INTERNET permission. This permission is necessary for retrieving weather data.

View file

@ -1 +1 @@
solarCast forecasts the output of your solar power plant
pvCaster forecasts the output of your solar power plant

View file

@ -1 +1 @@
solarCast
pvCaster