Version 1.2 (June 2013)
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
simulator.geometry.FluctEnv Class Reference
Inheritance diagram for simulator.geometry.FluctEnv:
simulator.geometry.Bulk

Public Member Functions

 FluctEnv (Simulator aSim, XMLParser aBulkRoot) throws FileNotFoundException
 
ArrayList< String > envDic () throws FileNotFoundException
 
double[][] envProb () throws FileNotFoundException
 
double[][] envCumProb () throws FileNotFoundException
 
Matrix transMatrix () throws FileNotFoundException
 
double setEnv () throws FileNotFoundException
 
ArrayList< Integer > indexCalc () throws FileNotFoundException
 
double transProbVal () throws FileNotFoundException
 
String envTransName () throws FileNotFoundException
 
- Public Member Functions inherited from simulator.geometry.Bulk
 Bulk (Simulator aSim, XMLParser aBulkRoot)
 Creates a bulk compartment object with attributes specified in the protocol file. More...
 
void updateBulk (SoluteGrid[] soluteGrid, SoluteGrid[] reacGrid, double timeStep)
 Updates the bulk solute concentration if the bulk is not constant. More...
 
void updateChemostatBulk (SoluteGrid[] allSol, SoluteGrid[] reacGrid)
 Method to update Bulk solute concentrations during a chemostat setup. More...
 
void updateBulkByReaction (SoluteGrid[] reacGrid, double timeStep)
 Update bulk concentration by reaction, determining reaction rate seen from reaction compartments. More...
 
void updateBulkByGradient (SoluteGrid[] soluteGrid, double timeStep)
 Update bulk concentration on the basis of the flow passed through the interface with the bulk compartment. More...
 
void computeFlow (SoluteGrid aSG, DiscreteVector aDC, ContinuousVector flow)
 Compute massic flow. More...
 
Boolean contains (int soluteIndex)
 Determine if a particular solute is in the bulk. More...
 
double getValue (int soluteIndex)
 Get the value of a particular solute in the bulk. More...
 
void setValue (int soluteIndex, double value)
 Set the value of a particular solute in the bulk. More...
 
String getName ()
 Get the name of this bulk. More...
 
double getTimeConstraint ()
 Return the time constraint of the bulk. More...
 
void writeReport (ResultFile buffer) throws Exception
 Writes a description of the bulk in the result file. More...
 

Static Public Member Functions

static String setEnvCycle (int index)
 

Static Public Attributes

static ArrayList< String > envName = new ArrayList<String>()
 
static double[][] envCumProb
 
static double[][] transitions
 
static ArrayList< Integer > indices = new ArrayList<Integer>()
 
static ArrayList< String > envTrans = new ArrayList<String>()
 
static double cumProb =0
 
static double transProb = 0
 
static HashMap< String, Double > envListTime = new HashMap<String, Double>()
 
static ArrayList< String > envNameList = new ArrayList<String>()
 
static HashMap< String, Integer > envIter = new HashMap<String, Integer>()
 
static String envStatus
 
static double counter = 0
 

Additional Inherited Members

- Public Attributes inherited from simulator.geometry.Bulk
Simulator mySim
 
double[] _bulkValue
 
double _D
 
double[] _sIn
 
Boolean[] _isConstant
 

Detailed Description

This class is intended to randomly change the external environment felt by the agents. The transition between these different states is determined by a transition probability matrix whose values are in probability per hour. The correspondent cumulative probability matrix is used to decide the next state, simply because it avoids the problem of having 2 equal values (and thus having to decide randomly between them...). It has also been implemented the recalculation of the cumulative probability values according to the current time step (as long as it is lower or equal to 1h... since higher values would produce probabilities higher than 1...)

It has also been implemented a method to deterministically change the environmental conditions and their duration.

Author
SoniaMartins

Constructor & Destructor Documentation

simulator.geometry.FluctEnv.FluctEnv ( Simulator  aSim,
XMLParser  aBulkRoot 
) throws FileNotFoundException

public FluctEnv(Simulator aSim, String name) { super(aSim, name);

}

Member Function Documentation

double [][] simulator.geometry.FluctEnv.envCumProb ( ) throws FileNotFoundException

reads a txt file containing the cumulative probability matrix describing the transitions between environments.

Returns
double 2D array envCumProb
Exceptions
FileNotFoundException
ArrayList<String> simulator.geometry.FluctEnv.envDic ( ) throws FileNotFoundException

reads a text file containing the names of the environments involved and returns a list with those names

Returns
ArrayList
Exceptions
FileNotFoundException
double [][] simulator.geometry.FluctEnv.envProb ( ) throws FileNotFoundException

reads a txt file containing a "table" with the transitions probabilities and returns a 2D array of it

Returns
double 2D array transitions
Exceptions
FileNotFoundException
String simulator.geometry.FluctEnv.envTransName ( ) throws FileNotFoundException

taking into account the retrieved indices, builds a list with the names of the environments involved in the transitions in the correct order

Returns
ArrayList
Exceptions
FileNotFoundException
ArrayList<Integer> simulator.geometry.FluctEnv.indexCalc ( ) throws FileNotFoundException

knowing the cumpr_val and the which row of probabilities is being used for this iteration, we can infer the indices of the cumulative probability matrix that correspond to the environment transition.

Returns
arrayList indices
Exceptions
FileNotFoundException
double simulator.geometry.FluctEnv.setEnv ( ) throws FileNotFoundException

this method sets the new environment state according to the condition: 1st cumulative probability>= random number; it returns the cumulative probability value that has been chosen; This is called in the step() in Simulator class and it is by default commented out.

Returns
double cumpr_val
Exceptions
FileNotFoundException
static String simulator.geometry.FluctEnv.setEnvCycle ( int  index)
static

This method is the deterministic version of environment fluctuations, where different environments have defined time durations thus cycling between them at defined time points.

Parameters
index
Returns
the environment Name just set.
Matrix simulator.geometry.FluctEnv.transMatrix ( ) throws FileNotFoundException

transforms the 2D array containing the transition probabilities into a matrix whose format can be used to perform matrix operations

Returns
Matrix
Exceptions
FileNotFoundException
double simulator.geometry.FluctEnv.transProbVal ( ) throws FileNotFoundException

we would also like to know to which transition probability value is this transition associated with; that's what is done here. Using the indices we can retrieve the transition probability value.

Returns
Exceptions
FileNotFoundException

Member Data Documentation

double simulator.geometry.FluctEnv.counter = 0
static
double simulator.geometry.FluctEnv.cumProb =0
static
double [][] simulator.geometry.FluctEnv.envCumProb
static
HashMap<String,Integer> simulator.geometry.FluctEnv.envIter = new HashMap<String, Integer>()
static
HashMap<String, Double> simulator.geometry.FluctEnv.envListTime = new HashMap<String, Double>()
static
ArrayList<String> simulator.geometry.FluctEnv.envName = new ArrayList<String>()
static
ArrayList<String> simulator.geometry.FluctEnv.envNameList = new ArrayList<String>()
static
String simulator.geometry.FluctEnv.envStatus
static
ArrayList<String> simulator.geometry.FluctEnv.envTrans = new ArrayList<String>()
static
ArrayList<Integer> simulator.geometry.FluctEnv.indices = new ArrayList<Integer>()
static
double [][] simulator.geometry.FluctEnv.transitions
static
double simulator.geometry.FluctEnv.transProb = 0
static

The documentation for this class was generated from the following file: