Commit d782ae40 authored by Lambert Patrick's avatar Lambert Patrick
Browse files

@Deprecated

Showing with 38 additions and 35 deletions
+38 -35
......@@ -27,8 +27,8 @@ import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
import fr.cemagref.simaqualife.kernel.util.TransientParameters.InitTransientParameters;
import fr.cemagref.simaqualife.pilot.Pilot;
@Deprecated
@ServiceProvider(service = AquaNismsGroupProcess.class)
public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGroup>{
// for the calibration of the model we use S_etoileGir = 190000; surfGir = 80351;
......@@ -49,10 +49,8 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
private double survivalRateAfterReproduction = 0.1;
private double maxNumberOfSuperIndividualPerReproduction = 50.;
private transient NormalGen genNormal;
// private transient UniformGen genUniform;
public static void main(String[] args) { System.out.println((new
XStream(new DomDriver())) .toXML(new ReproduceAndSurviveAfterReproduction())); }
......@@ -93,14 +91,15 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
// origins of spawner during this reproduction
Map<String, Long> spawnerOriginsDuringReproduction = new HashMap<String, Long>(group.getEnvironment().getRiverBasinNames().length);
for (String basinName : group.getEnvironment().getRiverBasinNames()){
spawnerOriginsDuringReproduction.put(basinName, (long) 0);
spawnerOriginsDuringReproduction.put(basinName, 0L);
}
// System.out.println("REPRODUCTION in "+riverBasin.getName()+" : FISH FROM ");
List<DiadromousFish> fishInBasin = riverBasin.getFishs(group);
if (fishInBasin != null){
//Calcul of b and c in stock-recruitment relationships
// effective temperature for reproduction (priority to the ANG value)
double tempEffectRep;
if (group.getTempMinRep() == Double.NaN){
tempEffectRep = Miscellaneous.temperatureEffect(riverBasin.getCurrentTemperature(group.getPilot()), tempMinRep, tempOptRep, tempMaxRep);
......@@ -109,36 +108,36 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
tempEffectRep = Miscellaneous.temperatureEffect(riverBasin.getCurrentTemperature(group.getPilot()), group.getTempMinRep(), tempOptRep, tempMaxRep);
}
if (tempEffectRep == 0.)
b=0;
else
b = - Math.log(survOptRep * tempEffectRep) / delta_t;
// Compute the prelimenary parameters b and c for the stock-recruitment relationship
b = (tempEffectRep == 0.) ? 0. : - Math.log(survOptRep * tempEffectRep) / delta_t;
c = lambda/riverBasin.getAccessibleSurface();
// Calcul of alpha and beta of the basin
// Compute alpha and beta parameters of the the stock-recruitment relationship
alpha = (b * Math.exp(- b * delta_t))/(c * (1 - Math.exp(- b * delta_t)));
beta = b / (a * c * (1 - Math.exp(- b * delta_t)));
//System.out.println(a+ ", " +b + ", " + c + ", " + delta_t + "= "+ alpha);
// keep the last value of alpha (productive capacities)
riverBasin.getLastProdCapacities().push(alpha);
// Calcul of the amount per superIndividual
// Compute the amount per superIndividual
amountPerSuperIndividual = alpha / maxNumberOfSuperIndividualPerReproduction;
// Calcul of Setoile, S95 and S50
Setoile = eta * riverBasin.getAccessibleSurface();
S95 = Setoile;
// Compute the Allee effect parameters S95 and S50
S95 = eta * riverBasin.getAccessibleSurface(); // corresponds to S* in the rougier publication
S50 = S95 / ratioS95_S50;
// compute the number of spawners and keep the origines of the spawners
// initilisation of the stock recruitment relationship
//stockRecruitmentRelationship.init(alpha, beta, S50, S95);
// age of autochnonous spawnser
//Map<Integer, Long> ageOfNativeSpawners = new TreeMap<Integer, Long>();
// compute the number of spawners and keep the origine of the spawners
for( DiadromousFish fish : fishInBasin){
if( fish.isMature()){
if (fish.getNumberOfReproduction() < 1) {
numberOfSpawnerForFirstTime++;
numberOfSpawnerForFirstTime++; //ASK individual or super-individual ?
spawnersForFirstTimeAgesSum += fish.getAge();
}
numberOfGenitors += fish.getAmount() ;
......@@ -147,18 +146,17 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
String basinName = fish.getBirthBasin().getName();
spawnerOriginsDuringReproduction.put(basinName, spawnerOriginsDuringReproduction.get(basinName) + fish.getAmount() );
// number of autochtone and age of autochnone
if (riverBasin == fish.getBirthBasin()){
// number of autochtonous fish per age
/*if (riverBasin == fish.getBirthBasin()){
numberOfAutochtones += fish.getAmount();
/*Integer age = (int) Math.floor(fish.getAge());
Integer age = (int) Math.floor(fish.getAge());
if (ageOfNativeSpawners.containsKey(age))
ageOfNativeSpawners.put(age, ageOfNativeSpawners.get(age)+fish.getAmount());
else
ageOfNativeSpawners.put(age, fish.getAmount());*/
}
ageOfNativeSpawners.put(age, fish.getAmount());
} */
//System.out.println("l'�ge du poisson est :" + fish.getAge() + " et la saison est :" + Time.getSeason());
// Survive After Reproduction
// increment number of reproduction (for possible iteroparty)
fish.incNumberOfReproduction();
// survival after reproduction (semelparity or iteroparity) of SI (change the amount of the SI)
......@@ -170,6 +168,7 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
}
}
System.out.println(" numberOfGenitors: "+ numberOfGenitors);
/*
// calcul de la mortalit� associ�e aux g�niteurs autochtones
if (numberOfGenitors > 0.) {
......@@ -210,12 +209,15 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
double meanNumberOfRecruit =
Math.round((alpha * numberOfGenitors * (1 / (1 + Math.exp(- Math.log(19)*((numberOfGenitors - S50) / (S95 - S50)))))) /
(beta + numberOfGenitors * (1 / (1 + Math.exp(- Math.log(19)*((numberOfGenitors - S50) / (S95 - S50)))))));
muRecruitment = Math.log(meanNumberOfRecruit) - (Math.pow(sigmaRecruitment,2))/2;
// lognormal random draw
muRecruitment = Math.log(meanNumberOfRecruit) - (Math.pow(sigmaRecruitment,2))/2;
long numberOfRecruit = Math.round(Math.exp(genNormal.nextDouble()*sigmaRecruitment + muRecruitment));
// keep last % of autochtone
riverBasin.getLastPercentagesOfAutochtones().push(numberOfAutochtones * 100 / numberOfGenitors);
// keep the number of spawners for the firt time in the basin
if (numberOfSpawnerForFirstTime>0){
riverBasin.getSpawnersForFirstTimeMeanAges().push(spawnersForFirstTimeAgesSum/numberOfSpawnerForFirstTime);
}else{
......@@ -226,25 +228,26 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
//System.out.println("nb recruit in basin " + riverBasin.getName() + " : " + numberOfRecruit);
// Creation of new superFish
if(numberOfRecruit > 0){
// stock the first year when recruitment is non nul
if(riverBasin.getYearOfFirstNonNulRep() == 0){
riverBasin.setYearOfFirstNonNulRep(Time.getYear(group.getPilot()));
}
if (numberOfRecruit > 0){
// features of the super individuals
int numberOfsuperIndividual = Math.max(1,
(int) Math.round(numberOfRecruit / amountPerSuperIndividual));
long effectiveAmount = numberOfRecruit / numberOfsuperIndividual;
// System.out.println(numberOfRecruit + " / " + amountPerSuperIndividual +" = " +numberOfsuperIndividual);
//System.out.println(numberOfRecruit + " / " + numberOfsuperIndividual +" = " +effectiveAmount);
for (int i=0; i<numberOfsuperIndividual; i++){
group.addAquaNism(new DiadromousFish(group.getPilot(), riverBasin, initialLength, effectiveAmount, Gender.UNDIFFERENCIED));
}
// stock the first year when recruitment is non nul
if (riverBasin.getYearOfFirstNonNulRep() == 0){
riverBasin.setYearOfFirstNonNulRep(Time.getYear(group.getPilot()));
}
riverBasin.getLastRecruitmentExpectations().push(Math.round(meanNumberOfRecruit));
riverBasin.getLastRecruitments().push(numberOfsuperIndividual * effectiveAmount); // on remplit la pile qui permet de stocker un nombre fix� de derniers recrutement
riverBasin.getLastRecsOverProdCaps().push(((double) riverBasin.getLastRecruitments().getLastItem())/riverBasin.getLastProdCapacities().getLastItem());
if (numberOfAutochtones > 0){
riverBasin.getNumberOfNonNulRecruitmentForFinalProbOfPres().push(1.0);
riverBasin.getNumberOfNonNulRecruitmentDuringLastYears().push(1.0);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment