currentActuator = (GenericActuator) (myBioHolder.getActuatorAttachedTo( myBioHolder.theH2InFlowRateActuators, myAirRS)); currentActuator.setValue(40); currentActuator = (GenericActuator) (myBioHolder.getActuatorAttachedTo( myBioHolder.thePotableWaterOutFlowRateActuators, myAirRS)); currentActuator.setValue(20);
    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;        try {            fw = new FileWriter(OutFile);        } catch (IOException e) {        }        pw = new PrintWriter(fw, true);        setThresholds();        myBioHolder = BioHolderInitializer.getBioHolder();        myBioDriver = myBioHolder.theBioDriver;        myBiomassRS = (BiomassRS) (myBioHolder.theBiomassRSModules.get(0));        myBiomassRS.setAutoHarvestAndReplantEnabled(true);        myFoodProcessor = (FoodProcessor) myBioHolder.theFoodProcessors.get(0);        myCrew = (CrewGroup) myBioHolder.theCrewGroups.get(0);        myWaterRS = (WaterRS) myBioHolder.theWaterRSModules.get(0);        myAirRS = (AirRS) myBioHolder.theAirRSModules.get(0);        myDirtyWaterStore = (DirtyWaterStore) myBioHolder.theDirtyWaterStores                .get(0);        myPotableWaterStore = (PotableWaterStore) myBioHolder.thePotableWaterStores                .get(0);        myGreyWaterStore = (GreyWaterStore) myBioHolder.theGreyWaterStores                .get(0);        myO2Store = (O2Store) myBioHolder.theO2Stores.get(0);        myCO2Store = (CO2Store) myBioHolder.theCO2Stores.get(0);        myH2Store = (H2Store) myBioHolder.theH2Stores.get(0);        myCrewEnvironment = (SimEnvironment) myBioHolder.theSimEnvironments                .get(0);        myPlantEnvironment = (SimEnvironment) myBioHolder.theSimEnvironments                .get(1);        myBiomassStore = (BiomassStore) myBioHolder.theBiomassStores.get(0);        myFoodStore = (FoodStore) myBioHolder.theFoodStores.get(0);        myPowerStore = (PowerStore) myBioHolder.thePowerStores.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);        currentActuator = (GenericActuator) (myBioHolder.getActuatorAttachedTo(                myBioHolder.theBiomassInFlowRateActuators, myFoodProcessor));        currentActuator.setValue(0);        currentActuator = (GenericActuator) (myBioHolder.getActuatorAttachedTo(                myBioHolder.theGreyWaterInFlowRateActuators, myBiomassRS));        currentActuator.setValue(2);        // 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);        myBioDriver.startSimulation();        myLogger.info("starting run...");        crewO2integral = 0f;        crewCO2integral = 0f;        crewH2Ointegral = 0f;        plantO2integral = 0f;        plantCO2integral = 0f;        plantH2Ointegral = 0f;        Runs++;        for (i = 0; i < ATMOSPHERIC_PERIOD; 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()) % (CORE_PERIOD_MULT * ATMOSPHERIC_PERIOD)) == 0) {                myLogger.info(myBioDriver.getTicks() + "");                ContinuousState.printMe();                currentAction.printMe();                ContinuousState.updateState();                ClassifiedState = classifyState(ContinuousState);                currentAction = handController(ClassifiedState);                setActuators(currentAction);                doFoodProcessor();                if (((myBioDriver.getTicks()) % (PLANT_PERIOD_MULT                        * CORE_PERIOD_MULT * ATMOSPHERIC_PERIOD)) == 0) {                    doPlants();                }            }            //advancing the sim n ticks            for (i = 0; i < ATMOSPHERIC_PERIOD; i++)                myBioDriver.advanceOneTick();            doAccumulatorsInjectors();        }        myLogger.info("crew dead at " + myBioDriver.getTicks() + " ticks");        myBioDriver.endSimulation();    }