Refactoring

Renaming parameters
Update Readme
This commit is contained in:
woheller69 2023-04-03 13:50:33 +02:00
parent b734fef432
commit 6c78e772bd
14 changed files with 131 additions and 202 deletions

View file

@ -12,6 +12,39 @@ It shows the estimated energy production for the next hours and up to 16 days.
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/01.png" width="150"/><img src="fastlane/metadata/android/en-US/images/phoneScreenshots/02.png" width="150"/> <img src="fastlane/metadata/android/en-US/images/phoneScreenshots/03.png" width="150"/>
## Parameters
#### Latitude [°]
Latitude specifies the northsouth position of your solar power plant. It ranges from 90° at the south pole to 90° at the north pole.
#### Longitude [°]
Longitude specifies the eastwest position of your solar power plant. The prime meridian defines 0° longitude. Positive longitudes are east of the prime meridian, negative ones are west.
#### Azimuth [°]
Azimuth is the horizontal direction of your solar power plant. 0° equals North, 90° equals East, 180° equals South, 270° equals West.
#### Tilt [°]
Tilt is the vertical direction of your solar power plant. 0° means it points up towards the the sky, 90° means it has a vertical orientation and points towards the horizon.
#### Cells max power [W]
Maximum power your solar cells can deliver.
#### Cells efficiency [%]
Portion of energy in the form of sunlight that can be converted into electricity by the solar cell.
#### Cell area [m\u00b2]
Size of the active area your solar panel.
#### Diffuse radiation efficiency [%]
Efficiency of your solar power plant for diffuse radiation. When pointing up it should be around 100%, when pointing to the horizon it may be around 50%.
Also depends on reflections etc.
#### Inverter power [W]
Maximum power of your inverter. If it is lower than the maximum power of your panels the output power of your system will be limited by this parameter.
#### Inverter efficiency [%]
Efficiency of your inverter.
## License
This app is licensed under the GPLv3.

View file

