Version 1.2 (June 2013)
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
simulator.Simulator Class Reference

Top-level class of the simulation core. Used to create and run a simulation. More...

Public Member Functions

 Simulator (String protocolFile, String resultPath)
 Simulation Constructor. Initialise simulation with protocol file and relevant result and log file paths. More...
 
void run ()
 Method that starts the simulation, calling each timestep until the simulation time is over or the biofilm fills the domain. More...
 
boolean simulationIsRunning ()
 Utility method that determines whether the simulation is running. More...
 
void step ()
 Perform a full iteration of the simulation for the conditions stated in the protocol file. More...
 
void createSimulator ()
 Processes parameters specified in the SIMULATOR protocol file mark-up, sets the random number generator and creates the data dictionary. More...
 
void createFiles (String resultPath)
 Create simulation result and POV-Ray files within the required output folder. More...
 
void createDictionary ()
 Builds a set of dictionaries capturing the names of the solutes, particles, reactions, species, and solvers in this specific simulation. More...
 
void createWorld ()
 Processes the WORLD mark-up from the protocol file, initialising the bulk and computational domains. More...
 
void recreateBulkConditions () throws Exception
 Recreates bulk conditions if an initial state file was specified. More...
 
void createSolutes ()
 Initialises each solute specified in the protocol file, creating a solute grid for each and setting the initial concentration. More...
 
void createReactions () throws Exception
 Create all reactions described in the protocol file. More...
 
void createSolvers () throws Exception
 Creates the pressure solvers specified in the protocol file. More...
 
void createSpecies () throws Exception
 Creates the species, agent grids, and populations required for this simulation. More...
 
void recreateSpecies () throws Exception
 Create agents from a file describing individually all the agents species by species. Used if useAgentFile is true. More...
 
void checkAgentBirth ()
 Introduces a new agent to the simulation, initialises the specified birthday and initial area parameters. More...
 
boolean oneTimeAttachmentAgentBirth (XMLParser parser, int spIndex)
 Creates a specified number of agents within a specified area of the computation domain, where one time attachment is being employed. More...
 
boolean selfAttachmentAgentBirth (XMLParser parser, int spIndex)
 For self-attachment scenarios, creates the required number of agents per timestep. These migrate to the substratum or biofilm surface. More...
 
boolean create_Required_Number_Of_SelfAttaching_Agents (double cellAttachmentFrequency, XMLParser parser, int spIndex)
 Creates the required number of cells at the boundary layer in self-attachment scenarios. Differs dependent on whether within an injection period. More...
 
void writeReport ()
 Creates reports of concentrations of solutes and biomass on the default gird and a description of all agents. More...
 
void createCharts ()
 Deprecated internal chart creation method. Assumed deprecated as never called in code (KA 09/04/13) More...
 
void updateChart ()
 
int getSpeciesIndex (String aSpeciesName)
 Find a Species on the basis of its specified string name. More...
 
Species getSpecies (String aSpeciesName)
 Returns a species object for the given species name. More...
 
int getSoluteIndex (String aSoluteName)
 Return the integer reference specifying the position of a given solute in the solute dictionary. More...
 
SoluteGrid getSolute (String aSoluteName)
 
int getReactionIndex (String aReactionName)
 
Reaction getReaction (String aReactionName)
 Returns a reaction object for a reaction of a given name. More...
 
int getSolverIndex (String aSolverName)
 Returns an integer reference to the position of a solver in the simulation solver dictionary. More...
 
DiffusionSolver getSolver (String aSolverName)
 Returns a solver object of a specified name. More...
 
int getParticleIndex (String particleName)
 
void detectInputFiles (String protocolFile)
 Determines whether a previous run is being restarted, reading in the respective last state if this is the case. More...
 
String getResultPath ()
 Return the path to the simulation result files. More...
 

Public Attributes

transient XMLParser _protocolFile
 
transient PovRayWriter povRayWriter
 
transient ResultFile[] result
 
boolean is3D = false
 
boolean continueRunning = true
 
double agentTimeStep
 
String attachmentMechanism = "onetime"
 
World world
 
