|
|
@@ -238,6 +238,49 @@ public final class VppBaselineHelper {
|
|
|
return VppCapabilityEvalHelper.hasTsdbPowerData(deviceMetricData, POWER_METRICS);
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ public static List<BaselinePointVO> buildMockBaselinePoints(Long siteId,
|
|
|
+ LocalDate responseDate,
|
|
|
+ LocalDateTime responseStartTime) {
|
|
|
+ List<BaselinePointVO> points = new ArrayList<>();
|
|
|
+ long seed = (siteId != null ? siteId : 0L) + responseDate.toEpochDay();
|
|
|
+ for (int minute = 0; minute < 1440; minute += INTERVAL_MINUTES) {
|
|
|
+ LocalTime time = LocalTime.of(minute / 60, minute % 60);
|
|
|
+ String timeKey = time.format(TIME_FMT);
|
|
|
+ double hourFactor = mockHourFactor(time);
|
|
|
+ double noise = 0.9 + pseudoRandom(seed, minute, 0) * 0.2;
|
|
|
+
|
|
|
+ BigDecimal yesterday = scale(BigDecimal.valueOf(900 * hourFactor * noise));
|
|
|
+ BigDecimal original = yesterday.multiply(BigDecimal.valueOf(0.98 + pseudoRandom(seed, minute, 1) * 0.04))
|
|
|
+ .setScale(2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal predicted = original.multiply(BigDecimal.valueOf(1.03)).setScale(2, RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ BaselinePointVO point = new BaselinePointVO();
|
|
|
+ point.setTime(timeKey);
|
|
|
+ point.setPredictedBaselineKw(predicted);
|
|
|
+ point.setYesterdayActualKw(yesterday);
|
|
|
+ if (!responseDate.atTime(time).isAfter(responseStartTime)) {
|
|
|
+ point.setTodayActualKw(scale(original.multiply(BigDecimal.valueOf(1.01 + pseudoRandom(seed, minute, 2) * 0.05))));
|
|
|
+ }
|
|
|
+ points.add(point);
|
|
|
+ }
|
|
|
+ return points;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static BigDecimal mockCorrectionFactor(Long siteId, LocalDate responseDate) {
|
|
|
+ long seed = (siteId != null ? siteId : 0L) + responseDate.toEpochDay();
|
|
|
+ double raw = 0.85 + pseudoRandom(seed, 99, 3) * 0.25;
|
|
|
+ BigDecimal k = BigDecimal.valueOf(raw).setScale(4, RoundingMode.HALF_UP);
|
|
|
+ if (k.compareTo(K_MIN) < 0) {
|
|
|
+ return K_MIN;
|
|
|
+ }
|
|
|
+ if (k.compareTo(K_MAX) > 0) {
|
|
|
+ return K_MAX;
|
|
|
+ }
|
|
|
+ return k;
|
|
|
+ }
|
|
|
+ */
|
|
|
+
|
|
|
public static String formatDate(LocalDate date) {
|
|
|
return date.format(DATE_FMT);
|
|
|
}
|
|
|
@@ -318,6 +361,49 @@ public final class VppBaselineHelper {
|
|
|
return points;
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ public static BigDecimal mockDeclaredCapacityKw(Long siteId,
|
|
|
+ LocalDate responseDate,
|
|
|
+ LocalDateTime windowStart,
|
|
|
+ LocalDateTime windowEnd,
|
|
|
+ BigDecimal correctionFactorK) {
|
|
|
+ return calculateDeclaredCapacityKw(
|
|
|
+ buildMockHistoricalWindow(siteId, responseDate, windowStart, windowEnd),
|
|
|
+ windowStart,
|
|
|
+ windowEnd,
|
|
|
+ correctionFactorK);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static List<DeclaredCapacityPointVO> buildMockDeclaredCapacityPoints(Long siteId,
|
|
|
+ LocalDate responseDate,
|
|
|
+ LocalDateTime windowStart,
|
|
|
+ LocalDateTime windowEnd,
|
|
|
+ BigDecimal correctionFactorK) {
|
|
|
+ return buildDeclaredCapacityPoints(
|
|
|
+ buildMockHistoricalWindow(siteId, responseDate, windowStart, windowEnd),
|
|
|
+ windowStart,
|
|
|
+ windowEnd,
|
|
|
+ correctionFactorK);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Map<String, BigDecimal> buildMockHistoricalWindow(Long siteId,
|
|
|
+ LocalDate responseDate,
|
|
|
+ LocalDateTime windowStart,
|
|
|
+ LocalDateTime windowEnd) {
|
|
|
+ Map<String, BigDecimal> mockHistorical = new TreeMap<>();
|
|
|
+ long seed = (siteId != null ? siteId : 0L) + responseDate.toEpochDay();
|
|
|
+ LocalDateTime cursor = windowStart;
|
|
|
+ while (!cursor.isAfter(windowEnd)) {
|
|
|
+ double hourFactor = mockHourFactor(cursor.toLocalTime());
|
|
|
+ double noise = 0.9 + pseudoRandom(seed, cursor.getHour() * 60 + cursor.getMinute(), 4) * 0.2;
|
|
|
+ mockHistorical.put(cursor.toLocalTime().format(TIME_FMT),
|
|
|
+ BigDecimal.valueOf(900 * hourFactor * noise).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ cursor = cursor.plusMinutes(INTERVAL_MINUTES);
|
|
|
+ }
|
|
|
+ return mockHistorical;
|
|
|
+ }
|
|
|
+ */
|
|
|
+
|
|
|
private static BigDecimal averageValuesInWindow(Map<String, BigDecimal> valuesByTime,
|
|
|
LocalDateTime windowStart,
|
|
|
LocalDateTime windowEnd) {
|
|
|
@@ -430,4 +516,36 @@ public final class VppBaselineHelper {
|
|
|
}
|
|
|
return value.setScale(2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
+
|
|
|
+ /*
|
|
|
+ private static double mockHourFactor(LocalTime time) {
|
|
|
+ int hour = time.getHour();
|
|
|
+ int minute = time.getMinute();
|
|
|
+ double h = hour + minute / 60.0;
|
|
|
+ if (h < 6) {
|
|
|
+ return 0.45 + h / 6 * 0.15;
|
|
|
+ }
|
|
|
+ if (h < 9) {
|
|
|
+ return 0.6 + (h - 6) / 3 * 0.35;
|
|
|
+ }
|
|
|
+ if (h < 12) {
|
|
|
+ return 0.95 + (h - 9) / 3 * 0.05;
|
|
|
+ }
|
|
|
+ if (h < 14) {
|
|
|
+ return 0.85;
|
|
|
+ }
|
|
|
+ if (h < 17) {
|
|
|
+ return 0.9 + (h - 14) / 3 * 0.1;
|
|
|
+ }
|
|
|
+ if (h < 21) {
|
|
|
+ return 1.0 - (h - 17) / 4 * 0.35;
|
|
|
+ }
|
|
|
+ return 0.5 - (h - 21) / 3 * 0.15;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static double pseudoRandom(long seed, int minuteOfDay, int seriesSalt) {
|
|
|
+ long mixed = seed * 31L + minuteOfDay * 17L + seriesSalt * 13L;
|
|
|
+ return (mixed % 1000) / 1000.0;
|
|
|
+ }
|
|
|
+ */
|
|
|
}
|