refactor calcDiffuseEfficiency to SolarPowerPlant.java

This commit is contained in:
woheller69 2023-06-15 14:07:19 +02:00
parent 23caf89c8e
commit 1a05a6348d
2 changed files with 6 additions and 1 deletions

View file

@ -89,6 +89,10 @@ public class SolarPowerPlant {
return (float) acPower;
}
public static int calcDiffuseEfficiency(float tilt){
return (int) ( 50 + 50* Math.cos(tilt/180*Math.PI));
}
public static double calcCellTemperature(double ambientTemperature, double totalIrradiance){
//models from here: https://www.scielo.br/j/babt/a/FBq5Pmm4gSFqsfh3V8MxfGN/ Photovoltaic Cell Temperature Estimation for a Grid-Connect Photovoltaic Systems in Curitiba
//float cellTemperature = 30.006f + 0.0175f*(totalIrradiance-300f)+1.14f*(ambientTemperature-25f); //Lasnier and Ang Lasnier, F.; Ang, T. G. Photovoltaic engineering handbook, 1st ed.; IOP Publishing LTD: Lasnier, France, 1990; pp. 258.

View file

@ -24,6 +24,7 @@ import android.widget.TextView;
import android.widget.Toast;
import org.woheller69.weather.R;
import org.woheller69.weather.SolarPowerPlant;
import org.woheller69.weather.database.City;
import org.woheller69.weather.database.CityToWatch;
import org.woheller69.weather.database.SQLiteHelper;
@ -240,7 +241,7 @@ public class ManageLocationsActivity extends NavigationActivity {
@Override
public void afterTextChanged(Editable editable) {
float tilt = Float.parseFloat(!editTilt.getText().toString().isEmpty() ? editTilt.getText().toString() : "0");
int diffuseEfficiency = (int) ( 50 + 50* Math.cos(tilt/180*Math.PI));
int diffuseEfficiency = SolarPowerPlant.calcDiffuseEfficiency(tilt);
editDiffuseEfficiency.setText(Float.toString((float) diffuseEfficiency));
}
});