code: public void stateMachine(ShanksSimulation sim) throws Exception{
          logger.fine("Using default state machine for ScenarioManager");
  //        switch (this.simulationStateMachineStatus) {
  //        case CHECK_FAILURES:
  //            this.checkFailures(sim);
  //            this.simulationStateMachineStatus = GENERATE_FAILURES;
  //            break;
  //        case GENERATE_FAILURES:
  //            this.generateFailures(sim);
  //            this.simulationStateMachineStatus = CHECK_PERIODIC_;
  //            break;
  //        case GENERATE_PERIODIC_EVENTS:
  //            this.generatePeriodicEvents(sim);
  //            this.simulationStateMachineStatus = CHECK_FAILURES;
  //            break;
  //        case GENERATE_RANDOM_EVENTS:
  //            this.generateRandomEvents(sim);
  //            this.simulationStateMachineStatus = CHECK_FAILURES;
  //            break;
  //        }
  
          this.checkFailures(sim);
          this.generateFailures(sim);
          this.generateScenarioEvents(sim);
          this.generateNetworkElementEvents(sim);
          long step = sim.getSchedule().getSteps();
          if (step%500==0) {
              logger.info("Step: " + step);
              logger.finest("In step " + step + ", there are " + sim.getScenario().getCurrentFailures().size() + " current failures.");
              logger.finest("In step " + step + ", there are " + sim.getNumOfResolvedFailures() + " resolved failures.");
          }
      }
docs: This method implements the state machine of the scenario manager
  
  @param sim
  @throws Exception