示例#1
0
  private void writeResultsXml(GtaResult resultsObject) throws IOException {

    String newAnResFileName =
        FileUtil.findFreeFileName(
            resultsfolder,
            resultsfolder.getName() + "_" + modelReference.getFilename() + "_results",
            "xml");
    FileObject newAnResFile = resultsfolder.createData(newAnResFileName, "xml");
    resultsObject.setSummary(new Summary());
    resultsObject.getSummary().setFitModelCall(fitModelCall);
    // TODO resolve problem with multiple modelcalls
    resultsObject.getSummary().setInitModelCall(modelCalls.get(0));

    for (int i = 0; i < relationsList.size(); i++) {
      resultsObject.getDatasetRelations().add(new DatasetRelation());
      resultsObject
          .getDatasetRelations()
          .get(i)
          .setTo(String.valueOf((int) floor(relationsList.get(i)[0])));
      resultsObject
          .getDatasetRelations()
          .get(i)
          .setFrom(String.valueOf((int) floor(relationsList.get(i)[1])));
      // TODO do this in a different way
      // resultsObject.getDatasetRelations().get(i).getValues().add(relationsList.get(i)[2]);
      String cmd =
          timpcontroller.NAME_OF_RESULT_OBJECT
              + "$currTheta[["
              + (int) floor(relationsList.get(i)[0])
              + "]]@drel";
      resultsObject.getDatasetRelations().get(i).getValues().add(timpcontroller.getDouble(cmd));
    }

    createAnalysisResultsFile(resultsObject, FileUtil.toFile(newAnResFile));
  }
示例#2
0
 private Tgm getModel(GtaModelReference gtaModelReference) {
   TgmDataObject tgmDO = null;
   Tgm model = null;
   String path = project.getProjectDirectory() + File.separator + gtaModelReference.getPath();
   try {
     File datasetF = new File(path);
     FileObject datasetFO = FileUtil.createData(datasetF);
     DataObject datasetDO = DataObject.find(datasetFO);
     if (datasetDO != null) {
       tgmDO = (TgmDataObject) datasetDO;
       model = tgmDO.getTgm();
     }
   } catch (DataObjectExistsException ex) {
     Exceptions.printStackTrace(ex);
   } catch (IOException ex) {
     Exceptions.printStackTrace(ex);
   }
   return model;
 }