|
@@ -15,6 +15,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ufo.base.common.exception.ServiceException;
|
|
import com.ufo.base.common.exception.ServiceException;
|
|
|
import com.ufo.base.common.utils.DateUtils;
|
|
import com.ufo.base.common.utils.DateUtils;
|
|
|
import com.ufo.base.common.utils.DictUtils;
|
|
import com.ufo.base.common.utils.DictUtils;
|
|
@@ -104,11 +107,11 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
double a2 = getPhotometricA2();
|
|
double a2 = getPhotometricA2();
|
|
|
Integer n = station.getInverterQuantity();
|
|
Integer n = station.getInverterQuantity();
|
|
|
|
|
|
|
|
- List<double[]> actual = rawPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
- List<double[]> availability = rawPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
- List<double[]> irr = rawPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
- List<double[]> inclined = rawPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
- List<double[]> temp = rawPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
+ List<double[]> actual = rawDataElectricityLocalPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
+ List<double[]> availability = rawDataElectricityLocalPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
+ List<double[]> irr = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
+ List<double[]> inclined = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
+ List<double[]> temp = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
|
List<TheoreticalPowerRow> rows = new ArrayList<>();
|
|
List<TheoreticalPowerRow> rows = new ArrayList<>();
|
|
|
for (long sec = dayStartEpoch(day); sec < dayStartEpoch(day) + 86400L; sec += freq * 60L)
|
|
for (long sec = dayStartEpoch(day); sec < dayStartEpoch(day) + 86400L; sec += freq * 60L)
|
|
@@ -153,11 +156,11 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
Integer n = station.getInverterQuantity();
|
|
Integer n = station.getInverterQuantity();
|
|
|
|
|
|
|
|
long dayEnd = dayStartEpoch(day) + 86400L;
|
|
long dayEnd = dayStartEpoch(day) + 86400L;
|
|
|
- List<double[]> actual = rawPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
- List<double[]> availability = rawPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
- List<double[]> irr = rawPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
- List<double[]> inclined = rawPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
- List<double[]> temp = rawPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
+ List<double[]> actual = rawDataElectricityLocalPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
+ List<double[]> availability = rawDataElectricityLocalPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
+ List<double[]> irr = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
+ List<double[]> inclined = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
+ List<double[]> temp = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
|
int size = power.size();
|
|
int size = power.size();
|
|
|
double[] photometricSeries = new double[size];
|
|
double[] photometricSeries = new double[size];
|
|
@@ -205,13 +208,14 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
public LatestPowerRow selectLatest(LatestQuery query)
|
|
public LatestPowerRow selectLatest(LatestQuery query)
|
|
|
{
|
|
{
|
|
|
ConfigStation station = loadStation(query.getStationCode());
|
|
ConfigStation station = loadStation(query.getStationCode());
|
|
|
- List<DataElectricityLocal> power = dataElectricityLocalService.selectActualPowerRange(
|
|
|
|
|
- station.getId(), "2000-01-01", "2099-12-31");
|
|
|
|
|
- if (power.isEmpty())
|
|
|
|
|
|
|
+
|
|
|
|
|
+ IPage<DataElectricityLocal> page = dataElectricityLocalService.page(new Page<>(1, 1),
|
|
|
|
|
+ Wrappers.<DataElectricityLocal>lambdaQuery().eq(DataElectricityLocal::getConfigStationId, station.getId()).orderByDesc(DataElectricityLocal::getTm));
|
|
|
|
|
+ if (page.getRecords().isEmpty())
|
|
|
{
|
|
{
|
|
|
throw new ServiceException("该场站暂无数据");
|
|
throw new ServiceException("该场站暂无数据");
|
|
|
}
|
|
}
|
|
|
- DataElectricityLocal last = power.get(power.size() - 1);
|
|
|
|
|
|
|
+ DataElectricityLocal last = page.getRecords().get(0);
|
|
|
long sec = epochSec(last.getTm());
|
|
long sec = epochSec(last.getTm());
|
|
|
String day = DateUtils.parseDateToStr("yyyy-MM-dd", last.getTm());
|
|
String day = DateUtils.parseDateToStr("yyyy-MM-dd", last.getTm());
|
|
|
List<DataWeatherLocal> weather = loadSingleDayWeather(station, day);
|
|
List<DataWeatherLocal> weather = loadSingleDayWeather(station, day);
|
|
@@ -223,9 +227,9 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
double availability = last.getAvailability() == null || last.getAvailability() == 0 ? 100
|
|
double availability = last.getAvailability() == null || last.getAvailability() == 0 ? 100
|
|
|
: last.getAvailability();
|
|
: last.getAvailability();
|
|
|
double photometric = TheoreticalPowerCalc.photometricPower(n, a1, a2,
|
|
double photometric = TheoreticalPowerCalc.photometricPower(n, a1, a2,
|
|
|
- (double) sampleAt(rawPoints(weather, DataWeatherLocal::getIrradiance), sec, 5),
|
|
|
|
|
- (double) sampleAt(rawPoints(weather, DataWeatherLocal::getInclinedIrradiance), sec, 5),
|
|
|
|
|
- (double) sampleAt(rawPoints(weather, DataWeatherLocal::getTemperature), sec, 5));
|
|
|
|
|
|
|
+ (double) sampleAt(rawDataWeatherLocalPoints(weather, DataWeatherLocal::getIrradiance), sec, 5),
|
|
|
|
|
+ (double) sampleAt(rawDataWeatherLocalPoints(weather, DataWeatherLocal::getInclinedIrradiance), sec, 5),
|
|
|
|
|
+ (double) sampleAt(rawDataWeatherLocalPoints(weather, DataWeatherLocal::getTemperature), sec, 5));
|
|
|
|
|
|
|
|
LatestPowerRow row = new LatestPowerRow();
|
|
LatestPowerRow row = new LatestPowerRow();
|
|
|
row.setTime(DATETIME.format(Instant.ofEpochSecond(sec).atOffset(ZONE)));
|
|
row.setTime(DATETIME.format(Instant.ofEpochSecond(sec).atOffset(ZONE)));
|
|
@@ -258,11 +262,11 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
Integer n = station.getInverterQuantity();
|
|
Integer n = station.getInverterQuantity();
|
|
|
|
|
|
|
|
long dayEnd = dayStartEpoch(day) + 86400L;
|
|
long dayEnd = dayStartEpoch(day) + 86400L;
|
|
|
- List<double[]> actual = rawPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
- List<double[]> availability = rawPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
- List<double[]> irr = rawPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
- List<double[]> inclined = rawPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
- List<double[]> temp = rawPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
+ List<double[]> actual = rawDataElectricityLocalPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
+ List<double[]> availability = rawDataElectricityLocalPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
+ List<double[]> irr = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
+ List<double[]> inclined = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
+ List<double[]> temp = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
|
int size = power.size();
|
|
int size = power.size();
|
|
|
double[] intraSeries = new double[size];
|
|
double[] intraSeries = new double[size];
|
|
@@ -317,11 +321,11 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
JSONObject config = loadPowerConfig();
|
|
JSONObject config = loadPowerConfig();
|
|
|
double installed = station.getInstalledCapacity() == null ? 0D : station.getInstalledCapacity().doubleValue();
|
|
double installed = station.getInstalledCapacity() == null ? 0D : station.getInstalledCapacity().doubleValue();
|
|
|
|
|
|
|
|
- List<double[]> actual = rawPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
- List<double[]> availability = rawPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
- List<double[]> irr = rawPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
- List<double[]> inclined = rawPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
- List<double[]> temp = rawPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
+ List<double[]> actual = rawDataElectricityLocalPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
+ List<double[]> availability = rawDataElectricityLocalPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
+ List<double[]> irr = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
+ List<double[]> inclined = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
+ List<double[]> temp = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
|
List<LogicCheckRow> rows = new ArrayList<>();
|
|
List<LogicCheckRow> rows = new ArrayList<>();
|
|
|
for (long sec = dayStartEpoch(day); sec < dayStartEpoch(day) + 86400L; sec += 300L)
|
|
for (long sec = dayStartEpoch(day); sec < dayStartEpoch(day) + 86400L; sec += 300L)
|
|
@@ -370,11 +374,11 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
Integer n = station.getInverterQuantity();
|
|
Integer n = station.getInverterQuantity();
|
|
|
JSONObject config = loadPowerConfig();
|
|
JSONObject config = loadPowerConfig();
|
|
|
|
|
|
|
|
- List<double[]> actual = rawPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
- List<double[]> availability = rawPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
- List<double[]> irr = rawPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
- List<double[]> inclined = rawPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
- List<double[]> temp = rawPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
+ List<double[]> actual = rawDataElectricityLocalPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
+ List<double[]> availability = rawDataElectricityLocalPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
+ List<double[]> irr = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
+ List<double[]> inclined = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
+ List<double[]> temp = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
|
List<OffSiteCheckRow> rows = new ArrayList<>();
|
|
List<OffSiteCheckRow> rows = new ArrayList<>();
|
|
|
for (long sec = dayStartEpoch(day); sec < dayStartEpoch(day) + 86400L; sec += 300L)
|
|
for (long sec = dayStartEpoch(day); sec < dayStartEpoch(day) + 86400L; sec += 300L)
|
|
@@ -419,10 +423,10 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
Integer n = station.getInverterQuantity();
|
|
Integer n = station.getInverterQuantity();
|
|
|
JSONObject config = loadPowerConfig();
|
|
JSONObject config = loadPowerConfig();
|
|
|
|
|
|
|
|
- List<double[]> availability = rawPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
- List<double[]> irr = rawPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
- List<double[]> inclined = rawPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
- List<double[]> temp = rawPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
+ List<double[]> availability = rawDataElectricityLocalPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
+ List<double[]> irr = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
+ List<double[]> inclined = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
+ List<double[]> temp = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
|
List<IntraPlantCheckRow> rows = new ArrayList<>();
|
|
List<IntraPlantCheckRow> rows = new ArrayList<>();
|
|
|
double sumTheoretical = 0;
|
|
double sumTheoretical = 0;
|
|
@@ -664,7 +668,7 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
/**
|
|
/**
|
|
|
* 升序原始点索引(epoch 秒,值;null 值按 0)
|
|
* 升序原始点索引(epoch 秒,值;null 值按 0)
|
|
|
*/
|
|
*/
|
|
|
- private List<double[]> rawPoints(List<DataElectricityLocal> list,
|
|
|
|
|
|
|
+ private List<double[]> rawDataElectricityLocalPoints(List<DataElectricityLocal> list,
|
|
|
java.util.function.Function<DataElectricityLocal, Double> getter)
|
|
java.util.function.Function<DataElectricityLocal, Double> getter)
|
|
|
{
|
|
{
|
|
|
List<double[]> points = new ArrayList<>();
|
|
List<double[]> points = new ArrayList<>();
|
|
@@ -682,7 +686,7 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
/**
|
|
/**
|
|
|
* 升序原始点索引(气象)
|
|
* 升序原始点索引(气象)
|
|
|
*/
|
|
*/
|
|
|
- private List<double[]> rawPoints(List<DataWeatherLocal> list,
|
|
|
|
|
|
|
+ private List<double[]> rawDataWeatherLocalPoints(List<DataWeatherLocal> list,
|
|
|
java.util.function.Function<DataWeatherLocal, Double> getter)
|
|
java.util.function.Function<DataWeatherLocal, Double> getter)
|
|
|
{
|
|
{
|
|
|
List<double[]> points = new ArrayList<>();
|
|
List<double[]> points = new ArrayList<>();
|
|
@@ -942,11 +946,11 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
int[] dayIndex = new int[size];
|
|
int[] dayIndex = new int[size];
|
|
|
double[][] series = new double[5][size];
|
|
double[][] series = new double[5][size];
|
|
|
|
|
|
|
|
- List<double[]> actual = rawPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
- List<double[]> availability = rawPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
- List<double[]> irr = rawPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
- List<double[]> inclined = rawPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
- List<double[]> temp = rawPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
+ List<double[]> actual = rawDataElectricityLocalPoints(power, DataElectricityLocal::getActualPower);
|
|
|
|
|
+ List<double[]> availability = rawDataElectricityLocalPoints(power, DataElectricityLocal::getAvailability);
|
|
|
|
|
+ List<double[]> irr = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getIrradiance);
|
|
|
|
|
+ List<double[]> inclined = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getInclinedIrradiance);
|
|
|
|
|
+ List<double[]> temp = rawDataWeatherLocalPoints(weather, DataWeatherLocal::getTemperature);
|
|
|
|
|
|
|
|
for (int i = 0; i < size; i++)
|
|
for (int i = 0; i < size; i++)
|
|
|
{
|
|
{
|