org.mars_sim.msp.simulation.structure.building.function
Class Farming

java.lang.Object
  extended by org.mars_sim.msp.simulation.structure.building.function.Function
      extended by org.mars_sim.msp.simulation.structure.building.function.Farming
All Implemented Interfaces:
java.io.Serializable

public class Farming
extends Function
implements java.io.Serializable

The Farming class is a building function for greenhouse farming.

See Also:
Serialized Form

Field Summary
static java.lang.String CROP_EVENT
           
static double HARVEST_MULTIPLIER
           
static java.lang.String NAME
           
 
Constructor Summary
Farming(Building building)
          Constructor
 
Method Summary
 void addHarvest(double harvest)
          Adds harvested food to the farm.
 double addWork(double workTime)
          Adds work time to the crops current phase.
 java.util.List<Crop> getCrops()
          Gets the farm's current crops.
 double getEstimatedHarvestPerOrbit()
          Gets the estimated maximum harvest for one orbit.
 int getFarmerNum()
          Gets the number of farmers currently working at the farm.
 double getFullPowerRequired()
          Gets the amount of power required when function is at full power.
 double getGrowingArea()
          Gets the total growing area for all crops.
 double getPowerDownPowerRequired()
          Gets the amount of power required when function is at power down level.
 boolean requiresWork()
          Checks if farm currently requires work.
 void timePassing(double time)
          Time passing for the building.
 
Methods inherited from class org.mars_sim.msp.simulation.structure.building.function.Function
getBuilding, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CROP_EVENT

public static final java.lang.String CROP_EVENT
See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

HARVEST_MULTIPLIER

public static final double HARVEST_MULTIPLIER
See Also:
Constant Field Values
Constructor Detail

Farming

public Farming(Building building)
        throws BuildingException
Constructor

Parameters:
building - the building the function is for.
Throws:
BuildingException - if error in constructing function.
Method Detail

getCrops

public java.util.List<Crop> getCrops()
Gets the farm's current crops.

Returns:
collection of crops

requiresWork

public boolean requiresWork()
Checks if farm currently requires work.

Returns:
true if farm requires work

addWork

public double addWork(double workTime)
               throws java.lang.Exception
Adds work time to the crops current phase.

Parameters:
workTime - - Work time to be added (millisols)
Returns:
workTime remaining after working on crop (millisols)
Throws:
java.lang.Exception - if error adding work.

addHarvest

public void addHarvest(double harvest)
Adds harvested food to the farm.

Parameters:
harvest - harvested food to add (kg.)

getFarmerNum

public int getFarmerNum()
Gets the number of farmers currently working at the farm.

Returns:
number of farmers

timePassing

public void timePassing(double time)
                 throws BuildingException
Time passing for the building.

Specified by:
timePassing in class Function
Parameters:
time - amount of time passing (in millisols)
Throws:
BuildingException - if error occurs.

getFullPowerRequired

public double getFullPowerRequired()
Gets the amount of power required when function is at full power.

Specified by:
getFullPowerRequired in class Function
Returns:
power (kW)

getPowerDownPowerRequired

public double getPowerDownPowerRequired()
Gets the amount of power required when function is at power down level.

Specified by:
getPowerDownPowerRequired in class Function
Returns:
power (kW)

getGrowingArea

public double getGrowingArea()
Gets the total growing area for all crops.

Returns:
growing area in square meters

getEstimatedHarvestPerOrbit

public double getEstimatedHarvestPerOrbit()
                                   throws java.lang.Exception
Gets the estimated maximum harvest for one orbit.

Returns:
max harvest (kg)
Throws:
java.lang.Exception - if error determining harvest.