private void runExperimentSeries(
      ScenarioInstance scenarioInstance,
      Map<MeasurementSpecification, List<ExperimentSeriesDefinition>> experimentSeries) {
    boolean mecAcquired = false;
    try {
      experimentController.acquireMEController();
      mecAcquired = true;

      for (MeasurementSpecification measSpec : experimentSeries.keySet()) {
        experimentController.initialize(
            EngineTools.getConstantParameterValues(measSpec.getInitializationAssignemts()),
            scenarioInstance.getScenarioDefinition().getMeasurementEnvironmentDefinition());

        for (ExperimentSeriesDefinition esd : experimentSeries.get(measSpec)) {
          ExperimentSeries series = scenarioInstance.getExperimentSeries(esd.getName());
          if (series == null) {
            series = EntityFactory.createExperimentSeries(esd);
            scenarioInstance.getExperimentSeriesList().add(series);
            series.setScenarioInstance(scenarioInstance);

            persistenceProvider.store(series);
          }

          experimentSeriesManager.runExperimentSeries(series);
        }
      }

    } catch (Exception e) {
      throw new RuntimeException("Failed executing experiments!", e);
    } finally {
      if (mecAcquired) {
        experimentController.releaseMEController();
      }
    }
  }
 private ScenarioInstance createNewScenarioInstance(ScenarioDefinition scenarioDefinition) {
   ScenarioInstance scenarioInstance =
       EntityFactory.createScenarioInstance(
           scenarioDefinition, getConfiguration().getMeasurementControllerURIAsStr());
   persistenceProvider.store(scenarioInstance);
   LOGGER.debug("Created new ScenarioInstance {}", scenarioInstance);
   return scenarioInstance;
 }
  /** @return a dummy scenario instance */
  public static ScenarioInstance createDummyScenarioInstance() {
    scenarioDefinition = loadScenarioDefinition();
    ScenarioInstance scenarioInstance =
        EntityFactory.createScenarioInstance(scenarioDefinition, "Dummy");

    for (ExperimentSeries es : createDummyExperimentSeries()) {
      scenarioInstance.getExperimentSeriesList().add(es);
      es.setScenarioInstance(scenarioInstance);
    }
    return scenarioInstance;
  }
  static Collection<? extends ExperimentSeriesRun> createDummyExperimentSeriesRuns(
      int numberOfRunsToCreate) {
    ArrayList<ExperimentSeriesRun> runs = new ArrayList<ExperimentSeriesRun>();
    for (int i = 0; i < numberOfRunsToCreate; i++) {

      ExperimentSeriesRun run = EntityFactory.createExperimentSeriesRun();
      run.setSuccessfulResultDataSet(createDummyResultDataSet());
      runs.add(run);
    }

    return runs;
  }
  private static List<ExperimentSeries> createDummyExperimentSeries() {
    List<ExperimentSeries> seriesList = new LinkedList<ExperimentSeries>();
    for (ExperimentSeriesDefinition esd :
        scenarioDefinition.getMeasurementSpecifications().get(0).getExperimentSeriesDefinitions()) {
      ExperimentSeries es = EntityFactory.createExperimentSeries(esd);

      for (ExperimentSeriesRun run : createDummyExperimentSeriesRuns(_10)) {
        es.getExperimentSeriesRuns().add(run);
        run.setExperimentSeries(es);
      }

      seriesList.add(es);
    }

    return seriesList;
  }
 private static ParameterDefinition createDummyObservationParameterDefinition(String name) {
   ParameterDefinition paramDef =
       EntityFactory.createParameterDefinition(name, "INTEGER", ParameterRole.OBSERVATION);
   return paramDef;
 }