change some stuff from float to double

This commit is contained in:
woheller69 2023-04-13 17:11:29 +02:00
parent a1f14681fd
commit f1a79e41e1
3 changed files with 14 additions and 14 deletions

View file

@ -40,7 +40,7 @@ public class SolarPowerPlant {
}
public float getPower(double solarPowerNormal, double solarPowerDiffuse, long epochTimeSeconds, float ambientTemperature) {
public float getPower(double solarPowerNormal, double solarPowerDiffuse, long epochTimeSeconds, double ambientTemperature) {
Instant i = Instant.ofEpochSecond(epochTimeSeconds); //currentTimeMillis is in GMT
ZonedDateTime dateTime = ZonedDateTime.ofInstant(i, ZoneId.of("GMT"));
@ -73,8 +73,8 @@ public class SolarPowerPlant {
}
}
float totalRadiationOnCell = (float) (solarPowerNormal * efficiency + solarPowerDiffuse * diffuseEfficiency); //flat plate equivalent of the solar irradiance
float cellTemperature = calcCellTemperature(ambientTemperature,totalRadiationOnCell);
double totalRadiationOnCell = solarPowerNormal * efficiency + solarPowerDiffuse * diffuseEfficiency; //flat plate equivalent of the solar irradiance
double cellTemperature = calcCellTemperature(ambientTemperature,totalRadiationOnCell);
double dcPower = totalRadiationOnCell * cellsEfficiency * (1+(cellTemperature - 25)*cellsTempCoeff) * cellsArea;
@ -83,11 +83,11 @@ public class SolarPowerPlant {
return (float) acPower;
}
public static float calcCellTemperature(float ambientTemperature, float totalIrradiance){
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.
//float cellTemperature = ambientTemperature + 0.028f*totalIrradiance-1f; //Schott Schott, T. Operation temperatures of PV modules. Photovoltaic solar energy conference 1985, pp. 392-396.
float cellTemperature = ambientTemperature + 0.0342f*totalIrradiance; //Ross model: https://www.researchgate.net/publication/275438802_Thermal_effects_of_the_extended_holographic_regions_for_holographic_planar_concentrator
double cellTemperature = ambientTemperature + 0.0342f*totalIrradiance; //Ross model: https://www.researchgate.net/publication/275438802_Thermal_effects_of_the_extended_holographic_regions_for_holographic_planar_concentrator
//assuming "not so well cooled" : 0.0342
return cellTemperature;
}

View file

@ -37,15 +37,15 @@ public class CityToWatch {
this.id = id;
this.cityId = cityId;
this.cityName = cityName;
this.cellsMaxPower = 650;
this.cellsMaxPower = 650.0f;
this.cellsArea = 3.18f;
this.cellsEfficiency = 19.3f;
this.cellsTempCoeff = -0.4f;
this.diffuseEfficiency = 40;
this.inverterPowerLimit = 600;
this.inverterEfficiency = 95;
this.azimuthAngle = 170;
this.tiltAngle = 90;
this.diffuseEfficiency = 40.0f;
this.inverterPowerLimit = 600.0f;
this.inverterEfficiency = 95.0f;
this.azimuthAngle = 170.0f;
this.tiltAngle = 90.0f;
}

View file

@ -78,12 +78,12 @@ public class OMDataExtractor implements IDataExtractor {
IApiToDatabaseConversion conversion = new OMToDatabaseConversion();
float ambientTemperature = 25;
double ambientTemperature = 25.0;
for (int i = 0; i < timeArray.length(); i++) {
HourlyForecast hourlyForecast = new HourlyForecast();
hourlyForecast.setTimestamp(System.currentTimeMillis() / 1000);
if (timeArray!=null && !timeArray.isNull(i)) hourlyForecast.setForecastTime(timeArray.getLong(i)*1000L);
if (tempArray != null && !tempArray.isNull(i)) ambientTemperature = (float) tempArray.getDouble(i);
if (tempArray != null && !tempArray.isNull(i)) ambientTemperature = tempArray.getDouble(i);
if (weathercodeArray!=null && !weathercodeArray.isNull(i)) hourlyForecast.setWeatherID(conversion.convertWeatherCategory(weathercodeArray.getString(i)));
if (directRadiationArray!=null && !directRadiationArray.isNull(i)) hourlyForecast.setDirectRadiationNormal((float) directRadiationArray.getDouble(i));
if (diffuseRadiationArray!=null && !diffuseRadiationArray.isNull(i)) hourlyForecast.setDiffuseRadiation((float) diffuseRadiationArray.getDouble(i));