if (((myBioDriver.getTicks())%(PLANT_PERIOD_MULT*SYSTEM_PERIOD_MULT*ATMOSPHERIC_PERIOD)) == 0) {
if (((myBioDriver.getTicks())%(PLANT_PERIOD_MULT*CORE_PERIOD_MULT*ATMOSPHERIC_PERIOD)) == 0) {
	public void runSim(){		// ticks the sim one step at a time, observes the state, updates policy and predictive model in		// response to the current state and modifies actuators in response		int i;		float tmp2, oldvalue, newvalue;		GenericActuator currentActuator; 					setThresholds();		myBioHolder = BioHolderInitializer.getBioHolder();		myBioDriver = myBioHolder.theBioDriver;				try { 	fw = new FileWriter(OutFile) ; }		catch (IOException e) {}		pw = new PrintWriter(fw, true) ;				myBioDriver.startSimulation();		BiomassRS myBiomassRS = (BiomassRS)(myBioHolder.theBiomassRSModules.get(0));  		myBiomassRS.setAutoHarvestAndReplantEnabled(false); 				CrewGroup myCrew = (CrewGroup)myBioHolder.theCrewGroups.get(0);		WaterRS myWaterRS = (WaterRS)myBioHolder.theWaterRSModules.get(0);		AirRS myAirRS = (AirRS)myBioHolder.theAirRSModules.get(0);		//supply power		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.thePowerInFlowRateActuators, myWaterRS));		currentActuator.setValue(500);		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.thePowerInFlowRateActuators, myAirRS));		currentActuator.setValue(300);		//turn vccr off 		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.theAirInFlowRateActuators, myAirRS));		currentActuator.setValue(0);		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.theCO2OutFlowRateActuators, myAirRS));		currentActuator.setValue(0);		//set values for other inputs and outputs		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.theH2InFlowRateActuators, myAirRS));		currentActuator.setValue(40);		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.thePotableWaterOutFlowRateActuators, myAirRS));		currentActuator.setValue(20);		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.thePotableWaterOutFlowRateActuators, myWaterRS));		currentActuator.setValue(10);		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.theH2OutFlowRateActuators, myAirRS));		currentActuator.setValue(10);		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.theO2OutFlowRateActuators, myAirRS));		currentActuator.setValue(10);				// initialize everything to off		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.theCO2InFlowRateActuators, myAirRS));		currentActuator.setValue(0);		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.thePotableWaterInFlowRateActuators, myAirRS));		currentActuator.setValue(0);		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.theDirtyWaterInFlowRateActuators, myWaterRS));		currentActuator.setValue(0);		currentActuator = (GenericActuator)(myBioHolder.getActuatorAttachedTo(myBioHolder.theGreyWaterInFlowRateActuators, myWaterRS));		currentActuator.setValue(0);						System.out.println("starting run...");		crewO2integral = 7f;		crewCO2integral = 1f;		plantO2integral = -1f;		plantCO2integral = 0.5f;		Runs ++;				while (!myBioDriver.simulationHasStarted()) { 			try {Thread.sleep(10000);}			catch (InterruptedException e) { 			}		}	//	for (i=0;i<20;i++) myBioDriver.advanceOneTick();		ContinuousState = new StateMap();		ContinuousState.updateState();		ClassifiedState = classifyState(ContinuousState); 		currentAction = handController(ClassifiedState); 		setActuators(currentAction);		//int max_ticks = (int)Math.pow(Runs, 2); 				while ((!myCrew.anyDead() ) /*&& myBioDriver.getTicks() < max_ticks*/) {						if (((myBioDriver.getTicks())%(SYSTEM_PERIOD_MULT*ATMOSPHERIC_PERIOD)) == 0) {				System.out.println(myBioDriver.getTicks());				ContinuousState.printMe();				currentAction.printMe();				ContinuousState.updateState();				ClassifiedState = classifyState(ContinuousState); 				currentAction = handController(ClassifiedState);				setActuators(currentAction);				doFoodProcessor();				if (((myBioDriver.getTicks())%(PLANT_PERIOD_MULT*SYSTEM_PERIOD_MULT*ATMOSPHERIC_PERIOD)) == 0) {					doPlants();				}			}						//advancing the sim n ticks 			for (i=0;i<ATMOSPHERIC_PERIOD;i++) myBioDriver.advanceOneTick();			doAccumulatorsInjectors();		}		System.out.println("crew dead at "+myBioDriver.getTicks()+" ticks");		myBioDriver.endSimulation();	}