|
|
@@ -103,8 +103,8 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
int freq = requireFrequency(query.getSamplingFrequency());
|
|
|
List<DataElectricityLocal> power = loadSingleDayPower(station, day);
|
|
|
List<DataWeatherLocal> weather = loadSingleDayWeather(station, day);
|
|
|
- double a1 = getPhotometricA1();
|
|
|
- double a2 = getPhotometricA2();
|
|
|
+ double a1 = getPhotometricA1(station.getStationCode());
|
|
|
+ double a2 = getPhotometricA2(station.getStationCode());
|
|
|
Integer n = station.getInverterQuantity();
|
|
|
|
|
|
List<double[]> actual = rawDataElectricityLocalPoints(power, DataElectricityLocal::getActualPower);
|
|
|
@@ -151,8 +151,8 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
List<DataWeatherLocal> weather = loadSingleDayWeather(station, day);
|
|
|
- double a1 = getPhotometricA1();
|
|
|
- double a2 = getPhotometricA2();
|
|
|
+ double a1 = getPhotometricA1(station.getStationCode());
|
|
|
+ double a2 = getPhotometricA2(station.getStationCode());
|
|
|
Integer n = station.getInverterQuantity();
|
|
|
|
|
|
long dayEnd = dayStartEpoch(day) + 86400L;
|
|
|
@@ -220,8 +220,8 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
String day = DateUtils.parseDateToStr("yyyy-MM-dd", last.getTm());
|
|
|
List<DataWeatherLocal> weather = loadSingleDayWeather(station, day);
|
|
|
|
|
|
- double a1 = getPhotometricA1();
|
|
|
- double a2 = getPhotometricA2();
|
|
|
+ double a1 = getPhotometricA1(station.getStationCode());
|
|
|
+ double a2 = getPhotometricA2(station.getStationCode());
|
|
|
Integer n = station.getInverterQuantity();
|
|
|
double actualPower = last.getActualPower() == null ? 0 : last.getActualPower();
|
|
|
double availability = last.getAvailability() == null || last.getAvailability() == 0 ? 100
|
|
|
@@ -257,8 +257,8 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
List<DataWeatherLocal> weather = loadSingleDayWeather(station, day);
|
|
|
- double a1 = getPhotometricA1();
|
|
|
- double a2 = getPhotometricA2();
|
|
|
+ double a1 = getPhotometricA1(station.getStationCode());
|
|
|
+ double a2 = getPhotometricA2(station.getStationCode());
|
|
|
Integer n = station.getInverterQuantity();
|
|
|
|
|
|
long dayEnd = dayStartEpoch(day) + 86400L;
|
|
|
@@ -315,8 +315,8 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
String day = requireDay(query.getDay());
|
|
|
List<DataElectricityLocal> power = loadSingleDayPower(station, day);
|
|
|
List<DataWeatherLocal> weather = loadSingleDayWeather(station, day);
|
|
|
- double a1 = getPhotometricA1();
|
|
|
- double a2 = getPhotometricA2();
|
|
|
+ double a1 = getPhotometricA1(station.getStationCode());
|
|
|
+ double a2 = getPhotometricA2(station.getStationCode());
|
|
|
Integer n = station.getInverterQuantity();
|
|
|
JSONObject config = loadPowerConfig();
|
|
|
double installed = station.getInstalledCapacity() == null ? 0D : station.getInstalledCapacity().doubleValue();
|
|
|
@@ -369,8 +369,8 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
String day = requireDay(query.getDay());
|
|
|
List<DataElectricityLocal> power = loadSingleDayPower(station, day);
|
|
|
List<DataWeatherLocal> weather = loadSingleDayWeather(station, day);
|
|
|
- double a1 = getPhotometricA1();
|
|
|
- double a2 = getPhotometricA2();
|
|
|
+ double a1 = getPhotometricA1(station.getStationCode());
|
|
|
+ double a2 = getPhotometricA2(station.getStationCode());
|
|
|
Integer n = station.getInverterQuantity();
|
|
|
JSONObject config = loadPowerConfig();
|
|
|
|
|
|
@@ -418,8 +418,8 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
String day = requireDay(query.getDay());
|
|
|
List<DataElectricityLocal> power = loadSingleDayPower(station, day);
|
|
|
List<DataWeatherLocal> weather = loadSingleDayWeather(station, day);
|
|
|
- double a1 = getPhotometricA1();
|
|
|
- double a2 = getPhotometricA2();
|
|
|
+ double a1 = getPhotometricA1(station.getStationCode());
|
|
|
+ double a2 = getPhotometricA2(station.getStationCode());
|
|
|
Integer n = station.getInverterQuantity();
|
|
|
JSONObject config = loadPowerConfig();
|
|
|
|
|
|
@@ -624,29 +624,39 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
/**
|
|
|
* 读取测光法系数 a1(字典 algorithm_config/测光法配置,缺失按 0)
|
|
|
*/
|
|
|
- private double getPhotometricA1()
|
|
|
+ private double getPhotometricA1(String stationCode)
|
|
|
{
|
|
|
String json = DictUtils.getDictValue(DICT_ALGORITHM_CONFIG, DICT_LABEL_PHOTOMETRIC);
|
|
|
if (StringUtils.isEmpty(json))
|
|
|
{
|
|
|
- return 0;
|
|
|
+ throw new ServiceException("测光法配置项algorithm_config不存在");
|
|
|
}
|
|
|
JSONObject obj = JSON.parseObject(json);
|
|
|
- return obj.getDoubleValue("a1");
|
|
|
+ JSONObject stationObj = obj.getJSONObject(stationCode);
|
|
|
+ if (stationObj == null)
|
|
|
+ {
|
|
|
+ throw new ServiceException("测光法配置项a1不存在场站:" + stationCode);
|
|
|
+ }
|
|
|
+ return stationObj.getDoubleValue("a1");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 读取测光法系数 a2(字典 algorithm_config/测光法配置,缺失按 0)
|
|
|
*/
|
|
|
- private double getPhotometricA2()
|
|
|
+ private double getPhotometricA2(String stationCode)
|
|
|
{
|
|
|
String json = DictUtils.getDictValue(DICT_ALGORITHM_CONFIG, DICT_LABEL_PHOTOMETRIC);
|
|
|
if (StringUtils.isEmpty(json))
|
|
|
{
|
|
|
- return 0;
|
|
|
+ throw new ServiceException("测光法配置项algorithm_config不存在");
|
|
|
}
|
|
|
JSONObject obj = JSON.parseObject(json);
|
|
|
- return obj.getDoubleValue("a2");
|
|
|
+ JSONObject stationObj = obj.getJSONObject(stationCode);
|
|
|
+ if (stationObj == null)
|
|
|
+ {
|
|
|
+ throw new ServiceException("测光法配置项a2不存在场站:" + stationCode);
|
|
|
+ }
|
|
|
+ return stationObj.getDoubleValue("a2");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -936,8 +946,8 @@ public class TheoreticalPowerServiceImpl implements ITheoreticalPowerService
|
|
|
String endIsoExcl = days.get(days.size() - 1).plusDays(1).toString() + "T00:00:00+08:00";
|
|
|
List<DataElectricityLocal> power = loadElectricityPaged(station.getId(), startIso, endIsoExcl);
|
|
|
List<DataWeatherLocal> weather = loadWeatherPaged(station.getId(), startIso, endIsoExcl);
|
|
|
- double a1 = getPhotometricA1();
|
|
|
- double a2 = getPhotometricA2();
|
|
|
+ double a1 = getPhotometricA1(station.getStationCode());
|
|
|
+ double a2 = getPhotometricA2(station.getStationCode());
|
|
|
Integer n = station.getInverterQuantity();
|
|
|
|
|
|
int dayCount = days.size();
|