@ -15,22 +15,22 @@ public class SolarPowerPlant {
double cellsArea;
double cellsEfficiency;
double diffuseEfficiency;
double converterPowerLimit;
double converterEfficiency;
double inverterPowerLimit;
double inverterEfficiency;
double azimuthAngle;
double elevationAngle;
double tiltAngle;
public SolarPowerPlant(double latitude, double longitude, double cellsMaxPower, double cellsArea, double cellsEfficiency, double diffuseEfficiency, double converterPowerLimit, double converterEfficiency, double azimuthAngle, double elevationAngle) {
public SolarPowerPlant(double latitude, double longitude, double cellsMaxPower, double cellsArea, double cellsEfficiency, double diffuseEfficiency, double inverterPowerLimit, double inverterEfficiency, double azimuthAngle, double tiltAngle) {
this.latitude = latitude;
this.longitude = longitude;
this.cellsMaxPower = cellsMaxPower;
this.cellsArea = cellsArea;
this.cellsEfficiency = cellsEfficiency / 100;
this.diffuseEfficiency = diffuseEfficiency / 100;
this.converterPowerLimit = converterPowerLimit;
this.converterEfficiency = converterEfficiency / 100;
this.inverterPowerLimit = inverterPowerLimit;
this.inverterEfficiency = inverterEfficiency / 100;
this.azimuthAngle = azimuthAngle;
this.elevationAngle = elevationAngle;
this.tiltAngle = tiltAngle;
}
@ -48,7 +48,7 @@ public class SolarPowerPlant {
double solarElevation = 90 - position.getZenithAngle();
Double[] directionSun = {Math.sin(solarAzimuth / 180 * Math.PI) * Math.cos(solarElevation / 180 * Math.PI), Math.cos(solarAzimuth / 180 * Math.PI) * Math.cos(solarElevation / 180 * Math.PI), Math.sin(solarElevation / 180 * Math.PI)};
Double[] normalPanel = {Math.sin(azimuthAngle / 180 * Math.PI) * Math.cos((90 - elevationAngle) / 180 * Math.PI), Math.cos(azimuthAngle / 180 * Math.PI) * Math.cos((90 - elevationAngle) / 180 * Math.PI), Math.sin((90 - elevationAngle) / 180 * Math.PI)};
Double[] normalPanel = {Math.sin(azimuthAngle / 180 * Math.PI) * Math.cos((90 - tiltAngle) / 180 * Math.PI), Math.cos(azimuthAngle / 180 * Math.PI) * Math.cos((90 - tiltAngle) / 180 * Math.PI), Math.sin((90 - tiltAngle) / 180 * Math.PI)};
double efficiency = 0; //calculate scalar product of sunDirection and normalPanel vectors
for (int j = 0; j < directionSun.length; j++) {
@ -61,7 +61,7 @@ public class SolarPowerPlant {
double dcPower = (solarPowerNormal * efficiency + solarPowerDiffuse * diffuseEfficiency )* cellsEfficiency * cellsArea;
double acPower = Math.min(dcPower * converterEfficiency, converterPowerLimit);
double acPower = Math.min(dcPower * inverterEfficiency, inverterPowerLimit);
return (float) acPower;
}

View file

@ -122,26 +122,26 @@ public class ManageLocationsActivity extends NavigationActivity {
EditText editLongitude = (EditText) dialogView.findViewById(R.id.EditLocation_Lon);
EditText editCity = (EditText) dialogView.findViewById(R.id.EditLocation_Name);
EditText editAzimuth = (EditText) dialogView.findViewById(R.id.EditLocation_Azimuth);
EditText editElevation = (EditText) dialogView.findViewById(R.id.EditLocation_Elevation);
EditText editTilt = (EditText) dialogView.findViewById(R.id.EditLocation_Tilt);
EditText editCellsMaxPower = (EditText) dialogView.findViewById(R.id.EditLocation_Cell_Max_Power);
EditText editCellsArea = (EditText) dialogView.findViewById(R.id.EditLocation_Cells_Area);
EditText editCellsEfficiency = (EditText) dialogView.findViewById(R.id.EditLocation_Cell_Efficiency);
EditText editDiffuseEfficiency = (EditText) dialogView.findViewById(R.id.EditLocation_Diffuse_Efficiency);
EditText editConverterPowerLimit = (EditText) dialogView.findViewById(R.id.EditLocation_Converter_Power_Limit);
EditText editConverterEfficiency = (EditText) dialogView.findViewById(R.id.EditLocation_Converter_Efficiency);
EditText editInverterPowerLimit = (EditText) dialogView.findViewById(R.id.EditLocation_Inverter_Power_Limit);
EditText editInverterEfficiency = (EditText) dialogView.findViewById(R.id.EditLocation_Inverter_Efficiency);
editCity.setText(city.getCityName());
editLatitude.setText(Float.toString(city.getLatitude()));
editLongitude.setText(Float.toString(city.getLongitude()));
editAzimuth.setText(Float.toString(city.getAzimuthAngle()));
editElevation.setText(Float.toString(city.getElevationAngle()));
editTilt.setText(Float.toString(city.getTiltAngle()));
editCellsMaxPower.setText(Float.toString(city.getCellsMaxPower()));
editCellsArea.setText(Float.toString(city.getCellsArea()));
editCellsEfficiency.setText(Float.toString(city.getCellsEfficiency()));
editDiffuseEfficiency.setText(Float.toString(city.getDiffuseEfficiency()));
editConverterPowerLimit.setText(Float.toString(city.getConverterPowerLimit()));
editConverterEfficiency.setText(Float.toString(city.getConverterEfficiency()));
editElevation.addTextChangedListener(new TextWatcher() {
editInverterPowerLimit.setText(Float.toString(city.getInverterPowerLimit()));
editInverterEfficiency.setText(Float.toString(city.getInverterEfficiency()));
editTilt.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
@Override
@ -149,8 +149,8 @@ public class ManageLocationsActivity extends NavigationActivity {
@Override
public void afterTextChanged(Editable editable) {
float elevation = Float.parseFloat("0"+editElevation.getText().toString());
int diffuseEfficiency = (int) (100-50 * elevation/90);
float tilt = Float.parseFloat("0"+editTilt.getText().toString());
int diffuseEfficiency = (int) (100-50 * tilt/90);
editDiffuseEfficiency.setText(Float.toString((float) diffuseEfficiency));
}
});
@ -160,13 +160,13 @@ public class ManageLocationsActivity extends NavigationActivity {
Float.parseFloat("0"+editLatitude.getText().toString()),
Float.parseFloat("0"+editLongitude.getText().toString()),
Float.parseFloat("0"+editAzimuth.getText().toString()),
Float.parseFloat("0"+editElevation.getText().toString()),
Float.parseFloat("0"+editTilt.getText().toString()),
Float.parseFloat("0"+editCellsMaxPower.getText().toString()),
Float.parseFloat("0"+editCellsArea.getText().toString()),
Float.parseFloat("0"+editCellsEfficiency.getText().toString()),
Float.parseFloat("0"+editDiffuseEfficiency.getText().toString()),
Float.parseFloat("0"+editConverterPowerLimit.getText().toString()),
Float.parseFloat("0"+editConverterEfficiency.getText().toString())
Float.parseFloat("0"+editInverterPowerLimit.getText().toString()),
Float.parseFloat("0"+editInverterEfficiency.getText().toString())
);
});
alert.setNegativeButton(getString(R.string.dialog_add_close_button), (dialog, whichButton) -> {

View file

@ -16,10 +16,10 @@ public class CityToWatch {
private float cellsArea;
private float cellsEfficiency;
private float diffuseEfficiency;
private float converterPowerLimit;
private float converterEfficiency;
private float inverterPowerLimit;
private float inverterEfficiency;
private float azimuthAngle;
private float elevationAngle;
private float tiltAngle;
private int rank;
public CityToWatch() {
@ -36,10 +36,10 @@ public class CityToWatch {
this.cellsArea=3.18f;
this.cellsEfficiency=19.3f;
this.diffuseEfficiency=40;
this.converterPowerLimit=600;
this.converterEfficiency=95;
this.inverterPowerLimit =600;
this.inverterEfficiency =95;
this.azimuthAngle=170;
this.elevationAngle=90;
this.tiltAngle =90;
}
@ -103,16 +103,16 @@ public class CityToWatch {
return diffuseEfficiency;
}
public float getConverterEfficiency() {
return converterEfficiency;
public float getInverterEfficiency() {
return inverterEfficiency;
}
public float getConverterPowerLimit() {
return converterPowerLimit;
public float getInverterPowerLimit() {
return inverterPowerLimit;
}
public float getElevationAngle() {
return elevationAngle;
public float getTiltAngle() {
return tiltAngle;
}
public void setCellsMaxPower(float cellsMaxPower) {
@ -131,19 +131,19 @@ public class CityToWatch {
this.cellsEfficiency = cellsEfficiency;
}
public void setConverterEfficiency(float converterEfficiency) {
this.converterEfficiency = converterEfficiency;
public void setInverterEfficiency(float inverterEfficiency) {
this.inverterEfficiency = inverterEfficiency;
}
public void setConverterPowerLimit(float converterPowerLimit) {
this.converterPowerLimit = converterPowerLimit;
public void setInverterPowerLimit(float inverterPowerLimit) {
this.inverterPowerLimit = inverterPowerLimit;
}
public void setDiffuseEfficiency(float diffuseEfficiency) {
this.diffuseEfficiency = diffuseEfficiency;
}
public void setElevationAngle(float elevationAngle) {
this.elevationAngle = elevationAngle;
public void setTiltAngle(float tiltAngle) {
this.tiltAngle = tiltAngle;
}
}

View file

@ -47,10 +47,10 @@ public class SQLiteHelper extends SQLiteOpenHelper {
private static final String CITIES_TO_WATCH_CELLS_AREA = "cells_area";
private static final String CITIES_TO_WATCH_CELLS_EFFICIENCY = "cells_efficiency";
private static final String CITIES_TO_WATCH_DIFFUSE_EFFICIENCY = "diffuse_efficiency";
private static final String CITIES_TO_WATCH_CONVERTER_POWER_LIMIT = "converter_power_limit";
private static final String CITIES_TO_WATCH_CONVERTER_EFFICIENCY = "converter_efficiency";
private static final String CITIES_TO_WATCH_INVERTER_POWER_LIMIT = "inverter_power_limit";
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_ELEVATION_ANGLE = "elevation_angle";
private static final String CITIES_TO_WATCH_TILT_ANGLE = "tilt_angle";
//Names of columns in TABLE_FORECAST
private static final String FORECAST_ID = "forecast_id";
@ -128,10 +128,10 @@ public class SQLiteHelper extends SQLiteOpenHelper {
CITIES_TO_WATCH_CELLS_AREA + " REAL NOT NULL," +
CITIES_TO_WATCH_CELLS_EFFICIENCY + " REAL NOT NULL," +
CITIES_TO_WATCH_DIFFUSE_EFFICIENCY + " REAL NOT NULL," +
CITIES_TO_WATCH_CONVERTER_POWER_LIMIT + " REAL NOT NULL," +
CITIES_TO_WATCH_CONVERTER_EFFICIENCY + " REAL NOT NULL," +
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_ELEVATION_ANGLE + " REAL NOT NULL)";
CITIES_TO_WATCH_TILT_ANGLE + " REAL NOT NULL)";
public static SQLiteHelper getInstance(Context context) {
if (instance == null && context != null) {
@ -175,10 +175,10 @@ public class SQLiteHelper extends SQLiteOpenHelper {
values.put(CITIES_TO_WATCH_CELLS_AREA,city.getCellsArea());
values.put(CITIES_TO_WATCH_CELLS_EFFICIENCY,city.getCellsEfficiency());
values.put(CITIES_TO_WATCH_DIFFUSE_EFFICIENCY,city.getDiffuseEfficiency());
values.put(CITIES_TO_WATCH_CONVERTER_POWER_LIMIT,city.getConverterPowerLimit());
values.put(CITIES_TO_WATCH_CONVERTER_EFFICIENCY,city.getConverterEfficiency());
values.put(CITIES_TO_WATCH_INVERTER_POWER_LIMIT,city.getInverterPowerLimit());
values.put(CITIES_TO_WATCH_INVERTER_EFFICIENCY,city.getInverterEfficiency());
values.put(CITIES_TO_WATCH_AZIMUTH_ANGLE,city.getAzimuthAngle());
values.put(CITIES_TO_WATCH_ELEVATION_ANGLE,city.getElevationAngle());
values.put(CITIES_TO_WATCH_TILT_ANGLE,city.getTiltAngle());
long id=database.insert(TABLE_CITIES_TO_WATCH, null, values);
@ -206,10 +206,10 @@ public class SQLiteHelper extends SQLiteOpenHelper {
", " + CITIES_TO_WATCH_CELLS_AREA +
", " + CITIES_TO_WATCH_CELLS_EFFICIENCY +
", " + CITIES_TO_WATCH_DIFFUSE_EFFICIENCY +
", " + CITIES_TO_WATCH_CONVERTER_POWER_LIMIT +
", " + CITIES_TO_WATCH_CONVERTER_EFFICIENCY +
", " + CITIES_TO_WATCH_INVERTER_POWER_LIMIT +
", " + CITIES_TO_WATCH_INVERTER_EFFICIENCY +
", " + CITIES_TO_WATCH_AZIMUTH_ANGLE +
", " + CITIES_TO_WATCH_ELEVATION_ANGLE +
", " + CITIES_TO_WATCH_TILT_ANGLE +
", " + CITIES_TO_WATCH_COLUMN_RANK +
" FROM " + TABLE_CITIES_TO_WATCH +
" WHERE " + CITIES_TO_WATCH_CITY_ID + " = ?", arguments);
@ -226,10 +226,10 @@ public class SQLiteHelper extends SQLiteOpenHelper {
cityToWatch.setCellsArea(Float.parseFloat(cursor.getString(6)));
cityToWatch.setCellsEfficiency(Float.parseFloat(cursor.getString(7)));
cityToWatch.setDiffuseEfficiency(Float.parseFloat(cursor.getString(8)));
cityToWatch.setConverterPowerLimit(Float.parseFloat(cursor.getString(9)));
cityToWatch.setConverterEfficiency(Float.parseFloat(cursor.getString(10)));
cityToWatch.setInverterPowerLimit(Float.parseFloat(cursor.getString(9)));
cityToWatch.setInverterEfficiency(Float.parseFloat(cursor.getString(10)));
cityToWatch.setAzimuthAngle(Float.parseFloat(cursor.getString(11)));
cityToWatch.setElevationAngle(Float.parseFloat(cursor.getString(12)));
cityToWatch.setTiltAngle(Float.parseFloat(cursor.getString(12)));
cityToWatch.setRank(Integer.parseInt(cursor.getString(13)));
cursor.close();
@ -255,10 +255,10 @@ public class SQLiteHelper extends SQLiteOpenHelper {
", " + CITIES_TO_WATCH_CELLS_AREA +
", " + CITIES_TO_WATCH_CELLS_EFFICIENCY +
", " + CITIES_TO_WATCH_DIFFUSE_EFFICIENCY +
", " + CITIES_TO_WATCH_CONVERTER_POWER_LIMIT +
", " + CITIES_TO_WATCH_CONVERTER_EFFICIENCY +
", " + CITIES_TO_WATCH_INVERTER_POWER_LIMIT +
", " + CITIES_TO_WATCH_INVERTER_EFFICIENCY +
", " + CITIES_TO_WATCH_AZIMUTH_ANGLE +
", " + CITIES_TO_WATCH_ELEVATION_ANGLE +
", " + CITIES_TO_WATCH_TILT_ANGLE +
", " + CITIES_TO_WATCH_COLUMN_RANK +
" FROM " + TABLE_CITIES_TO_WATCH
, new String[]{});
@ -277,10 +277,10 @@ public class SQLiteHelper extends SQLiteOpenHelper {
cityToWatch.setCellsArea(Float.parseFloat(cursor.getString(6)));
cityToWatch.setCellsEfficiency(Float.parseFloat(cursor.getString(7)));
cityToWatch.setDiffuseEfficiency(Float.parseFloat(cursor.getString(8)));
cityToWatch.setConverterPowerLimit(Float.parseFloat(cursor.getString(9)));
cityToWatch.setConverterEfficiency(Float.parseFloat(cursor.getString(10)));
cityToWatch.setInverterPowerLimit(Float.parseFloat(cursor.getString(9)));
cityToWatch.setInverterEfficiency(Float.parseFloat(cursor.getString(10)));
cityToWatch.setAzimuthAngle(Float.parseFloat(cursor.getString(11)));
cityToWatch.setElevationAngle(Float.parseFloat(cursor.getString(12)));
cityToWatch.setTiltAngle(Float.parseFloat(cursor.getString(12)));
cityToWatch.setRank(Integer.parseInt(cursor.getString(13)));
cityToWatchList.add(cityToWatch);
@ -305,10 +305,10 @@ public class SQLiteHelper extends SQLiteOpenHelper {
values.put(CITIES_TO_WATCH_CELLS_AREA,cityToWatch.getCellsArea());
values.put(CITIES_TO_WATCH_CELLS_EFFICIENCY,cityToWatch.getCellsEfficiency());
values.put(CITIES_TO_WATCH_DIFFUSE_EFFICIENCY,cityToWatch.getDiffuseEfficiency());
values.put(CITIES_TO_WATCH_CONVERTER_POWER_LIMIT,cityToWatch.getConverterPowerLimit());
values.put(CITIES_TO_WATCH_CONVERTER_EFFICIENCY,cityToWatch.getConverterEfficiency());
values.put(CITIES_TO_WATCH_INVERTER_POWER_LIMIT,cityToWatch.getInverterPowerLimit());
values.put(CITIES_TO_WATCH_INVERTER_EFFICIENCY,cityToWatch.getInverterEfficiency());
values.put(CITIES_TO_WATCH_AZIMUTH_ANGLE,cityToWatch.getAzimuthAngle());
values.put(CITIES_TO_WATCH_ELEVATION_ANGLE,cityToWatch.getElevationAngle());
values.put(CITIES_TO_WATCH_TILT_ANGLE,cityToWatch.getTiltAngle());
database.update(TABLE_CITIES_TO_WATCH, values, CITIES_TO_WATCH_ID + " = ?",
new String[]{String.valueOf(cityToWatch.getId())});

View file

@ -40,105 +40,6 @@ public class AppPreferencesManager {
return result;
}
/**
* This method converts a given temperature value into the unit that was set in the preferences.
*
* @param temperature The temperature to convert into the unit that is set in the preferences.
* Make sure to pass a value in celsius.
* @return Returns the converted temperature.
**
*/
public float convertTemperatureFromCelsius(float temperature) {
// 1 = Celsius (fallback), 2 = Fahrenheit
int prefValue = Integer.parseInt(preferences.getString("temperatureUnit", "1"));
if (prefValue == 1) {
return temperature;
} else {
return (((temperature * 9) / 5) + 32);
}
}
/**
* This method converts a given distance value into the unit that was set in the preferences.
*
* @param kilometers The kilometers to convert into the unit that is set in the preferences.
* Make sure to pass a value in kilometers.
* @return Returns the converted distance.
*/
public float convertDistanceFromKilometers(float kilometers) {
// 1 = kilometers, 2 = miles
int prefValue = Integer.parseInt(preferences.getString("distanceUnit", "1"));
if (prefValue == 1) {
return kilometers;
} else {
return convertKmInMiles(kilometers);
}
}
/**
* @return Returns true if kilometers was set as distance unit in the preferences else false.
*/
public boolean isDistanceUnitKilometers() {
int prefValue = Integer.parseInt(preferences.getString("distanceUnit", "0"));
return (prefValue == 1);
}
/**
* @return Returns true if miles was set as distance unit in the preferences else false.
*/
public boolean isDistanceUnitMiles() {
int prefValue = Integer.parseInt(preferences.getString("distanceUnit", "0"));
return (prefValue == 2);
}
/**
* Converts a kilometer value in miles.
*
* @param km The value to convert to miles.
* @return Returns the converted value.
*/
public float convertKmInMiles(float km) {
// TODO: Is this the right class for the function???
return (float) (km / 1.609344);
}
/**
* Converts a miles value in kilometers.
*
* @param miles The value to convert to kilometers.
* @return Returns the converted value.
*/
public float convertMilesInKm(float miles) {
// TODO: Is this the right class for the function???
return (float) (miles * 1.609344);
}
/**
* @return Returns "°C" in case Celsius is set and "°F" if Fahrenheit was selected.
*/
public String getTemperatureUnit() {
int prefValue = Integer.parseInt(preferences.getString("temperatureUnit", "1"));
if (prefValue == 1) {
return "°C";
} else {
return "°F";
}
}
/**
* @return Returns "km" in case kilometer is set and "mi" if miles was selected.
* @param applicationContext
*/
public String getDistanceUnit(Context applicationContext) {
int prefValue = Integer.parseInt(preferences.getString("distanceUnit", "1"));
if (prefValue == 1) {
return applicationContext.getString(R.string.units_km);
} else {
return "mi";
}
}
public boolean showStarDialog(Context context) {
int versionCode = preferences.getInt("versionCode",BuildConfig.VERSION_CODE);
boolean askForStar=preferences.getBoolean("askForStar",true);

View file

@ -18,14 +18,14 @@ public class ItemViewHolder extends RecyclerView.ViewHolder {
* Member variables
*/
public TextView cityName;
public TextView elevationAngle;
public TextView tiltAngle;
public TextView azimuthAngle;
public TextView cellsMaxPower;
public TextView cellsArea;
public TextView cellsEfficiency;
public TextView diffuseEfficiency;
public TextView converterPowerLimit;
public TextView converterEfficiency;
public TextView inverterPowerLimit;
public TextView inverterEfficiency;
/**
@ -36,14 +36,14 @@ public class ItemViewHolder extends RecyclerView.ViewHolder {
public ItemViewHolder(View itemView) {
super(itemView);
this.cityName = (TextView) itemView.findViewById(R.id.city_overview_list_item_text);
this.elevationAngle = (TextView) itemView.findViewById(R.id.city_elevation_angle);
this.tiltAngle = (TextView) itemView.findViewById(R.id.city_tilt_angle);
this.azimuthAngle = (TextView) itemView.findViewById(R.id.city_azimuth_angle);
this.cellsMaxPower = (TextView) itemView.findViewById(R.id.city_cells_max_power);
this.cellsArea = (TextView) itemView.findViewById(R.id.city_cells_area);
this.cellsEfficiency = (TextView) itemView.findViewById(R.id.city_cells_efficiency);
this.diffuseEfficiency = (TextView) itemView.findViewById(R.id.city_diffuse_efficiency);
this.converterPowerLimit = (TextView) itemView.findViewById(R.id.city_converter_power_limit);
this.converterEfficiency = (TextView) itemView.findViewById(R.id.city_converter_efficiency);
this.inverterPowerLimit = (TextView) itemView.findViewById(R.id.city_inverter_power_limit);
this.inverterEfficiency = (TextView) itemView.findViewById(R.id.city_inverter_efficiency);
}

View file

@ -2,15 +2,11 @@ package org.woheller69.weather.ui.RecycleList;
import android.content.Context;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import org.woheller69.weather.R;
import org.woheller69.weather.database.CityToWatch;
@ -64,13 +60,13 @@ public class RecyclerOverviewListAdapter extends RecyclerView.Adapter<ItemViewHo
public void onBindViewHolder(ItemViewHolder holder, int position) {
holder.cityName.setText(cities.get(position).getCityName());
holder.azimuthAngle.setText(context.getString(R.string.edit_location_hint_azimuth) +": "+ cities.get(position).getAzimuthAngle());
holder.elevationAngle.setText(context.getString(R.string.edit_location_hint_elevation) +": "+ cities.get(position).getElevationAngle());
holder.tiltAngle.setText(context.getString(R.string.edit_location_hint_tilt) +": "+ cities.get(position).getTiltAngle());
holder.cellsMaxPower.setText(context.getString(R.string.edit_location_hint_cells_max_power) +": "+ cities.get(position).getCellsMaxPower());
holder.cellsEfficiency.setText(context.getString(R.string.edit_location_hint_cells_efficiency) +": "+ cities.get(position).getCellsEfficiency());
holder.cellsArea.setText(context.getString(R.string.edit_location_hint_cells_area) +": "+ cities.get(position).getCellsArea());
holder.diffuseEfficiency.setText(context.getString(R.string.edit_location_hint_diffuse_efficiency) +": "+ cities.get(position).getDiffuseEfficiency());
holder.converterPowerLimit.setText(context.getString(R.string.edit_location_hint_converter_power_limit) +": "+ cities.get(position).getConverterPowerLimit());
holder.converterEfficiency.setText(context.getString(R.string.edit_location_hint_converter_efficiency) +": "+ cities.get(position).getConverterEfficiency());
holder.inverterPowerLimit.setText(context.getString(R.string.edit_location_hint_inverter_power_limit) +": "+ cities.get(position).getInverterPowerLimit());
holder.inverterEfficiency.setText(context.getString(R.string.edit_location_hint_inverter_efficiency) +": "+ cities.get(position).getInverterEfficiency());
}
@ -118,18 +114,18 @@ public class RecyclerOverviewListAdapter extends RecyclerView.Adapter<ItemViewHo
public CityToWatch getCitytoWatch(int position){
return cities.get(position);
}
public void updateCity(CityToWatch cityToWatch, String cityName, float latitude, float longitude, float azimuth, float elevation, float cellsMaxPower, float cellsArea, float cellsEfficiency, float diffuseEfficiency, float converterPowerLimit, float converterEfficiency) {
public void updateCity(CityToWatch cityToWatch, String cityName, float latitude, float longitude, float azimuth, float tilt, float cellsMaxPower, float cellsArea, float cellsEfficiency, float diffuseEfficiency, float inverterPowerLimit, float inverterEfficiency) {
cityToWatch.setCityName(cityName);
cityToWatch.setLatitude(latitude);
cityToWatch.setLongitude(longitude);
cityToWatch.setAzimuthAngle(azimuth);
cityToWatch.setElevationAngle(elevation);
cityToWatch.setTiltAngle(tilt);
cityToWatch.setCellsMaxPower(cellsMaxPower);
cityToWatch.setCellsArea(cellsArea);
cityToWatch.setCellsEfficiency(cellsEfficiency);
cityToWatch.setDiffuseEfficiency(diffuseEfficiency);
cityToWatch.setConverterPowerLimit(converterPowerLimit);
cityToWatch.setConverterEfficiency(converterEfficiency);
cityToWatch.setInverterPowerLimit(inverterPowerLimit);
cityToWatch.setInverterEfficiency(inverterEfficiency);
database.updateCityToWatch(cityToWatch);
notifyDataSetChanged();
}

View file

@ -10,7 +10,6 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.woheller69.weather.SolarPowerPlant;
import org.woheller69.weather.database.CityToWatch;
import org.woheller69.weather.database.GeneralData;
import org.woheller69.weather.database.HourlyForecast;
import org.woheller69.weather.database.SQLiteHelper;
import org.woheller69.weather.database.WeekForecast;
@ -78,7 +77,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.getDiffuseEfficiency(), city.getConverterPowerLimit(), city.getConverterEfficiency(), city.getAzimuthAngle(), city.getElevationAngle());
SolarPowerPlant spp = new SolarPowerPlant(city.getLatitude(), city.getLongitude(), city.getCellsMaxPower(), city.getCellsArea(), city.getCellsEfficiency(),city.getDiffuseEfficiency(), city.getInverterPowerLimit(), city.getInverterEfficiency(), city.getAzimuthAngle(), city.getTiltAngle());
IApiToDatabaseConversion conversion = new OMToDatabaseConversion();

View file

@ -54,13 +54,13 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/edit_location_hint_elevation"/>
android:hint="@string/edit_location_hint_tilt"/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/EditLocation_Elevation"
android:id="@+id/EditLocation_Tilt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal|numberSigned"
android:hint="@string/edit_location_hint_elevation"/>
android:hint="@string/edit_location_hint_tilt"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -104,22 +104,22 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/edit_location_hint_converter_power_limit"/>
android:hint="@string/edit_location_hint_inverter_power_limit"/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/EditLocation_Converter_Power_Limit"
android:id="@+id/EditLocation_Inverter_Power_Limit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal|numberSigned"
android:hint="@string/edit_location_hint_converter_power_limit"/>
android:hint="@string/edit_location_hint_inverter_power_limit"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/edit_location_hint_converter_efficiency"/>
android:hint="@string/edit_location_hint_inverter_efficiency"/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/EditLocation_Converter_Efficiency"
android:id="@+id/EditLocation_Inverter_Efficiency"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal|numberSigned"
android:hint="@string/edit_location_hint_converter_efficiency"/>
android:hint="@string/edit_location_hint_inverter_efficiency"/>
</LinearLayout>
</ScrollView>

View file

@ -54,11 +54,11 @@
tools:visibility="visible" />
<TextView
android:id="@+id/city_elevation_angle"
android:id="@+id/city_tilt_angle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/edit_location_hint_elevation"
android:text="@string/edit_location_hint_tilt"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
tools:visibility="visible" />
@ -100,20 +100,20 @@
tools:visibility="visible" />
<TextView
android:id="@+id/city_converter_power_limit"
android:id="@+id/city_inverter_power_limit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/edit_location_hint_converter_power_limit"
android:text="@string/edit_location_hint_inverter_power_limit"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
tools:visibility="visible" />
<TextView
android:id="@+id/city_converter_efficiency"
android:id="@+id/city_inverter_efficiency"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/edit_location_hint_converter_efficiency"
android:text="@string/edit_location_hint_inverter_efficiency"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
tools:visibility="visible" />

View file

@ -117,13 +117,13 @@
<string name="edit_location_hint_latitude">Breitengrad [°]</string>
<string name="edit_location_hint_longitude">Längengrad [°]</string>
<string name="edit_location_hint_azimuth">Azimuth [°]</string>
<string name="edit_location_hint_elevation">Neigung [°]</string>
<string name="edit_location_hint_tilt">Neigung [°]</string>
<string name="edit_location_hint_cells_max_power">Maximalleistung Zelle [W]</string>
<string name="edit_location_hint_cells_efficiency">Wirkungsgrad Zelle [%]</string>
<string name="edit_location_hint_cells_area">Fläche Zelle [m\u00b2]</string>
<string name="edit_location_hint_diffuse_efficiency">Effizienz diffuse Strahlung [%]</string>
<string name="edit_location_hint_converter_power_limit">Leistung Wechselrichter [W]</string>
<string name="edit_location_hint_converter_efficiency">Effizienz Wechselrichter [%]</string>
<string name="edit_location_hint_inverter_power_limit">Leistung Wechselrichter [W]</string>
<string name="edit_location_hint_inverter_efficiency">Effizienz Wechselrichter [%]</string>
<string name="units_Wh">Wh</string>
<string name="edit_location_title">Ort bearbeiten</string>

View file

@ -119,13 +119,13 @@
<string name="edit_location_hint_latitude">Latitude [°]</string>
<string name="edit_location_hint_longitude">Longitude [°]</string>
<string name="edit_location_hint_azimuth">Azimuth [°]</string>
<string name="edit_location_hint_elevation">Elevation [°]</string>
<string name="edit_location_hint_tilt">Tilt [°]</string>
<string name="edit_location_hint_cells_max_power">Cells max power [W]</string>
<string name="edit_location_hint_cells_efficiency">Cells efficiency [%]</string>
<string name="edit_location_hint_cells_area">Cell area [m\u00b2]</string>
<string name="edit_location_hint_diffuse_efficiency">Diffuse radiation efficiency [%]</string>
<string name="edit_location_hint_converter_power_limit">Converter power [W]</string>
<string name="edit_location_hint_converter_efficiency">Converter efficiency [%]</string>
<string name="edit_location_hint_inverter_power_limit">Inverter power [W]</string>
<string name="edit_location_hint_inverter_efficiency">Inverter efficiency [%]</string>
<string name="units_Wh">Wh</string>
<string name="edit_location_title">Edit location</string>
</resources>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Before After
Before After