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

fusion avec Camille

Showing with 689 additions and 73 deletions
+689 -73
......@@ -10,7 +10,7 @@
<linfVonBert>60.0</linfVonBert>
<dMaxDisp>300.0</dMaxDisp>
<lFirstMaturity>40.0</lFirstMaturity>
<fishNutrient>
<nutrientRoutine>
<nutrientsOfInterest>
<string>N</string>
<string>P</string>
......@@ -30,6 +30,14 @@
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>bLW_Gonad</string>
<double>3.3838</double>
</entry>
<entry>
<string>aLW_Gonad</string>
<double>-8.8744</double>
</entry>
<entry>
<string>bLW</string>
<double>2.1774</double>
......@@ -43,6 +51,14 @@
<entry>
<species.DiadromousFish_-Gender>FEMALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>bLW_Gonad</string>
<double>2.6729</double>
</entry>
<entry>
<string>aLW_Gonad</string>
<double>-5.2425</double>
</entry>
<entry>
<string>bLW</string>
<double>3.147</double>
......@@ -58,6 +74,14 @@
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>bLW_Gonad</string>
<double>3.8331</double>
</entry>
<entry>
<string>aLW_Gonad</string>
<double>-11.285</double>
</entry>
<entry>
<string>bLW</string>
<double>2.9973</double>
......@@ -71,6 +95,14 @@
<entry>
<species.DiadromousFish_-Gender>FEMALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>bLW_Gonad</string>
<double>2.8545</double>
</entry>
<entry>
<string>aLW_Gonad</string>
<double>-6.6234</double>
</entry>
<entry>
<string>bLW</string>
<double>2.9418</double>
......@@ -92,16 +124,6 @@
<double>0.006986429759979109</double>
</entry>
</juvenileFeatures>
<spawnedGametesWeight class="hashtable">
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
<double>44.8</double>
</entry>
<entry>
<species.DiadromousFish_-Gender>FEMALE</species.DiadromousFish_-Gender>
<double>131.0</double>
</entry>
</spawnedGametesWeight>
<compoCarcassPreSpawning class="hashtable">
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
......@@ -196,7 +218,8 @@
<double>0.02803</double>
</entry>
</compoJuvenile>
</fishNutrient>
</nutrientRoutine>
<fileNameInputForInitialObservation>data/input/reality/Obs1900.csv</fileNameInputForInitialObservation>
<centileForRange>0.95</centileForRange>
<parameterSetfileName>data/input/reality/parameterSet.csv</parameterSetfileName>
......@@ -245,19 +268,16 @@
<meanBvSurface>17351</meanBvSurface>
<standardDeviationBvSurface>35594</standardDeviationBvSurface>
<meanInterDistance>300.0</meanInterDistance>
<standardDeviationInterDistance>978.0
</standardDeviationInterDistance>
<standardDeviationInterDistance>978.0</standardDeviationInterDistance>
<pHomingForReachEquil>0.75</pHomingForReachEquil>
<pHomingAfterEquil>0.75</pHomingAfterEquil>
<NbYearForInstallPop>0</NbYearForInstallPop>
<riverMigrationSeason>SPRING</riverMigrationSeason>
<alpha2Rep>0.0</alpha2Rep>
<meanSpawnersLengthAtRepro>45.0</meanSpawnersLengthAtRepro>
<standardDeviationOfSpawnersLengthAtRepro>2.0
</standardDeviationOfSpawnersLengthAtRepro>
<standardDeviationOfSpawnersLengthAtRepro>2.0</standardDeviationOfSpawnersLengthAtRepro>
<weightOfDeathBasin>0.4</weightOfDeathBasin>
</species.DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin>
<species.Survive>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<tempMinMortGenInRiv>10.0</tempMinMortGenInRiv>
......@@ -268,8 +288,6 @@
<mortalityRateInSea>0.4</mortalityRateInSea>
<mortalityRateInOffshore>0.4</mortalityRateInOffshore>
</species.Survive>
<species.ReproduceAndSurviveAfterReproductionWithDiagnose>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<reproductionSeason>SPRING</reproductionSeason>
......@@ -314,8 +332,7 @@
</species.IdentifyPopulation>
<species.TypeTrajectoryCV>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<fileNameOutput>JeuParam100_2100RCP85_A_essai
</fileNameOutput>
<fileNameOutput>JeuParam100_2100RCP85_A_essai</fileNameOutput>
</species.TypeTrajectoryCV>
</processesAtEnd>
......
......@@ -62,7 +62,7 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
* Routine to compute nutrient fluxes operated by a single individual (TODO by a single super individual).
*
*/
private FishNutrient fishNutrient;
private NutrientRoutine nutrientRoutine;
public String fileNameInputForInitialObservation = "data/input/reality/Obs1900.csv";
......@@ -265,7 +265,7 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
diadromousFishGroup.fishNutrient = new FishNutrient(nutrientsOfInterest,aResidenceTime, anExcretionRate, aFeaturePreSpawning, aFeaturePostSpawning, aGameteSpawned,
diadromousFishGroup.nutrientRoutine = new NutrientRoutine(nutrientsOfInterest,aResidenceTime, anExcretionRate, aFeaturePreSpawning, aFeaturePostSpawning,
aCompoCarcassPreSpawning, aCompoCarcassPostSpawning, aCompoGametes,
aJuvenileFeatures, aCompoJuveniles);
......@@ -507,9 +507,9 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
return lFirstMaturity;
}
public FishNutrient getFishNutrient() {
public NutrientRoutine getNutrientRoutine() {
return fishNutrient;
return nutrientRoutine;
}
public void setlFirstMaturity(double lFirstMaturity) {
......
......@@ -9,8 +9,13 @@ import environment.Time;
import environment.Time.Season;
import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import miscellaneous.Duo;
import species.DiadromousFish.Stage;
import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = AquaNismsGroupProcess.class)
......@@ -28,19 +33,48 @@ public class MigrateToSea extends AquaNismsGroupProcess<DiadromousFish, Diadromo
if (Time.getSeason(group.getPilot()) == seaMigrationSeason ){
Basin destination;
List<Duo<DiadromousFish,Basin>> fishesToMove = new ArrayList<Duo<DiadromousFish,Basin>>();
for (int i = 0; i < group.getEnvironment().getRiverBasins().length; i++) {
RiverBasin basin = group.getEnvironment().getRiverBasins()[i];
List<DiadromousFish> fishes = basin.getFishs(group);
if (fishes!=null) for (DiadromousFish fish : fishes) {
destination = group.getEnvironment().getAssociatedSeaBasin(fish.getPosition());
fishesToMove.add(new Duo<DiadromousFish, Basin>(fish, destination));
}
}
for (Duo<DiadromousFish,Basin> duo : fishesToMove) {
duo.getFirst().moveTo(group.getPilot(), duo.getSecond(), group);
}
}
//On crer la Map pour stocker les flux d'export
Map<String, Double> totalOutputFluxes = new Hashtable<String, Double>();
List<Duo<DiadromousFish,Basin>> fishesToMove = new ArrayList<Duo<DiadromousFish,Basin>>();
for (int i = 0; i < group.getEnvironment().getRiverBasins().length; i++) {
RiverBasin basin = group.getEnvironment().getRiverBasins()[i];
//Fish move to sea and compute the related export of nutrients
List<DiadromousFish> fishes = basin.getFishs(group);
// ON r-initialise notre map pour chauqe bassin
for (String nutrient : group.getNutrientRoutine().getNutrientsOfInterest()) {
totalOutputFluxes.put(nutrient, 0.);
}
totalOutputFluxes.put("biomass", 0.); //cration de la biomasse
if (fishes!=null) {
for (DiadromousFish fish : fishes) {
destination = group.getEnvironment().getAssociatedSeaBasin(fish.getPosition());
fishesToMove.add(new Duo<DiadromousFish, Basin>(fish, destination)); //Mentionne la sortie d'un poisson de la boucle
double biomass = group.getNutrientRoutine().getWeight(fish) * fish.getAmount();
if (fish.getStage()==Stage.IMMATURE) {
Map <String, Double> aFluxExportedByJuveniles= group.getNutrientRoutine().computeNutrientsExportForJuveniles(fish);
for (String nutrient: aFluxExportedByJuveniles.keySet()) {
totalOutputFluxes.put(nutrient,totalOutputFluxes.get(nutrient) + aFluxExportedByJuveniles.get(nutrient) * fish.getAmount());
}
totalOutputFluxes.put("biomass", totalOutputFluxes.get("biomass") + biomass);
}
}
}
for (Duo<DiadromousFish,Basin> duo : fishesToMove) {
duo.getFirst().moveTo(group.getPilot(), duo.getSecond(), group); //on dplace les poissons dans le fichier MoveTo et on dnote la destination du poisson.
}
System.out.println(group.getPilot().getCurrentTime() + "; " + Time.getYear(group.getPilot()) + ";" + Time.getSeason(group.getPilot()) + ";EXPORT;"
+ basin.getName() + "; " + totalOutputFluxes);
}
}
}
}
}
\ No newline at end of file
......@@ -163,6 +163,7 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
survivalAmount = Miscellaneous.binomialForSuperIndividual(group.getPilot(), fish.getAmount(), survivalRateAfterReproduction);
if (survivalAmount > 0)
fish.setAmount(survivalAmount);
else
deadFish.add(fish);
}
......
......@@ -108,20 +108,23 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
List<DiadromousFish> fishInBasin = riverBasin.getFishs(group);
if (fishInBasin != null){
Map<String, Double> totalFluxes = new Hashtable<String, Double>(); //On cr�er la Map pour stocker les flux
for (String nutrient : group.getFishNutrient().getNutrientsOfInterest()) {
totalFluxes.put(nutrient, 0.); // ON MET A JOUR NOTRE map
//Initiate the total fluxes for this basin
Map<String, Map<String, Double>> totalInputFluxes = new Hashtable<String, Map <String, Double>>(); //On crer la Map pour stocker les flux
totalInputFluxes.put("autochtonous", new Hashtable < String, Double>());
totalInputFluxes.put("allochtonous", new Hashtable < String, Double>());
for (String origin: totalInputFluxes.keySet()) {
for (String nutrient : group.getNutrientRoutine().getNutrientsOfInterest()) {
totalInputFluxes.get(origin).put(nutrient, 0.); // ON MET A JOUR NOTRE map
}
totalInputFluxes.get(origin).put("biomass",0.);
}
// --------------------------------------------------------------------------------------------------
// definition of the stock recruiment relationship
// --------------------------------------------------------------------------------------------------
// effective temperature for reproduction (priority to the ANG value)
double tempEffectRep;
if (Double.isNaN(group.getTempMinRep())){
......@@ -152,7 +155,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// initilisation of the stock recruitment relationship
stockRecruitmentRelationship.init(alpha, beta, S50, S95);
// --------------------------------------------------------------------------------------------------
// calulation of the spawner number
// --------------------------------------------------------------------------------------------------
......@@ -162,15 +165,15 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// compute the number of spawners and keep the origines of the spawners
for (DiadromousFish fish : fishInBasin){
if (fish.getGender() == Gender.FEMALE & fish.isMature()){
//System.out.println(fish.getAge() + " -> "+ fish.getLength() + " ("+fish.getStage()+")");
if (fish.getNumberOfReproduction() < 1) {
numberOfFemaleSpawnerForFirstTime++;
femaleSpawnersForFirstTimeAgesSum += fish.getAge();
}
numberOfFemaleGenitors += fish.getAmount() ;
numberOfFemaleGenitors += fish.getAmount() ; // on ajoute a chaque fois le fish.getAmount (CcumSum)
// spawner per origine
String basinName = fish.getBirthBasin().getName();
......@@ -190,11 +193,49 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
fish.incNumberOfReproduction();
// survival after reproduction (semelparity or iteroparity) of SI (change the amount of the SI)
survivalAmount = Miscellaneous.binomialForSuperIndividual(group.getPilot(), fish.getAmount(), survivalRateAfterReproduction);
if (survivalAmount > 0)
fish.setAmount(survivalAmount);
survivalAmount = Miscellaneous.binomialForSuperIndividual(group.getPilot(), fish.getAmount(), survivalRateAfterReproduction);
double biomass = 0.;
String origin;
if(fish.getBirthBasin()== riverBasin)
origin = "autochtonous";
else
origin = "allochtonous";
if (survivalAmount > 0) {// SUperindividu est encore vivant mais il perd des effectifs
//Export for fishes survived after spawning (survivalAmount) : excretion + gametes
Map <String, Double> aFluxAfterSurvival = group.getNutrientRoutine().computeNutrientsInputForSurvivalAfterSpawning(fish);
//Export for fishes that dies after spawning (fish.getAmount - survivalAmount): excretion + gametes + carcasse
Map<String, Double> aFluxForDeadFish = group.getNutrientRoutine().computeNutrientsInputForDeathAfterSpawning(fish);
for (String nutrient: aFluxAfterSurvival.keySet()) {
//For survival fish
totalInputFluxes.get(origin).put(nutrient,totalInputFluxes.get(origin).get(nutrient) + aFluxAfterSurvival.get(nutrient) * survivalAmount);
//For dead fish
totalInputFluxes.get(origin).put(nutrient,totalInputFluxes.get(origin).get(nutrient) + aFluxForDeadFish.get(nutrient) * (fish.getAmount() - survivalAmount));
}
//compute biomass for dead fish
biomass = group.getNutrientRoutine().getWeight(fish) * (fish.getAmount() - survivalAmount);
totalInputFluxes.get(origin).put("biomass", totalInputFluxes.get(origin).get("biomass") + biomass);
//update the amount of individual in the super-individual
fish.setAmount(survivalAmount);
}
else {
//Le superindividu est mort !!!
deadFish.add(fish);
//Export for fished died before spawning (fish.getAmount): carcasses + excretion + gametes
Map<String, Double> aFlux = group.getNutrientRoutine().computeNutrientsInputForDeathAfterSpawning(fish); //
for (String nutrient: aFlux.keySet()) {
totalInputFluxes.get(origin).put(nutrient,totalInputFluxes.get(origin).get(nutrient) + aFlux.get(nutrient) * fish.getAmount()); //Fish.getAmount - survivalAmount = total fishes died.
}
biomass = group.getNutrientRoutine().getWeight(fish) * (fish.getAmount());
totalInputFluxes.get(origin).put("biomass", totalInputFluxes.get(origin).get("biomass") + biomass);
}
}
}
......@@ -269,9 +310,9 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// --------------------------------------------------------------------------------------------------
// Reproduction process (number of recruits)
// --------------------------------------------------------------------------------------------------
if (numberOfFemaleGenitors > 0.) {
//BH Stock-Recruitment relationship with logistic depensation
double meanNumberOfRecruit = stockRecruitmentRelationship.getRecruitment(numberOfFemaleGenitors);
......@@ -280,7 +321,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
long numberOfRecruit = Math.round(Math.exp(genNormal.nextDouble()*sigmaRecruitment + muRecruitment));
//System.out.println(group.getPilot().getCurrentTime()+" "+Time.getSeason(group.getPilot())+" "+ riverBasin.getName()+": " + numberOfGenitors + " spwaners \tgive "+ numberOfRecruit + " recruits");
// keep last % of autochtone
riverBasin.getLastPercentagesOfAutochtones().push(numberOfAutochtones * 100 / numberOfFemaleGenitors);
......@@ -350,28 +391,18 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// Remove deadfish and compute the related nutrient fluxes
// --------------------------------------------------------------------------------------------------
for (DiadromousFish fish : deadFish){
Map<String, Double> aFlux = group.getFishNutrient().computeNutrientsInputForDeathAfterSpawning(fish); //
for (String nutrient: aFlux.keySet()) {
totalFluxes.put(nutrient,totalFluxes.get(nutrient) + aFlux.get(nutrient) * fish.getAmount());
}
group.removeAquaNism(fish);
}
deadFish.clear();
//System.out.println(group.getPilot().getCurrentTime() + "; " + Time.getYear(group.getPilot()) + ";" + Time.getSeason(group.getPilot()) + ";"
//+ riverBasin.getName() + "; " + totalFluxes);
System.out.println(group.getPilot().getCurrentTime() + "; " + Time.getYear(group.getPilot()) + ";" + Time.getSeason(group.getPilot()) + ";IMPORT;"
+ riverBasin.getName() + "; " + totalInputFluxes);
}
else {
riverBasin.setYearOfLastNulRep(Time.getYear(group.getPilot()));
}
// System.out.println("("+numberOfGenitors+")");
//System.out.println(" BEFORE " +riverBasin.getSpawnerOrigins().keySet());
......
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