ArrayList< String > speciesDic
 
ArrayList< String > reactionDic
 
ArrayList< String > solverDic
 
ArrayList< String > particleDic
 
ArrayList< String > soluteDic
 
SoluteGrid[] soluteList
 
Reaction[] reactionList
 
DiffusionSolver[] solverList
 
ArrayList< Species > speciesList = new ArrayList<Species>()
 
ArrayList< String > plasmidList = new ArrayList<String>()
 
ArrayList< Double > scanSpeedList = new ArrayList<Double>()
 
AgentContainer agentGrid
 

Static Public Attributes

static boolean isChemostat =false
 
static boolean isFluctEnv =false
 
static boolean multiEpi =false
 
static boolean invComp = false
 
static SimTimer simTimer
 

Detailed Description

Top-level class of the simulation core. Used to create and run a simulation.

The Simulator class is called by the iDynomics class and creates an object that simulates the conditions specified in a given protocol file

Since
June 2006
Version
1.1
Author
Andreas Dötsch (andre.nosp@m.as.d.nosp@m.oetsc.nosp@m.h@he.nosp@m.lmhol.nosp@m.tz-h.nosp@m.zi.de), Helmholtz Centre for Infection Research (Germany)
Laurent Lardon (lardo.nosp@m.nl@s.nosp@m.upagr.nosp@m.o.in.nosp@m.ra.fr), INRA, France
Brian Merkey (brim@.nosp@m.env..nosp@m.dtu.d.nosp@m.k, bvm@n.nosp@m.orth.nosp@m.weste.nosp@m.rn.e.nosp@m.du), Department of Engineering Sciences and Applied Mathematics, Northwestern University (USA)
Sónia Martins (SCM80.nosp@m.8@bh.nosp@m.am.ac.nosp@m..uk), Centre for Systems Biology, University of Birmingham (UK)
Kieran Alden (k.j.a.nosp@m.lden.nosp@m.@bham.nosp@m..ac..nosp@m.uk), Centre for Systems Biology, University of Birmingham (UK)

Constructor & Destructor Documentation

simulator.Simulator.Simulator ( String  protocolFile,
String  resultPath 
)

Simulation Constructor. Initialise simulation with protocol file and relevant result and log file paths.

Creates the simulator object under which a simulation will be run for the conditions stated in the protocol file. This is called within the initSimulation method of the Idynomics class. The path to a protocol file and results folder is provided and the simulation initialised. Required species, solutes, world, and grids are created and set to their respective initial conditions, and result file objects created that will produce statistics at a specified frequency

Parameters
protocolFilePath to the protocol file specifying the conditions under which the simulation is run
resultPathPath to a relevant directory where the simulation results will be stored

Member Function Documentation

void simulator.Simulator.checkAgentBirth ( )

Introduces a new agent to the simulation, initialises the specified birthday and initial area parameters.

Introduces a new agent to the simulation, initialises the specified birthday and initial area parameters

boolean simulator.Simulator.create_Required_Number_Of_SelfAttaching_Agents ( double  cellAttachmentFrequency,
XMLParser  parser,
int  spIndex 
)

Creates the required number of cells at the boundary layer in self-attachment scenarios. Differs dependent on whether within an injection period.

For self-attachment scenarios, it is possible to model injection of cells during the simulation, as well as periods that follow where no cells are injected. In these cases, the number of cells injected from the boundary layer will differ (to model the fact that the attachment rate may be different in these periods). This rate is supplied to this function, and the required number of cells created

Parameters
cellAttachmentFrequencyThe number of cells to create at the boundary layer per hour, for this injection period
parserThe XML object for this species. From the simulation protocol file
spIndexThe index of this species in the simulation species list
Returns
A boolean noting whether any agents were created in this step
void simulator.Simulator.createCharts ( )

Deprecated internal chart creation method. Assumed deprecated as never called in code (KA 09/04/13)

Internal chart creation method. Assumed deprecated as never called in code (KA 09/04/13)

void simulator.Simulator.createDictionary ( )

Builds a set of dictionaries capturing the names of the solutes, particles, reactions, species, and solvers in this specific simulation.

