docs: private String createSMMAStr(int smid, HashMap trData) {
  
          StringBuilder sb = new StringBuilder();
          String nitro = "Y";
          String water = "Y";
          String co2 = "M";
          String harOpt = "M";
          String sdate;
          String sm = String.format("%2d", smid);
  //        ArrayList<HashMap> dataArr;
          HashMap subData;
          String vbose="N";
  
  //        // Check if the meta data of fertilizer is not "N" ("Y" or null)
  //        if (!getValueOr(expData, "fertilizer", "").equals("N")) {
  //
  //            // Check if necessary data is missing in all the event records
  //            // P.S. rule changed since all the necessary data has a default value for it
  //            dataArr = getObjectOr(trData, "fertilizer", new ArrayList());
  //            if (dataArr.isEmpty()) {
  //                nitro = "N";
  //            }
  ////            for (int i = 0; i < dataArr.size(); i++) {
  ////                subData = dataArr.get(i);
  ////                if (getValueOr(subData, "date", "").equals("")
  ////                        || getValueOr(subData, "fecd", "").equals("")
  ////                        || getValueOr(subData, "feacd", "").equals("")
  ////                        || getValueOr(subData, "feamn", "").equals("")) {
  ////                    nitro = "N";
  ////                    break;
  ////                }
  ////            }
  //        }
  //        // Check if the meta data of irrigation is not "N" ("Y" or null)
  //        if (!getValueOr(expData, "irrigation", "").equals("N")) {
  //
  //            // Check if necessary data is missing in all the event records
  //            dataArr = getObjectOr(trData, "irrigation", new ArrayList());
  //            for (int i = 0; i < dataArr.size(); i++) {
  //                subData = dataArr.get(i);
  //                if (getValueOr(subData, "date", "").equals("")
  //                        || getValueOr(subData, "irval", "").equals("")) {
  //                    water = "N";
  //                    break;
  //                }
  //            }
  //        }
          // Check if CO2Y value is provided and the value is positive, then set CO2 switch to W
          String co2y = getValueOr(trData, "co2y", "").trim();
          if (!co2y.equals("") && !co2y.startsWith("-")) {
              co2 = "W";
          }
  
          sdate = getValueOr(trData, "sdat", "");
          if (sdate.equals("")) {
              subData = getObjectOr(trData, "planting", new HashMap());
              sdate = getValueOr(subData, "date", defValD);
          }
          sdate = formatDateStr(sdate);
          sdate = String.format("%5s", sdate);
  
          if (!getValueOr(trData, "hadat_valid", "").trim().equals("")) {
              harOpt = "R";
          }
          
          if (getValueOr(trData, "seasonal_dome_applied", "").trim().equals("Y")) {
              vbose = "0";
          }
  
          String smStr;
          HashMap smData;
          // GENERAL
          sb.append("@N GENERAL     NYERS NREPS START SDATE RSEED SNAME.................... SMODEL\r\n");
          if (!(smStr = getValueOr(trData, "sm_general", "")).equals("")) {
              if (!sdate.trim().equals("-99") && !sdate.trim().equals("")) {
                  smStr = replaceSMStr(smStr, sdate, 30);
              }
              smStr = replaceSMStr(smStr, getValueOr(trData, "dssat_model", ""), 68);
              sb.append(sm).append(" ").append(smStr).append("\r\n");
          } else if (!(smData = getObjectOr(trData, "general", new HashMap())).isEmpty()) {
              if (sdate.trim().equals("-99") || sdate.trim().equals("")) {
                  sdate = String.format("%1$02d%2$03d", Integer.parseInt(formatNumStr(2, smData, "sdyer", "0").trim()), Integer.parseInt(formatNumStr(3, smData, "sdday", "0").trim()));
              }
              sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s     %5$-1s %6$5s %7$5s %8$-25s %9$s\r\n",
                      sm,
                      "GE",
                      getValueOr(smData, "nyers", "1"),
                      getValueOr(smData, "nreps", "1"),
                      getValueOr(smData, "start", "S"),
                      sdate,
                      getValueOr(smData, "rseed", "250"),
                      getValueOr(smData, "sname", defValC),
                      getValueOr(trData, "dssat_model", getValueOr(smData, "model", ""))));
          } else {
              sb.append(sm).append(" GE              1     1     S ").append(sdate).append("  2150 DEFAULT SIMULATION CONTRL ").append(getValueOr(trData, "dssat_model", "")).append("\r\n");
          }
          // OPTIONS
          sb.append("@N OPTIONS     WATER NITRO SYMBI PHOSP POTAS DISES  CHEM  TILL   CO2\r\n");
          if (!(smStr = getValueOr(trData, "sm_options", "")).equals("")) {
  //            smStr = replaceSMStr(smStr, co2, 64);
              sb.append(sm).append(" ").append(smStr).append("\r\n");
          } else if (!(smData = getObjectOr(trData, "options", new HashMap())).isEmpty()) {
              sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s     %6$-1s     %7$-1s     %8$-1s     %9$-1s     %10$-1s     %11$-1s\r\n",
                      sm,
                      "OP",
                      getValueOr(smData, "water", water),
                      getValueOr(smData, "nitro", nitro),
                      getValueOr(smData, "symbi", "Y"),
                      getValueOr(smData, "phosp", "N"),
                      getValueOr(smData, "potas", "N"),
                      getValueOr(smData, "dises", "N"),
                      getValueOr(smData, "chem", "N"),
                      getValueOr(smData, "till", "Y"),
                      getValueOr(smData, "co2", co2)));
          } else {
              sb.append(sm).append(" OP              ").append(water).append("     ").append(nitro).append("     Y     N     N     N     N     Y     ").append(co2).append("\r\n");
          }
          // METHODS
          sb.append("@N METHODS     WTHER INCON LIGHT EVAPO INFIL PHOTO HYDRO NSWIT MESOM MESEV MESOL\r\n");
          if (!(smStr = getValueOr(trData, "sm_methods", "")).equals("")) {
              sb.append(sm).append(" ").append(smStr).append("\r\n");
          } else if (!(smData = getObjectOr(trData, "methods", new HashMap())).isEmpty()) {
              sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s     %6$-1s     %7$-1s     %8$-1s     %9$-1s     %10$-1s     %11$-1s     %12$-1s     %13$-1s\r\n",
                      sm,
                      "ME",
                      getValueOr(smData, "wther", "M"),
                      getValueOr(smData, "incon", "M"),
                      getValueOr(smData, "light", "E"),
                      getValueOr(smData, "evapo", "R"),
                      getValueOr(smData, "infil", "S"),
                      getValueOr(smData, "photo", "L"),
                      getValueOr(smData, "hydro", "R"),
                      getValueOr(smData, "nswit", "1"),
                      getValueOr(smData, "mesom", "P"),
                      getValueOr(smData, "mesev", "S"),
                      getValueOr(smData, "mesol", "2")));
          } else {
              sb.append(sm).append(" ME              M     M     E     R     S     L     R     1     P     S     2\r\n"); // P.S. 2012/09/02 MESOM "G" -> "P"
          }
          // MANAGEMENT
          sb.append("@N MANAGEMENT  PLANT IRRIG FERTI RESID HARVS\r\n");
          if (!(smStr = getValueOr(trData, "sm_management", "")).equals("")) {
  //            smStr = smStr.replaceAll("     D", "     R");
  //            smStr = replaceSMStr(smStr, harOpt, 40);
              sb.append(sm).append(" ").append(smStr).append("\r\n");
          } else if (!(smData = getObjectOr(trData, "management", new HashMap())).isEmpty()) {
              sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s     %6$-1s     %7$-1s\r\n",
                      sm,
                      "MA",
                      getValueOr(smData, "plant", "R"),
                      getValueOr(smData, "irrig", "R"),
                      getValueOr(smData, "ferti", "R"),
                      getValueOr(smData, "resid", "R"),
                      getValueOr(smData, "harvs", harOpt)));
          } else {
              sb.append(sm).append(" MA              R     R     R     R     ").append(harOpt).append("\r\n");
          }
          // OUTPUTS
          sb.append("@N OUTPUTS     FNAME OVVEW SUMRY FROPT GROUT CAOUT WAOUT NIOUT MIOUT DIOUT VBOSE CHOUT OPOUT\r\n");
          if (!(smStr = getValueOr(trData, "sm_outputs", "")).equals("")) {
              sb.append(sm).append(" ").append(smStr).append("\r\n\r\n");
          } else if (!(smData = getObjectOr(trData, "outputs", new HashMap())).isEmpty()) {
              sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s %6$5s     %7$-1s     %8$-1s     %9$-1s     %10$-1s     %11$-1s     %12$-1s     %13$-1s     %14$-1s     %15$-1s\r\n\r\n",
                      sm,
                      "OU",
                      getValueOr(smData, "fname", "N"),
                      getValueOr(smData, "ovvew", "Y"),
                      getValueOr(smData, "sumry", "Y"),
                      getValueOr(smData, "fropt", "1"),
                      getValueOr(smData, "grout", "Y"),
                      getValueOr(smData, "caout", "Y"),
                      getValueOr(smData, "waout", "N"),
                      getValueOr(smData, "niout", "N"),
                      getValueOr(smData, "miout", "N"),
                      getValueOr(smData, "diout", "N"),
                      getValueOr(smData, "vbose", vbose),
                      getValueOr(smData, "chout", "N"),
                      getValueOr(smData, "opout", "N")));
          } else {
              sb.append(sm).append(" OU              N     Y     Y     1     Y     Y     N     N     N     N     ").append(vbose).append("     N     N\r\n\r\n");
          }
          // PLANTING
          sb.append("@  AUTOMATIC MANAGEMENT\r\n");
          sb.append("@N PLANTING    PFRST PLAST PH2OL PH2OU PH2OD PSTMX PSTMN\r\n");
          if (!(smStr = getValueOr(trData, "sm_planting", "")).equals("")) {
              sb.append(sm).append(" ").append(smStr).append("\r\n");
          } else if (!(smData = getObjectOr(trData, "planting", new HashMap())).isEmpty()) {
              sb.append(String.format("%1$2s %2$-11s %3$02d%4$03d %5$02d%6$03d %7$5s %8$5s %9$5s %10$5s %11$5s\r\n",
                      sm,
                      "PL",
                      Integer.parseInt(formatNumStr(2, smData, "pfyer", "82")),
                      Integer.parseInt(formatNumStr(3, smData, "pfday", "050")),
                      Integer.parseInt(formatNumStr(2, smData, "plyer", "82")),
                      Integer.parseInt(formatNumStr(3, smData, "plday", "064")),
                      getValueOr(smData, "ph2ol", "40"),
                      getValueOr(smData, "ph2ou", "100"),
                      getValueOr(smData, "ph2od", "30"),
                      getValueOr(smData, "pstmx", "40"),
                      getValueOr(smData, "pstmn", "10")));
          } else {
              sb.append(sm).append(" PL          82050 82064    40   100    30    40    10\r\n");
          }
          // IRRIGATION
          sb.append("@N IRRIGATION  IMDEP ITHRL ITHRU IROFF IMETH IRAMT IREFF\r\n");
          if (!(smStr = getValueOr(trData, "sm_irrigation", "")).equals("")) {
              sb.append(sm).append(" ").append(smStr).append("\r\n");
          } else if (!(smData = getObjectOr(trData, "irrigation", new HashMap())).isEmpty()) {
              sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s %5$5s %6$-5s %7$-5s %8$5s %9$5s\r\n",
                      sm,
                      "IR",
                      getValueOr(smData, "imdep", "30"),
                      getValueOr(smData, "ithrl", "50"),
                      getValueOr(smData, "ithru", "100"),
                      getValueOr(smData, "iroff", "GS000"),
                      getValueOr(smData, "imeth", "IR001"),
                      getValueOr(smData, "iramt", "10"),
                      getValueOr(smData, "ireff", "1.00")));
          } else {
              sb.append(sm).append(" IR             30    50   100 GS000 IR001    10  1.00\r\n");
          }
          // NITROGEN
          sb.append("@N NITROGEN    NMDEP NMTHR NAMNT NCODE NAOFF\r\n");
          if (!(smStr = getValueOr(trData, "sm_nitrogen", "")).equals("")) {
              sb.append(sm).append(" ").append(smStr).append("\r\n");
          } else if (!(smData = getObjectOr(trData, "nitrogen", new HashMap())).isEmpty()) {
              sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s %5$5s %6$-5s %7$-5s\r\n",
                      sm,
                      "NI",
                      getValueOr(smData, "nmdep", "30"),
                      getValueOr(smData, "nmthr", "50"),
                      getValueOr(smData, "namnt", "25"),
                      getValueOr(smData, "ncode", "FE001"),
                      getValueOr(smData, "naoff", "GS000")));
          } else {
              sb.append(sm).append(" NI             30    50    25 FE001 GS000\r\n");
          }
          // RESIDUES
          sb.append("@N RESIDUES    RIPCN RTIME RIDEP\r\n");
          if (!(smStr = getValueOr(trData, "sm_residues", "")).equals("")) {
              sb.append(sm).append(" ").append(smStr).append("\r\n");
          } else if (!(smData = getObjectOr(trData, "residues", new HashMap())).isEmpty()) {
              sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s %5$5s\r\n",
                      sm,
                      "RE",
                      getValueOr(smData, "ripcn", "100"),
                      getValueOr(smData, "rtime", "1"),
                      getValueOr(smData, "ridep", "20")));
          } else {
              sb.append(sm).append(" RE            100     1    20\r\n");
          }
          // HARVEST
          sb.append("@N HARVEST     HFRST HLAST HPCNP HPCNR\r\n");
          if (!(smStr = getValueOr(trData, "sm_harvests", "")).equals("")) {
              sb.append(sm).append(" ").append(smStr).append("\r\n\r\n");
          } else if (!(smData = getObjectOr(trData, "harvests", new HashMap())).isEmpty()) {
              sb.append(String.format("%1$2s %2$-11s %3$5s %4$02d%5$03d %6$5s %7$5s\r\n\r\n",
                      sm,
                      "HA",
                      getValueOr(smData, "hfrst", "0"),
                      Integer.parseInt(formatNumStr(2, smData, "hlyer", "83")),
                      Integer.parseInt(formatNumStr(3, smData, "hlday", "057")),
                      getValueOr(smData, "hpcnp", "100"),
                      getValueOr(smData, "hpcnr", "0")));
          } else {
              sb.append(sm).append(" HA              0 83057   100     0\r\n\r\n");
          }
  
          return sb.toString();
      }