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

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

public class ResourceProcess
extends java.lang.Object
implements java.io.Serializable

The ResourceProcess class represents a process of converting one set of resources to another.

See Also:
Serialized Form

Field Summary
static double TOGGLE_RUNNING_WORK_TIME_REQUIRED
           
 
Constructor Summary
ResourceProcess(java.lang.String name, boolean defaultOn)
          Constructor
 
Method Summary
 void addMaxInputResourceRate(AmountResource resource, double rate, boolean ambient)
          Adds a maximum input resource rate if it doesn't already exist.
 void addMaxOutputResourceRate(AmountResource resource, double rate, boolean waste)
          Adds a maximum output resource rate if it doesn't already exist.
 void addToggleWorkTime(double time)
          Adds work time to toggling the process on or off.
 double getCurrentProductionLevel()
          Gets the current production level of the process.
 java.util.Set<AmountResource> getInputResources()
          Gets the set of input resources.
 double getMaxInputResourceRate(AmountResource resource)
          Gets the max input resource rate for a given resource.
 double getMaxOutputResourceRate(AmountResource resource)
          Gets the max output resource rate for a given resource.
 java.util.Set<AmountResource> getOutputResources()
          Gets the set of output resources.
 java.lang.String getProcessName()
          Gets the process name.
 boolean isAmbientInputResource(AmountResource resource)
          Checks if resource is an ambient input.
 boolean isProcessRunning()
          Checks if the process is running or not.
 boolean isWasteOutputResource(AmountResource resource)
          Checks if resource is a waste output.
 void processResources(double time, double productionLevel, Inventory inventory)
          Processes resources for a given amount of time.
 java.lang.String toString()
          Gets the string value for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOGGLE_RUNNING_WORK_TIME_REQUIRED

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

ResourceProcess

public ResourceProcess(java.lang.String name,
                       boolean defaultOn)
Constructor

Parameters:
name - the name of the process.
defaultOn - true of process is on by default, false if off by default.
Method Detail

getProcessName

public java.lang.String getProcessName()
Gets the process name.

Returns:
process name as string.

addMaxInputResourceRate

public void addMaxInputResourceRate(AmountResource resource,
                                    double rate,
                                    boolean ambient)
Adds a maximum input resource rate if it doesn't already exist.

Parameters:
resource - the amount resource.
rate - max input resource rate (kg/sec)
ambient - is resource from available from surroundings? (air)

addMaxOutputResourceRate

public void addMaxOutputResourceRate(AmountResource resource,
                                     double rate,
                                     boolean waste)
Adds a maximum output resource rate if it doesn't already exist.

Parameters:
resource - the amount resource.
rate - max output resource rate (kg/sec)
waste - is resource waste material not to be stored?

getCurrentProductionLevel

public double getCurrentProductionLevel()
Gets the current production level of the process.

Returns:
proportion of full production (0D - 1D)

isProcessRunning

public boolean isProcessRunning()
Checks if the process is running or not.

Returns:
true if process is running.

addToggleWorkTime

public void addToggleWorkTime(double time)
Adds work time to toggling the process on or off.

Parameters:
time - the amount (millisols) of time to add.

getInputResources

public java.util.Set<AmountResource> getInputResources()
Gets the set of input resources.

Returns:
set of resources.

getMaxInputResourceRate

public double getMaxInputResourceRate(AmountResource resource)
Gets the max input resource rate for a given resource.

Returns:
rate in kg/sec.

isAmbientInputResource

public boolean isAmbientInputResource(AmountResource resource)
Checks if resource is an ambient input.

Parameters:
resource - the resource to check.
Returns:
true if ambient resource.

getOutputResources

public java.util.Set<AmountResource> getOutputResources()
Gets the set of output resources.

Returns:
set of resources.

getMaxOutputResourceRate

public double getMaxOutputResourceRate(AmountResource resource)
Gets the max output resource rate for a given resource.

Returns:
rate in kg/sec.

isWasteOutputResource

public boolean isWasteOutputResource(AmountResource resource)
Checks if resource is a waste output.

Parameters:
resource - the resource to check.
Returns:
true if waste output.

processResources

public void processResources(double time,
                             double productionLevel,
                             Inventory inventory)
                      throws java.lang.Exception
Processes resources for a given amount of time.

Parameters:
time - (millisols)
productionLevel - proportion of max process rate (0.0D - 1.0D)
inventory - the inventory pool to use for processes.
Throws:
java.lang.Exception - if error processing resources.

toString

public java.lang.String toString()
Gets the string value for this object.

Overrides:
toString in class java.lang.Object
Returns:
string