Creates a set of dictionaries populated with the names of each of the solutes, particles, reactions, species, and solvers, that were specified in the XML protocol file

void simulator.Simulator.createFiles ( String  resultPath)

Create simulation result and POV-Ray files within the required output folder.

This method creates the required env_State, env_Sum, agent_State, agent_Sum and other required result files within a specified result directory. This also initialises a POV-Ray writing object that will produce data that can be represented using POV-Ray

Parameters
resultPathString stating the file path where these files should be created
void simulator.Simulator.createReactions ( ) throws Exception

Create all reactions described in the protocol file.

This method creates all the reactions that were described in the XML protocol file, storing these in an array of reaction objects.

void simulator.Simulator.createSimulator ( )

Processes parameters specified in the SIMULATOR protocol file mark-up, sets the random number generator and creates the data dictionary.

Within the XML file, the SIMULATOR mark-up defines the parameters that control the overall simulation. These are read in from the XML file by this method, initialising the simulation. These parameters include specifying whether this run is under chemostat conditions, the setting of the simulation timestep, and time interval between the generation of output files. The random number generator is also initialised, either from scratch or from a previous state if this is a re-run. Thirdly, the simulation timer is initialised. Finally, a data dictionary is created for use by other utility methods within the simulation

void simulator.Simulator.createSolutes ( )

Initialises each solute specified in the protocol file, creating a solute grid for each and setting the initial concentration.

In iDynoMiCS each solute exists in its own spatial grid. This method iterates through each specified solute and creates the necessary grid space, in either 2D or 3D as specified in the protocol file. Once the grid is initialised, the grid is populated with values representing the initial concentration levels of the solute, taken from the Sbulk specification in the protocol file

void simulator.Simulator.createSolvers ( ) throws Exception

Creates the pressure solvers specified in the protocol file.

This method processes the pressure solvers that are specified in the XML protocol file. These are used to compute the steady state solute profile within the computational domain

void simulator.Simulator.createSpecies ( ) throws Exception

Creates the species, agent grids, and populations required for this simulation.

This method is quite complex and is in three distinct parts. The first creates the species and progenitors, and registers these in the simulation. The second deals with the creation of the grids in which the species agents exist. Finally, populations of each species are created and initialised

void simulator.Simulator.createWorld ( )

Processes the WORLD mark-up from the protocol file, initialising the bulk and computational domains.

The world mark-up in the protocol file collects the description of all bulks and computational domains defined in the simulation. The bulk mark-up defines a bulk solute compartment that is a source or sink for solutes involved in biofilm growth. The computationDomain mark-up defines the spatial region the biofilm will grow in. Only one world may be defined, but this world may contain several bulk compartments and computationDomain domains, each with a different name. Though when simulating a chemostat scenario, the name of the bulk MUST be chemostat, regardless of the corresponding computationalDomain name. This method creates the world properties (e.g. system size and boundary conditions). In terms of boundary conditions, the current release allows you to create zero-flow, cyclic, constant and dilution boundaries. To create your own, create a new class extending the abstract class "BoundaryCondition"

void simulator.Simulator.detectInputFiles ( String  protocolFile)

Determines whether a previous run is being restarted, reading in the respective last state if this is the case.

Check whether we will initialize from agent and bulk input files. If the "restartPreviousRun" param is true, this will also set the correct files for reading in the last state

Parameters
protocolFileThe name of the protocol file for which the simulation is being restarted
int simulator.Simulator.getParticleIndex ( String  particleName)
Reaction simulator.Simulator.getReaction ( String  aReactionName)

Returns a reaction object for a reaction of a given name.

Returns a reaction object for a reaction of a given name

Parameters
aReactionNameThe name of the reaction to return
Returns
A reaction object that describes a specified reaction
int simulator.Simulator.getReactionIndex ( String  aReactionName)
String simulator.Simulator.getResultPath ( )

Return the path to the simulation result files.

Return the path to the simulation result files

Returns
String value stating the path to the result files
SoluteGrid simulator.Simulator.getSolute ( String  aSoluteName)
int simulator.Simulator.getSoluteIndex ( String  aSoluteName)

Return the integer reference specifying the position of a given solute in the solute dictionary.

The createDictionary method created a dictionary of all solutes used in the simulation. This method is used to return the index of a particular solute, found by the given solute name

Parameters
aSoluteNameThe name of the solute whos position in the dictionary is being sought
Returns
Integer specifying the position in the dictionary / list
DiffusionSolver simulator.Simulator.getSolver ( String  aSolverName)

Returns a solver object of a specified name.

Returns a solver object of a specified name

Parameters
aSolverNameName of the solver to return from the array of solvers
Returns
Solver object of the specified name
int simulator.Simulator.getSolverIndex ( String  aSolverName)

Returns an integer reference to the position of a solver in the simulation solver dictionary.

Parameters
aSolverNameThe name of the solver to reference
Returns
An integer value specifying the position of this solver in the simulation dictionary
Species simulator.Simulator.getSpecies ( String  aSpeciesName)

Returns a species object for the given species name.

Returns a species object for the given species name

Parameters
aSpeciesNameText string noting the name of the species object required
Returns
The species object of that specified name
int simulator.Simulator.getSpeciesIndex ( String  aSpeciesName)

Find a Species on the basis of its specified string name.

Returns a species on the basis of its specified string name

Parameters
aSpeciesName
Returns
the speciesIndex
boolean simulator.Simulator.oneTimeAttachmentAgentBirth ( XMLParser  parser,
int  spIndex 
)

Creates a specified number of agents within a specified area of the computation domain, where one time attachment is being employed.

From Version 1.2 of iDynoMiCS, different methods of attachment are being introduced alongside the original one-time adhesion to the substratum. This method captures the case in the original version of the tool, where a number of cells are created at a random location within a set region of the domain.

Parameters
parserThe XML tags contained within the "species" markup
spIndexThe index of this species in the simulation dictionary
Returns
A boolean noting whether any agents have been created
void simulator.Simulator.recreateBulkConditions ( ) throws Exception

Recreates bulk conditions if an initial state file was specified.

Get the bulk concentrations from the input file and assign them to the current bulks

Author
Brian Merkey (brim@.nosp@m.env..nosp@m.dtu.d.nosp@m.k, bvm@n.nosp@m.orth.nosp@m.weste.nosp@m.rn.e.nosp@m.du)
void simulator.Simulator.recreateSpecies ( ) throws Exception

Create agents from a file describing individually all the agents species by species. Used if useAgentFile is true.

It is possible to initialise the simulation with information in an agent file. If this is the case, the species will need to be created from information in this file. This method performs a simulation initialisation in that case

Exceptions
ExceptionException thrown if this file cannot be read correctly or file is not consistent with protocol file
void simulator.Simulator.run ( )

Method that starts the simulation, calling each timestep until the simulation time is over or the biofilm fills the domain.

Method that starts the simulation, calling each timestep until the simulation time is over or the biofilm fills the domain

boolean simulator.Simulator.selfAttachmentAgentBirth ( XMLParser  parser,
int  spIndex 
)

For self-attachment scenarios, creates the required number of agents per timestep. These migrate to the substratum or biofilm surface.

For self attachment scenarios, cells are initialised on the boundary layer surface rather than the substratum. iDynoMiCS then models the agents move towards the biofilm surface using a run and tumble motion. If the cell moves towards the biofilm or surface, the move continues until the cell attaches. If the move takes the cell back towards the bulk, we assume the cell is back in the mix and introduce a further cell for a new attempt at attaching.

Parameters
parserThe XML tags contained within the "species" markup
spIndexThe index of this species in the simulation dictionary
Returns
A boolean noting whether any agents have been created
boolean simulator.Simulator.simulationIsRunning ( )

Utility method that determines whether the simulation is running.

Utility method that determines whether the simulation is running

Returns
Boolean stating if the simulation is running (true) or has stopped (false)
void simulator.Simulator.step ( )

Perform a full iteration of the simulation for the conditions stated in the protocol file.

Perform a full iteration of the simulation initialised under the conditions in a given protocol file. Accessed via the simulators run method

