@@ -18,37 +18,35 @@ |
@javax.ws.rs.ApplicationPath("") |
public class ApplicationConfig extends Application { |
|
- @Context |
- private ServletContext context; |
+ @Context |
+ private ServletContext context; |
|
+ @Override |
+ public Set<Class<?>> getClasses() { |
+ Set<Class<?>> resources = new java.util.HashSet<>(); |
+ addRestResourceClasses(resources); |
+ ContextConfig.filterServices(context, resources); |
+ Config.register(resources); |
+ return resources; |
+ } |
|
- @Override |
- public Set<Class<?>> getClasses() { |
- Set<Class<?>> resources = new java.util.HashSet<>(); |
- addRestResourceClasses(resources); |
- ContextConfig.filterServices(context, resources); |
- Config.register(resources); |
- return resources; |
- } |
- |
- |
- /** |
- * Do not modify addRestResourceClasses() method. It is automatically |
- * re-generated by NetBeans REST support to populate given list with all |
- * resources defined in the project. |
- */ |
- private void addRestResourceClasses(Set<Class<?>> resources) { |
- resources.add(csip.ArchiveService.class); |
- resources.add(csip.CatalogService.class); |
- resources.add(csip.ControlService.class); |
- resources.add(csip.DynamicPyModelDataService.class); |
- resources.add(csip.GzipWriterInterceptor.class); |
- resources.add(csip.QueryService.class); |
- resources.add(csip.QueueingModelDataService.class); |
- resources.add(csip.ReportService.class); |
+ /** |
+ * Do not modify addRestResourceClasses() method. It is automatically |
+ * re-generated by NetBeans REST support to populate given list with all |
+ * resources defined in the project. |
+ */ |
+ private void addRestResourceClasses(Set<Class<?>> resources) { |
+ resources.add(csip.ArchiveService.class); |
+ resources.add(csip.CatalogService.class); |
+ resources.add(csip.ControlService.class); |
+ resources.add(csip.DynamicPyModelDataService.class); |
+ resources.add(csip.GzipWriterInterceptor.class); |
+ resources.add(csip.QueryService.class); |
+ resources.add(csip.QueueingModelDataService.class); |
+ resources.add(csip.ReportService.class); |
resources.add(csip.UIService.class); |
resources.add(m.oms.ages.V1_0.class); |
resources.add(m.oms.dsl.V1_0.class); |
- } |
+ } |
|
} |
@@ -25,6 +25,7 @@ |
import static m.oms.ages.V1_0.KEY_SCRIPT_NP3000; |
import static m.oms.ages.V1_0.KEY_SCRIPT_NPBDCW; |
import static m.oms.ages.V1_0.KEY_SCRIPT_NPEAGLE; |
+import static m.oms.ages.V1_0.KEY_SCRIPT_NPDRAKE58; |
import ngmf.util.cosu.luca.of.NS; |
import ngmf.util.cosu.luca.of.RMSE; |
import ngmf.util.cosu.luca.of.TRMSE; |
@@ -58,6 +59,7 @@ |
@Resource(file = "${csip.dir}/bin/ages/simulation/ages_noPLSFIR3000.sim", type = REFERENCE, id = KEY_SCRIPT_NP3000) |
@Resource(file = "${csip.dir}/bin/ages/simulation/ages_noPLBDCW.sim", type = REFERENCE, id = KEY_SCRIPT_NPBDCW) |
@Resource(file = "${csip.dir}/bin/ages/simulation/ages_noPLEAGLE.sim", type = REFERENCE, id = KEY_SCRIPT_NPEAGLE) |
+@Resource(file = "${csip.dir}/bin/ages/simulation/ages_noPLDRAKE58.sim", type = REFERENCE, id = KEY_SCRIPT_NPDRAKE58) |
public class V1_0 extends ModelDataService { |
|
public static final String KEY_SCRIPT = "ages.sim"; |
@@ -68,6 +70,7 @@ |
public static final String KEY_SCRIPT_NP3000 = "ages_noPLSFIR3000.sim"; // no payload script |
public static final String KEY_SCRIPT_NPBDCW = "ages_noPLBDCW.sim"; // no payload script |
public static final String KEY_SCRIPT_NPEAGLE = "ages_noPLEAGLE.sim"; // no payload script |
+ public static final String KEY_SCRIPT_NPDRAKE58 = "ages_noPLDRAKE58.sim"; // no payload script |
public static final String RUN_INC = "run.inc"; |
|
public static final String PAR_STARTTIME = "startTime"; |
@@ -78,11 +81,13 @@ |
|
public static final String PAYLOAD = "payload"; |
public static final String PROJECT = "project"; |
+ public static final String MULTI_OBJ = "multi_obj"; |
|
static final Map<String, ObjectiveFunction> OF = new HashMap<>(); |
|
public String data_folder = ""; |
boolean payLoad = false; |
+ boolean multi_obj = false; |
|
static { |
OF.put("kge", new KGE()); |
@@ -232,10 +237,15 @@ |
|
@Override |
public void doProcess() throws Exception { |
+ LOG.info("===> Running AgES "); |
+ |
payLoad = parameter().getBoolean(PAYLOAD, false); |
+ multi_obj = parameter().getBoolean(MULTI_OBJ, false); |
+ |
String project = parameter().getString(PROJECT, "SFIR3"); |
String dsl = parameter().getString(KEY_SCRIPT, |
resources().getFile(KEY_SCRIPT).toString()); |
+ |
if (!payLoad) { |
dsl = parameter().getString(KEY_SCRIPT_NP, |
resources().getFile(KEY_SCRIPT_NP).toString()); |
@@ -264,6 +274,10 @@ |
dsl = parameter().getString(KEY_SCRIPT_NPEAGLE, |
resources().getFile(KEY_SCRIPT_NPEAGLE).toString()); |
} |
+ if (project.equals("DRAKE58")) { |
+ dsl = parameter().getString(KEY_SCRIPT_NPDRAKE58, |
+ resources().getFile(KEY_SCRIPT_NPDRAKE58).toString()); |
+ } |
} |
} |
|
@@ -299,20 +313,42 @@ |
|
Utils.runAges(d, getWorkspaceDir(), parameter(), resources(), LOG); |
|
- for (String ofName : getRequestedObjfunc(OF.keySet())) { |
- String[] data = parameter().getStringArray(ofName); |
- double v = calc_of(OF.get(ofName), data[0], data[1], cal_start, cal_end); |
- results().put(ofName, v); |
+ if (!multi_obj) { |
+ LOG.info("===> NOT Multi OBJ "); |
+ for (String ofName : getRequestedObjfunc(OF.keySet())) { |
+ if (parameter().has(ofName)) { |
+ String[] data = parameter().getStringArray(ofName); |
+ double v = calc_of(OF.get(ofName), data[0], data[1], cal_start, cal_end); |
+ results().put(ofName, v); |
+ } |
+ } |
} |
-// results().put(getWorkspaceFile("output")); |
+ |
+ if (multi_obj) { |
+ LOG.info("===> Multi OBJ"); |
+ for (String ofNameM : getRequestedObjfunc(OF.keySet())) { |
+ boolean find = true; |
+ int count = 1; |
+ while (find) { |
+ String dynamic = "_" + count; |
+ String new_Name = ofNameM + "" + dynamic; |
+ if (parameter().has(new_Name)) { |
+ String[] dataM = parameter().getStringArray(new_Name); |
+ double vv = calc_of(OF.get(ofNameM), dataM[0], dataM[1], cal_start, cal_end); |
+ results().put(new_Name, vv); |
+ count++; |
+ } else { |
+ find = false; |
+ } |
+ } |
+ } |
+ } |
} |
|
private List<String> getRequestedObjfunc(Set<String> names) { |
List<String> l = new ArrayList<>(); |
for (String ofName : names) { |
- if (parameter().has(ofName)) { |
- l.add(ofName); |
- } |
+ l.add(ofName); |
} |
return l; |
} |