Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.08 KB | None | 0 0
  1. private void forecast(final String sISO, final String sSourceEdition, final String sForecastEdition, final GTTimestamp[] gtDates, final GTTimestamp gtForecastStartDate, final GTTimestamp gtForecastEndDate, final String[] sCommodities, final Map<String, String> mapModFunc) throws Exception {
  2.       String modFunction = "";
  3.       for (Entry<String, String> ent : mapModFunc.entrySet()) {
  4.          modFunction = ent.getValue();
  5.       }
  6.       Double[][] dModFunctions = getModFunctionValue(modFunction);
  7.       GTTimestamp targetDate = gtForecastStartDate;
  8.       String[] lmpGroups = {
  9.                             "WIND"
  10.       };
  11.       String[] commodityNames = {
  12.                                  "Energy"
  13.       };
  14.  
  15.       if (dModFunctions != null) {
  16.          //Next Hour Share Same Function
  17.          boolean bSharingFunction = false;
  18.          GTTimestamp savingDateStart = null;
  19.          GTTimestamp savingDateEnd = null;
  20.  
  21.          for (int h = 0; h < TOTAL_FUNC_HOURS; h++) {
  22.             //Initiate Start Date
  23.             if ((savingDateStart == null) || !bSharingFunction) {
  24.                savingDateStart = targetDate.clone().add(Calendar.HOUR, h);
  25.             }
  26.  
  27.             //Set End Date to match the loop
  28.             savingDateEnd = targetDate.clone().add(Calendar.HOUR, h);
  29.  
  30.             //Check next hour if using the same function if so, wait to calculate all together
  31.             if (((h + 1) < TOTAL_FUNC_HOURS) && isSameFunction(dModFunctions[h], dModFunctions[h + 1])) {
  32.                bSharingFunction = true;
  33.  
  34.                continue;
  35.             }
  36.  
  37.             bSharingFunction = false;
  38. //            //String isoName, String sourceEdition, String forecastEdition, String[] lmpGroupNames,
  39. //            //GTTimestamp[] sourceDates, GTTimestamp startForecastDate, GTTimestamp endForecastDate,
  40. //            //String[] commodityNames, Map<String,String> modificationFunctions
  41.             LMPForecastCreator.createForecast(sISO, sSourceEdition, sForecastEdition, lmpGroups, gtDates, gtForecastStartDate, gtForecastEndDate, commodityNames, mapModFunc);
  42.          }
  43.       }
  44.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement