View Javadoc

1   /*
2    * @(#) FCenter.java Apr 19, 2004
3    * 
4    * Copyright (c) 2003 Delft University of Technology Jaffalaan 5, 2628 BX Delft,
5    * the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  package nl.tudelft.simulation.sne.c1;
11  
12  import java.rmi.RemoteException;
13  import java.util.Properties;
14  
15  import nl.tudelft.simulation.dsol.formalisms.dess.DifferentialEquation;
16  import nl.tudelft.simulation.dsol.simulators.DESSSimulatorInterface;
17  
18  /***
19   * The concentration of aggregates consisting of F-centers.
20   * <p>
21   * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
22   * University of Technology </a>, the Netherlands. <br>
23   * See for project information <a
24   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
25   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
26   * License (GPL) </a>, no warranty <br>
27   * 
28   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
29   *         Jacobs </a>
30   * @version 1.2 Apr 19, 2004
31   * @since 1.4
32   */
33  public class FCenter extends DifferentialEquation
34  {
35  	/*** the initial production */
36  	private double p = 0.0;
37  
38  	/*** the constants used for computation */
39  	private double kr = 1.0;
40  
41  	/*** the constants used for computation */
42  	private double kf = 0.1;
43  
44  	/*** the constants used for computation */
45  	private double lf = 1000;
46  
47  	/*** the constants used for computation */
48  	private double dr = 0.1;
49  
50  	/*** the constants used for computation */
51  	private double dm = 1.0;
52  
53  	/***
54  	 * constructs a new FCenter
55  	 * 
56  	 * @param simulator
57  	 * @param timeStep
58  	 * @param numericalMethod
59  	 * @throws RemoteException on network failure
60  	 */
61  	public FCenter(DESSSimulatorInterface simulator, double timeStep,
62  			short numericalMethod) throws RemoteException
63  	{
64  		super(simulator, timeStep, numericalMethod);
65  
66  		//Let's parse the properties
67  
68  		Properties properties = this.simulator.getReplication().getRunControl()
69  				.getTreatment().getProperties();
70  
71  		this.kr = new Double(properties.getProperty("kr")).doubleValue();
72  		this.kf = new Double(properties.getProperty("kf")).doubleValue();
73  		this.dr = new Double(properties.getProperty("dr")).doubleValue();
74  		this.dm = new Double(properties.getProperty("dm")).doubleValue();
75  		this.lf = new Double(properties.getProperty("lf")).doubleValue();
76  
77  		//We set the production
78  		this.p = new Double(properties.getProperty("p0")).doubleValue();
79  
80  		//Now we initialize
81  		double t0 = new Double(properties.getProperty("t0")).doubleValue();
82  		double r0 = new Double(properties.getProperty("r0")).doubleValue();
83  		double m0 = new Double(properties.getProperty("m0")).doubleValue();
84  		double f0 = new Double(properties.getProperty("f0")).doubleValue();
85  
86  		this.initialize(t0, new double[]{r0, m0, f0});
87  	}
88  
89  	/***
90  	 * @see nl.tudelft.simulation.dsol.formalisms.dess.DifferentialEquationInterface#dy(double,
91  	 *      double[])
92  	 */
93  	public double[] dy(double time, double[] y)
94  	{
95  		double[] dy = new double[3];
96  		double drr = this.dr * y[0];
97  		double dmm = this.dm * y[1];
98  		double krmf = this.kr * y[1] * y[2];
99  		double kfff = this.kf * Math.pow(y[2], 2);
100 		double lff = this.lf * y[2];
101 
102 		dy[0] = krmf - drr;
103 		dy[1] = drr - dmm + kfff - krmf;
104 		dy[2] = drr + 2 * dmm - krmf - 2 * kfff - lff + this.p;
105 		return dy;
106 	}
107 
108 	/***
109 	 * gets the value of lf
110 	 * 
111 	 * @return
112 	 */
113 	public double getLf()
114 	{
115 		return lf;
116 	}
117 
118 	/***
119 	 * sets the value of lf
120 	 * 
121 	 * @param lf
122 	 */
123 	public void setLf(double lf)
124 	{
125 		this.lf = lf;
126 	}
127 
128 	/***
129 	 * returns the value of p
130 	 * 
131 	 * @return p
132 	 */
133 	public double getP()
134 	{
135 		return this.p;
136 	}
137 }