Commit 55dd75d1 authored by Lambert Patrick's avatar Lambert Patrick
Browse files

Merge branch 'Camille_Bis' into patrick

parents 4e6d67b6 92003b21
......@@ -152,34 +152,6 @@
</hashtable>
</entry>
</compoCarcassPreSpawning>
<compoCarcassPostSpawning class="hashtable">
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>P</string>
<double>0.00961</double>
</entry>
<entry>
<string>N</string>
<double>0.0279</double>
</entry>
</hashtable>
</entry>
<entry>
<species.DiadromousFish_-Gender>FEMALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>P</string>
<double>0.00997</double>
</entry>
<entry>
<string>N</string>
<double>0.03216</double>
</entry>
</hashtable>
</entry>
</compoCarcassPostSpawning>
<compoGametes class="hashtable">
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
......@@ -227,6 +199,7 @@
<yearOfTheUpdate>0</yearOfTheUpdate>
<basinsToUpdateFile>data/input/reality/basinsToUpdate.csv</basinsToUpdateFile>
<outputPath>data/output/</outputPath>
<minYearToWrite>1840</minYearToWrite>
<fileNameFluxes>nutrientFluxes</fileNameFluxes>
<lengthAtHatching>2.0</lengthAtHatching>
<linfVonBertForFemale>70.0</linfVonBertForFemale>
......@@ -300,18 +273,17 @@
<mortalityRateInOffshore>0.4</mortalityRateInOffshore>
</species.Survive>
<species.ExportFluxes>
<species.WriteEffectivesFluxes>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<exportSeason>SPRING</exportSeason>
<fileNameOutput>EffectiveFluxes</fileNameOutput>
</species.ExportFluxes>
<fileNameOutput>effectiveFluxes</fileNameOutput>
</species.WriteEffectivesFluxes>
<species.ExportBiomass>
<species.WriteBiomassFluxes>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<survivalRateAfterReproduction>0.1</survivalRateAfterReproduction>
<exportSeason>SPRING</exportSeason>
<fileNameOutput>BiomassFluxes</fileNameOutput>
</species.ExportBiomass>
<fileNameOutput>BiomassFluxessBeforeReproduction</fileNameOutput>
</species.WriteBiomassFluxes>
<species.ReproduceAndSurviveAfterReproductionWithDiagnose>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
......@@ -348,6 +320,11 @@
</processesEachStep>
<processesAtEnd>
<species.WriteImportNutrientFluxes>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<fileName>fluxes</fileName>
</species.WriteImportNutrientFluxes>
<species.IdentifyPopulation>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<consoleDisplay>false</consoleDisplay>
......@@ -358,6 +335,7 @@
</years>
<fileNameOutput>JeuParam100_2100RCP85_A_essai</fileNameOutput>
</species.IdentifyPopulation>
<species.TypeTrajectoryCV>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<fileNameOutput>JeuParam100_2100RCP85_A_essai</fileNameOutput>
......
......@@ -12,6 +12,8 @@ public class DiadromousFish extends AquaNism<Basin, BasinNetwork> {
//TODO replace UNDIFFERENCIED by UNDETERMINED
public static enum Gender {UNDIFFERENCIED, FEMALE, MALE};
public enum SpawnerOrigin {AUTOCHTONOUS, ALLOCHTONOUS};
private long amount;
/**
* age of the fish
......
......@@ -93,8 +93,11 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
*/
private String basinsToUpdateFile = "data/input/reality/basinsToUpdate.csv";
private String outputPath = "data/output/";
private String outputPath = "data/output/" ;
private long minYearToWrite = 1900;
//TODO:remove fileNameFluxes
private String fileNameFluxes = "fluxes";
private transient BufferedWriter bWForFluxes;
......@@ -176,7 +179,7 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
// =================================================
// calibration
// =================================================
private Double targetedAgeForFemaleSpawnerForFirstTime = 5.5;
private Double targetedAgeForMaleSpawnerForFirstTime = 4.5;
......@@ -318,7 +321,7 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
nutrientsOfInterest.add("P");
diadromousFishGroup.nutrientRoutine = new NutrientRoutine(nutrientsOfInterest,aResidenceTime, anExcretionRate, aFeaturePreSpawning, aFeaturePostSpawning, aCompoCarcassPreSpawning, aCompoCarcassPostSpawning,
diadromousFishGroup.nutrientRoutine = new NutrientRoutine(nutrientsOfInterest,aResidenceTime, anExcretionRate, aFeaturePreSpawning, aFeaturePostSpawning, aCompoCarcassPreSpawning,
aCompoGametes, aJuvenileFeatures, aCompoJuveniles);
......@@ -498,12 +501,15 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
} catch (IOException ex) {
Logger.getLogger(DiadromousFishGroup.class.getName()).log(Level.SEVERE, null, ex);
}
// defaut values
if (targetedAgeForFemaleSpawnerForFirstTime == null)
targetedAgeForFemaleSpawnerForFirstTime = 5.5;
if (targetedAgeForMaleSpawnerForFirstTime == null)
targetedAgeForMaleSpawnerForFirstTime = 4.5;
//this.nutrientRoutine.getNutrientFluxesCollection().setBasinNames(this.getEnvironment().getRiverBasinNames());
this.nutrientRoutine.createNutrienFluxesCollection(this.getEnvironment().getRiverBasinNames());
}
......@@ -662,6 +668,13 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
}
/**
* @return the minYearToWrite
*/
public long getMinYearToWrite() {
return minYearToWrite;
}
// ================================================================
// statictis for calibration
// ================================================================
......@@ -709,8 +722,8 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
}
return sum/nb;
}
public double computeMaleSpawnerForFirstTimeSummaryStatisticWithTarget(double TARGET ) {
double sum = 0;
for (RiverBasin riverBasin : getEnvironment().getRiverBasins()) {
......@@ -727,7 +740,7 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
public double computeMaleSpawnerForFirstTimeSummaryStatistic() {
return computeMaleSpawnerForFirstTimeSummaryStatisticWithTarget(targetedAgeForFemaleSpawnerForFirstTime);
}
@Observable(description="mean age of first reprodution for male")
public double getMeanAgeOfFirstReprodutionForMale() {
double sum = 0;
......@@ -753,8 +766,8 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
}
return sum/nb;
}
@Observable(description = "Likelihood Summary stat")
public double computeLikelihood() {
int obsVal;
......@@ -932,7 +945,7 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
}
return eff;
}
/**
* @return sum of male spawner effectives in all the river basins
*/
......
......@@ -24,8 +24,12 @@ import fr.cemagref.simaqualife.pilot.Pilot;
import species.DiadromousFish.Gender;
import species.DiadromousFish.Stage;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
......@@ -91,7 +95,7 @@ public class NutrientRoutine {
* <key> chemical element
* <value> value
*/
private Map<DiadromousFish.Gender, Map<String, Double>> compoCarcassPostSpawning;
//private Map<DiadromousFish.Gender, Map<String, Double>> compoCarcassPostSpawning;
/**
* chemical composition of gametes estimated from the MIGADO dataset (BDalosesBruch)
......@@ -112,9 +116,11 @@ public class NutrientRoutine {
private Map<String,Double> compoJuvenile;
private transient NutrientFluxesCollection nutrientFluxesCollection;
public NutrientRoutine() {
public NutrientRoutine() {
this.nutrientFluxesCollection = new NutrientFluxesCollection();
}
/**
......@@ -132,7 +138,7 @@ public class NutrientRoutine {
Map<DiadromousFish.Gender, Map<String, Double>> fishFeaturesPreSpawning,
Map<DiadromousFish.Gender, Map<String, Double>> fishFeaturesPostSpawning,
Map<DiadromousFish.Gender, Map<String, Double>> compoCarcassPreSpawning,
Map<DiadromousFish.Gender, Map<String, Double>> compoCarcassPostSpawning,
//Map<DiadromousFish.Gender, Map<String, Double>> compoCarcassPostSpawning,
Map<DiadromousFish.Gender, Map<String, Double>> compoGametes,
Map<String, Double> juvenileFeatures,
Map<String, Double> compoJuvenile)
......@@ -144,11 +150,22 @@ public class NutrientRoutine {
this.fishFeaturesPreSpawning = fishFeaturesPreSpawning;
this.fishFeaturesPostSpawning = fishFeaturesPostSpawning;
this.compoCarcassPreSpawning = compoCarcassPreSpawning;
this.compoCarcassPostSpawning = compoCarcassPostSpawning;
//this.compoCarcassPostSpawning = compoCarcassPostSpawning;
this.compoGametes = compoGametes;
this.juvenileFeatures = juvenileFeatures;
this.compoJuvenile = compoJuvenile;
this.nutrientFluxesCollection = new NutrientFluxesCollection();
}
public void createNutrienFluxesCollection(String[] basinNames) {
nutrientFluxesCollection = new NutrientFluxesCollection();
nutrientFluxesCollection.setBasinNames(basinNames);
}
public NutrientFluxesCollection getNutrientFluxesCollection() {
return nutrientFluxesCollection;
}
/**
......@@ -176,8 +193,6 @@ public class NutrientRoutine {
nutrientsInput.put(nutrient, 0.);
}
}
//TODO Multiply by fish amount
return nutrientsInput;
}
......@@ -200,16 +215,16 @@ public class NutrientRoutine {
if (fish.getStage()== Stage.MATURE) {
double totalWeightPost = this.getWeight(fish, SpawningPosition.POST);
double totalWeightPost = this.getWeight(fish, SpawningPosition.PRE);
double carcass = totalWeightPost
* compoCarcassPostSpawning.get(fish.getGender()).get(nutrient);
* compoCarcassPreSpawning.get(fish.getGender()).get(nutrient);
//double gametes = (totalWeightPre - totalWeightPost) FAUX car perte de poids somatique due a la reproduction
double gametes = this.getGonadWeight(fish, SpawningPosition.PRE) - this.getGonadWeight(fish, SpawningPosition.POST)
*compoGametes.get(fish.getGender()).get(nutrient);
//double gametes = (this.getGonadWeight(fish, SpawningPosition.PRE) - this.getGonadWeight(fish, SpawningPosition.POST))
//*compoGametes.get(fish.getGender()).get(nutrient);
double excretion = totalWeightPost
* residenceTime
* excretionRate.get(nutrient);
double nutrientImport = carcass + gametes + excretion;
double nutrientImport = carcass + excretion;
nutrientsInput.put(nutrient,nutrientImport);
}
......@@ -220,6 +235,8 @@ public class NutrientRoutine {
return nutrientsInput;
}
public Map<String, Double> computeNutrientsInputForDeathAfterSpawning(DiadromousFish fish){
return computeNutrientsInputForDeathAfterSpawning(fish, this.nutrientsOfInterest);
......@@ -237,10 +254,9 @@ public class NutrientRoutine {
if (fish.getStage()==Stage.MATURE) {
//TODO Fix with new data
double totalWeightPost = this.getWeight(fish, SpawningPosition.POST);
double totalWeightPost = this.getWeight(fish, SpawningPosition.PRE);
//Gamete compositions depends on sex.
double gametes = this.getGonadWeight(fish, SpawningPosition.PRE) - this.getGonadWeight(fish, SpawningPosition.POST)
double gametes = (this.getGonadWeight(fish, SpawningPosition.PRE) - this.getGonadWeight(fish, SpawningPosition.POST))
* compoGametes.get(fish.getGender()).get(nutrient);
double excretion = totalWeightPost
* residenceTime
......@@ -294,8 +310,8 @@ public class NutrientRoutine {
if (spawningPosition == SpawningPosition.PRE)
weight = fishFeaturesPreSpawning.get(fish.getGender()).get("aLW") * Math.pow(fish.getLength(), fishFeaturesPreSpawning.get(fish.getGender()).get("bLW") );
else
weight = fishFeaturesPostSpawning.get(fish.getGender()).get("aLW") * Math.pow(fish.getLength(), fishFeaturesPostSpawning.get(fish.getGender()).get("bLW"));
//weight = fishFeaturesPostSpawning.get(fish.getGender()).get("aLW") * Math.pow(fish.getLength(), fishFeaturesPostSpawning.get(fish.getGender()).get("bLW"));
weight = fishFeaturesPreSpawning.get(fish.getGender()).get("aLW") * Math.pow(fish.getLength(), fishFeaturesPreSpawning.get(fish.getGender()).get("bLW") );
return weight;
}
......@@ -380,7 +396,7 @@ public class NutrientRoutine {
aFeature.put("aLW", 1.2102E-6 * Math.pow(10., aFeature.get("bLW"))); //weight size relationship -- Conversion des g/mm en g.cm (from Taverny, 1991)
aFeature.put("bLW_Gonad", 2.6729); // issu de la relation taille - poids des gonades Bruch
aFeature.put("aLW_Gonad", -5.2425); // issu de la relation taille - poids des gonades Bruch
aFeaturePreSpawning.put(Gender.FEMALE, aFeature);
/*
......@@ -444,18 +460,18 @@ public class NutrientRoutine {
System.out.println("aCompoCarcassPreSpawning: " + aCompoCarcassPreSpawning.toString()); //
// carcass composition for fish after spawning
Map<Gender, Map<String, Double>> aCompoCarcassPostSpawning = new Hashtable<DiadromousFish.Gender,Map<String,Double>>();
aCompo = new Hashtable<String,Double>();
aCompo.put("N", 3.216 / 100.); //On remplit une collection avec un put.
aCompo.put("P", 0.997 / 100.);
aCompoCarcassPostSpawning.put(Gender.FEMALE,aCompo);
//Map<Gender, Map<String, Double>> aCompoCarcassPostSpawning = new Hashtable<DiadromousFish.Gender,Map<String,Double>>();
//aCompo = new Hashtable<String,Double>();
//aCompo.put("N", 3.216 / 100.); //On remplit une collection avec un put.
//aCompo.put("P", 0.997 / 100.);
//aCompoCarcassPostSpawning.put(Gender.FEMALE,aCompo);
aCompo = new Hashtable<String,Double>();
aCompo.put("N", 2.790 / 100.); // From Haskel et al, 2017
aCompo.put("P", 0.961 / 100.);
aCompoCarcassPostSpawning.put(Gender.MALE,aCompo);
//aCompo = new Hashtable<String,Double>();
//aCompo.put("N", 2.790 / 100.); // From Haskel et al, 2017
//aCompo.put("P", 0.961 / 100.);
//aCompoCarcassPostSpawning.put(Gender.MALE,aCompo);
System.out.println("aCompoCarcassPostSpawning: " + aCompoCarcassPostSpawning.toString()); //
//System.out.println("aCompoCarcassPostSpawning: " + aCompoCarcassPostSpawning.toString()); //
// Gametes composition approximated by the difference between gonads weight before and after spawning.
Map<Gender, Map<String, Double>> aCompoGametes = new Hashtable<DiadromousFish.Gender,Map<String,Double>>();
......@@ -494,7 +510,7 @@ public class NutrientRoutine {
NutrientRoutine fn = new NutrientRoutine(nutrientsOfInterest,aResidenceTime, anExcretionRate, aFeaturePreSpawning, aFeaturePostSpawning,
aCompoCarcassPreSpawning, aCompoCarcassPostSpawning, aCompoGametes,
aCompoCarcassPreSpawning, aCompoGametes,
aJuvenileFeatures, aCompoJuveniles);
SeaBasin basin = new SeaBasin(0,"Bidon",10.,12., 14.,12.); //il faut aller dans "SeaBasin" dans "environement et regarder comment est construit le constructeur. Il lui faut ici un rang, un nom de bassin versant, et des temp�rature pour chaque saison
......@@ -529,6 +545,70 @@ public class NutrientRoutine {
System.out.println((new XStream(new DomDriver())).toXML(fn));
}
public class NutrientFluxesCollection {
/*
* <key> Year
* <value>
* <key> Nutrient
* <value>
* <key> origin basin name
* <value>
* <key> destination basin name
* <value> flux
*/
//
private Map<Long, Map <String, Map<String, Map<String, Double>>>> fluxesCollection ;
private transient String[] basinNames;
NutrientFluxesCollection() {
fluxesCollection = new HashMap <Long, Map <String, Map<String, Map<String, Double>>>> ();
}
public Map<Long, Map<String, Map<String, Map<String, Double>>>> getFluxesCollection() {
return fluxesCollection;
}
public void setBasinNames(String[] basinNames) {
this.basinNames = basinNames;
}
public void put(Long year,String nutrient, String originBasinName, String destinationBasinName, Double flux ) {
if(!fluxesCollection.containsKey(year)) {
Map <String, Map <String, Map <String, Double>>> nutrientsMap = new TreeMap <String, Map <String, Map <String, Double>>>();
for (String nutrientOfInterest : nutrientsOfInterest) {
Map <String, Map <String, Double>> originsMap = new TreeMap <String, Map <String, Double>>();
for (String originName : basinNames) {
Map <String, Double> destinationsMap = new HashMap <String, Double>();
for (String destinationName : basinNames) {
destinationsMap.put(destinationName, 0.);
}
originsMap.put(originName, destinationsMap);
}
nutrientsMap.put(nutrientOfInterest, originsMap);
}
fluxesCollection.put(year,nutrientsMap);
}
double previousFlux = fluxesCollection.get(year).get(nutrient).get(originBasinName).get(destinationBasinName);
fluxesCollection.get(year).get(nutrient).get(originBasinName).put(destinationBasinName, previousFlux + flux);
}
}
}
......@@ -20,7 +20,7 @@ import com.thoughtworks.xstream.io.xml.DomDriver;
public class NutrientRoutineEssay {
private static enum SpawningPosition {PRE,POST}; // on crer un static pour rserver une mme classe mmoire pour toutes les instances
private static enum SpawningPosition {PRE,POST}; // on cr�er un static pour r�server une m�me classe m�moire pour toutes les instances
//private static enum Gender {UNDIFFERENCIED, FEMALE, MALE};
......@@ -32,7 +32,7 @@ public class NutrientRoutineEssay {
/**
* Main feature for weight (g) computation before spawning i.e. gametes expelling according to gender, for a given length (cm)
* //Voir pour un retour la ligne lors du commentaire
* //Voir pour un retour � la ligne lors du commentaire
* key gender
* value
* key feature
......@@ -63,9 +63,9 @@ public class NutrientRoutineEssay {
*/
private Map<DiadromousFish.Gender,Map<String,Double>> compoCarcassPreSpawning;
 
//La class d'objet Map a pour point faible la taille des donnes stocker. Plus on a de valeur dans la table, plus c'est lourd et lent! Donc, trouver un compromis entre temps de calcul et espace.
//N'accepte pas la valeur nulle et thread safe i.e. utilisable simultanment par plusieurs lments du programme.
 
//La class d'objet Map a pour point faible la taille des donn�es � stocker. Plus on a de valeur dans la table, plus c'est lourd et lent! Donc, trouver un compromis entre temps de calcul et espace.
//N'accepte pas la valeur nulle et thread safe i.e. utilisable simultan�ment par plusieurs �l�ments du programme.
/**
......@@ -128,7 +128,7 @@ public class NutrientRoutineEssay {
*/
public Map<String,Double> computeNutrientsInputForDeadFish(DiadromousFish fish, ArrayList<String> nutrientsOfInterest) {
Map<String,Double> nutrientsInput = new Hashtable<String, Double>(); // On crer ici une Map, classe mre des hashtable (Homme = classe mere ie Map//Jules = hashtable)
Map<String,Double> nutrientsInput = new Hashtable<String, Double>(); // On cr�er ici une Map, classe m�re des hashtable (Homme = classe mere ie Map//Jules = hashtable)
for (String nutrient : nutrientsOfInterest) {
if (fish.getStage()== Stage.MATURE) {
......@@ -168,7 +168,7 @@ public class NutrientRoutineEssay {
for (String nutrient: nutrientsOfInterest) {
if (fish.getStage()==Stage.MATURE) {
double totalWeightPre = this.getWeight(fish,SpawningPosition.PRE);
double gametes = this.getGonadWeight(fish, SpawningPosition.PRE) - this.getGonadWeight(fish, SpawningPosition.POST)
double gametes = (this.getGonadWeight(fish, SpawningPosition.PRE) - this.getGonadWeight(fish, SpawningPosition.POST))
* compoGametes.get(fish.getGender()).get(nutrient);
double excretion = totalWeightPre
* residenceTime
......@@ -373,7 +373,7 @@ public class NutrientRoutineEssay {
aCompoGametes.put(Gender.FEMALE,aCompo);
aCompo = new Hashtable<String,Double>();
aCompo.put("N", 3.250 / 100.); // Approxime par la compo des gonades
aCompo.put("N", 3.250 / 100.); // Approxim�e par la compo des gonades
aCompo.put("P", 0.724 / 100.);
aCompoGametes.put(Gender.MALE,aCompo);
......@@ -404,7 +404,7 @@ public class NutrientRoutineEssay {
NutrientRoutineEssay fn = new NutrientRoutineEssay(nutrientsOfInterest,aResidenceTime, anExcretionRate, aFeaturePreSpawning, aFeaturePostSpawning,
aCompoCarcassPreSpawning, aCompoGametes, aJuvenileFeatures, aCompoJuveniles);
SeaBasin basin = new SeaBasin(0,"Bidon",10.,12., 14.,12.); //il faut aller dans "SeaBasin" dans "environement et regarder comment est construit le constructeur. Il lui faut ici un rang, un nom de bassin versant, et des temprature pour chaque saison
SeaBasin basin = new SeaBasin(0,"Bidon",10.,12., 14.,12.); //il faut aller dans "SeaBasin" dans "environement et regarder comment est construit le constructeur. Il lui faut ici un rang, un nom de bassin versant, et des temp�rature pour chaque saison
Pilot pilot = new Pilot ();
DiadromousFish fishFemale = new DiadromousFish (pilot, basin, 52., 1L, Gender.FEMALE); //Idem ici, on regarde comment est construit DiadromousFih et on lui donne les valeur de ce qu'il nous demande.
fishFemale.setStage(Stage.MATURE);
......
......@@ -17,6 +17,7 @@ import miscellaneous.Duo;
import miscellaneous.Miscellaneous;
import miscellaneous.Trio;
import species.DiadromousFish.Gender;
import species.DiadromousFish.SpawnerOrigin;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.optim.MaxEval;
......@@ -68,7 +69,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
private transient NormalGen genNormal;
private transient MortalityFunction mortalityFunction;
private enum fluxOrigin {AUTOCHTONOUS, ALLOCHTONOUS};
/**
* relationship between
* recruitment in number of juvenile on spawning grounds
......@@ -111,9 +112,10 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
basinList.add("Somme");
basinList.add("Meuse");
basinList. add("Rhine");
System.out.print(group.getPilot().getCurrentTime() + " - ");
if (displayFluxesOnConsole == true)
System.out.print(group.getPilot().getCurrentTime() + " - ");
for(RiverBasin riverBasin : group.getEnvironment().getRiverBasins()){
// before the party !!!!
......@@ -145,10 +147,10 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
if (fishInBasin != null){
//Initiate the total fluxes for this basin
Map<fluxOrigin, Map<String, Double>> totalInputFluxes = new Hashtable<fluxOrigin, Map <String, Double>>(); //On cr�er la Map pour stocker les flux
totalInputFluxes.put(fluxOrigin.AUTOCHTONOUS, new Hashtable < String, Double>());
totalInputFluxes.put(fluxOrigin.ALLOCHTONOUS, new Hashtable < String, Double>());
for (fluxOrigin origin: totalInputFluxes.keySet()) {
Map<SpawnerOrigin, Map<String, Double>> totalInputFluxes = new Hashtable<SpawnerOrigin, Map <String, Double>>(); //On cr�er la Map pour stocker les flux
totalInputFluxes.put(SpawnerOrigin.AUTOCHTONOUS, new Hashtable < String, Double>());
totalInputFluxes.put(SpawnerOrigin.ALLOCHTONOUS, new Hashtable < String, Double>());
for (SpawnerOrigin origin: totalInputFluxes.keySet()) {
for (String nutrient : group.getNutrientRoutine().getNutrientsOfInterest()) {
totalInputFluxes.get(origin).put(nutrient, 0.); // ON MET A JOUR NOTRE map
}
......@@ -243,11 +245,11 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
fish.incNumberOfReproduction();
// origin of the spwaner
fluxOrigin spawnerOrigin;
SpawnerOrigin spawnerOrigin;
if (fish.getBirthBasin() == riverBasin)
spawnerOrigin = fluxOrigin.AUTOCHTONOUS;
spawnerOrigin = SpawnerOrigin.AUTOCHTONOUS;
else
spawnerOrigin = fluxOrigin.ALLOCHTONOUS;
spawnerOrigin = SpawnerOrigin.ALLOCHTONOUS;
// survival after reproduction (semelparity or iteroparity) of SI (change the amount of the SI)
double biomass = 0.;
......@@ -258,17 +260,27 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// compute nutrient fluxes
if (survivalAmount > 0) {// SUperindividu est encore vivant mais il perd des effectifs
//Export for fishes survived after spawning (survivalAmount) : excretion + gametes
//Export for one fish 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
//Export for one fish 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
//For all survival fish
group.getNutrientRoutine().getNutrientFluxesCollection().
put(Time.getYear(group.getPilot()), nutrient, fish.getBirthBasin().getName(), riverBasin.getName(), aFluxAfterSurvival.get(nutrient) * survivalAmount);
//For all dead fish
group.getNutrientRoutine().getNutrientFluxesCollection().
put(Time.getYear(group.getPilot()), nutrient, fish.getBirthBasin().getName(), riverBasin.getName(), aFluxForDeadFish.get(nutrient) * (fish.getAmount() - survivalAmount));
}
for (String nutrient: aFluxAfterSurvival.keySet()) {
//For all survival fish
totalInputFluxes.get(spawnerOrigin).put(nutrient,totalInputFluxes.get(spawnerOrigin).get(nutrient) + aFluxAfterSurvival.get(nutrient) * survivalAmount);
//For dead fish
//For all dead fish
totalInputFluxes.get(spawnerOrigin).put(nutrient,totalInputFluxes.get(spawnerOrigin).get(nutrient) + aFluxForDeadFish.get(nutrient) * (fish.getAmount() - survivalAmount));
}
......@@ -283,11 +295,12 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
//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); //
//Export for fished died after spawning (fish.getAmount): carcasses + excretion + gametes