void simulator.Simulator.updateChart ( )

Deprecated method. Not used in this version of iDynoMiCS (KA 09/04/13)

void simulator.Simulator.writeReport ( )

Creates reports of concentrations of solutes and biomass on the default gird and a description of all agents.

Generate a report with concentrations of solutes and biomass on the default grid and a report with the exhaustive description of all agents. Each report is a new file with a new index

Member Data Documentation

transient XMLParser simulator.Simulator._protocolFile

An XML parser of the protocol file that specifies the conditions under which this simulation is being run

AgentContainer simulator.Simulator.agentGrid

Grid where all located agents are stored

double simulator.Simulator.agentTimeStep

Allows user to define a smaller timestep for agent behaviors and interactions. Should always be EQUAL or LOWER than the global time step

String simulator.Simulator.attachmentMechanism = "onetime"

String that specifies the method of attachment used in the simulation. Can be 'onetime' - where the cells are placed randomly on the substratum, or self-attach, where the bacteria moves from the boundary layer to the substratum using a random walk. Defaults to onetime as this has been the method employed in previous versions of iDynomics. Added by Kieran, 170513.

boolean simulator.Simulator.continueRunning = true

Boolean controlling simulation stop point - set to false when a LocatedGroup is removed from above the threshold, thus ending the simulation. Added by Rob 5/3/11. To date only implemented in DS_SolGrad

boolean simulator.Simulator.invComp = false
static

Invasion/Competition simulation. Set to true if the simulation should stop once there is only one species left in the system

boolean simulator.Simulator.is3D = false

Flag that notes whether the simulation is 3D or 2D

boolean simulator.Simulator.isChemostat =false
static

Boolean that runs the simulation in chemostat conditions

boolean simulator.Simulator.isFluctEnv =false
static

Boolean stating whether we are using a fluctuating environment. Defaults to false

boolean simulator.Simulator.multiEpi =false
static

Flag that triggers the use of the MultiEpiBac and MultiEpisome classes. Added by Sonia Martins Jan 2011

ArrayList<String> simulator.Simulator.particleDic

Dictionary of all the particle objects in the specified protocol file. Allows to know the index of an object before its creation

ArrayList<String> simulator.Simulator.plasmidList = new ArrayList<String>()

List of plasmid carriage information, if creating a Multi Episome simulation. Sonia 07-05-09

transient PovRayWriter simulator.Simulator.povRayWriter

Writer for pov-ray output files. Used in biofilm simulations but not for modelling chemostats

ArrayList<String> simulator.Simulator.reactionDic

Dictionary of all the reaction objects in the specified protocol file. Allows to know the index of an object before its creation

Reaction [] simulator.Simulator.reactionList

Array of Reaction objects - one for each specified in the simulation protocol file

transient ResultFile [] simulator.Simulator.result

Array of result files produced by this simulation

ArrayList<Double> simulator.Simulator.scanSpeedList = new ArrayList<Double>()

List of all the scan speeds of all plasmids, if creating a Multi Episome simulation. Sonia 11-10-10

SimTimer simulator.Simulator.simTimer
static

Timer of the simulation

ArrayList<String> simulator.Simulator.soluteDic

Dictionary of all the solute objects in the specified protocl file. Allows to know the index of an object before its creation

SoluteGrid [] simulator.Simulator.soluteList

Array of solute grids - one for each solute specified in the simulation protocol file

ArrayList<String> simulator.Simulator.solverDic

Dictionary of all the solver objects in the specified protocol file. Allows to know the index of an object before its creation

DiffusionSolver [] simulator.Simulator.solverList

Array of Solver objects - one for each solver specified in the simulation protocol file

ArrayList<String> simulator.Simulator.speciesDic

Dictionary of all the species objects in the specified protocol file. Allows to know the index of an object before its creation

ArrayList<Species> simulator.Simulator.speciesList = new ArrayList<Species>()

Array of Species objects - one for each specifies in the simulation protocol file

World simulator.Simulator.world

Specification of all the geometry, bulks, and computational domains in the system being modelled


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