Commit 270faa2b authored by Lambert Patrick's avatar Lambert Patrick
Browse files

with groth different between male and female

parent e4859e1f
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
<blue>0</blue> <blue>0</blue>
<alpha>255</alpha> <alpha>255</alpha>
</color> </color>
<linfVonBert>70.0</linfVonBert>
<dMaxDisp>300.0</dMaxDisp> <dMaxDisp>300.0</dMaxDisp>
<linfVonBertForFemale>70.0</linfVonBertForFemale>
<linfVonBertForMale>70.0</linfVonBertForMale>
<lFirstMaturityForFemale>55.0</lFirstMaturityForFemale> <lFirstMaturityForFemale>55.0</lFirstMaturityForFemale>
<lFirstMaturityForMale>40.0</lFirstMaturityForMale> <lFirstMaturityForMale>40.0</lFirstMaturityForMale>
<lengthAtHatching>2</lengthAtHatching>
<nutrientRoutine> <nutrientRoutine>
<nutrientsOfInterest> <nutrientsOfInterest>
<string>N</string> <string>N</string>
...@@ -233,7 +235,7 @@ ...@@ -233,7 +235,7 @@
<species.PopulateBasinNetworkWithANorthLimit> <species.PopulateBasinNetworkWithANorthLimit>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode> <synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<nbSIPerBasin>200</nbSIPerBasin> <nbSIPerBasin>200</nbSIPerBasin>
<initialLength>2.0</initialLength> <initialLength>20.0</initialLength>
<nbFishPerSI>2500</nbFishPerSI> <nbFishPerSI>2500</nbFishPerSI>
<northLimitLatitude>43.54</northLimitLatitude> <northLimitLatitude>43.54</northLimitLatitude>
</species.PopulateBasinNetworkWithANorthLimit> </species.PopulateBasinNetworkWithANorthLimit>
......
...@@ -36,39 +36,21 @@ import species.DiadromousFish.Gender; ...@@ -36,39 +36,21 @@ import species.DiadromousFish.Gender;
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
/**
*
*/
@ServiceProvider(service = AquaNismsGroup.class) @ServiceProvider(service = AquaNismsGroup.class)
public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNetwork> implements Comparable<DiadromousFishGroup> { public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNetwork> implements Comparable<DiadromousFishGroup> {
public String name = "species A"; public String name = "species A";
public Color color = Color.RED; public Color color = Color.RED;
/**
* L infinity of the van Bertalanffy growth curve
* L = Linf *(1-exp(-K*(t-t0))
* @unit cm
*/
public double linfVonBert = 60.;
/** /**
* ???? * ????
* @unit * @unit
*/ */
public double dMaxDisp = 300.; public double dMaxDisp = 300.;
/**
* length at first maturity. At that length the female become Stage.MATURE
* @unit cm
*/
public double lFirstMaturityForFemale = 55.;
/**
* length at first maturity. At that length the female become Stage.MATURE
* @unit cm
*/
public double lFirstMaturityForMale = 40.;
/** /**
* Routine to compute nutrient fluxes operated by a single individual (TODO by a single super individual). * Routine to compute nutrient fluxes operated by a single individual (TODO by a single super individual).
* *
...@@ -127,6 +109,28 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe ...@@ -127,6 +109,28 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
*/ */
private transient Map<String, Duo<Double, Double>> basinsToUpdate; private transient Map<String, Duo<Double, Double>> basinsToUpdate;
/**
* length when fish hatchs ( when the diadromousFish is created after reproduction)
* no diffrence between gender
* @unit cm
*/
private double lengthAtHatching = 2.;
/**
* L infinity of the van Bertalanffy growth curve for female
* L = Linf *(1-exp(-K*(t-t0))
* @unit cm
*/
public double linfVonBertForFemale = 60.;
/**
* L infinity of the van Bertalanffy growth curve for male
* L = Linf *(1-exp(-K*(t-t0))
* @unit cm
*/
public double linfVonBertForMale = 60.;
/** /**
* Brody growth coefficient of the von Bertalanffy growth curve for female (calculated from the parameterset file) * Brody growth coefficient of the von Bertalanffy growth curve for female (calculated from the parameterset file)
* * L = Linf *(1-exp(-K*(t-t0)) * * L = Linf *(1-exp(-K*(t-t0))
...@@ -141,6 +145,20 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe ...@@ -141,6 +145,20 @@ public class DiadromousFishGroup extends AquaNismsGroup< DiadromousFish, BasinNe
*/ */
private transient double kOptForMale; private transient double kOptForMale;
/**
* length at first maturity. At that length the female become Stage.MATURE
* @unit cm
*/
public double lFirstMaturityForFemale = 55.;
/**
* length at first maturity. At that length the female become Stage.MATURE
* @unit cm
*/
public double lFirstMaturityForMale = 40.;
/** /**
* minimum temperature for the reproduction (from the parameterset file) * minimum temperature for the reproduction (from the parameterset file)
* @unit °C * @unit °C
...@@ -560,28 +578,38 @@ public BufferedWriter getbWForFluxes() { ...@@ -560,28 +578,38 @@ public BufferedWriter getbWForFluxes() {
return color; return color;
} }
public double getLinfVonBert() { public double getLinfVonBert(DiadromousFish fish) {
return linfVonBert; if ( fish.getGender() == Gender.FEMALE)
} return linfVonBertForFemale;
else if (fish.getGender() == Gender.MALE)
public void setLinfVonBert(double linfVonBert) { return linfVonBertForMale;
this.linfVonBert = linfVonBert; else
return (linfVonBertForFemale+linfVonBertForMale)/2.;
} }
public double getdMaxDisp() {
return dMaxDisp;
}
public double getlFirstMaturityForFemale() { public double getlFirstMaturity(DiadromousFish fish) {
if ( fish.getGender() == Gender.FEMALE)
return lFirstMaturityForFemale; return lFirstMaturityForFemale;
else if (fish.getGender() == Gender.MALE)
return lFirstMaturityForMale;
else
return (lFirstMaturityForFemale+lFirstMaturityForFemale)/2.;
} }
public double getlFirstMaturityForMale() { /**
return lFirstMaturityForMale; * @return the lengthAtHatching
*/
public double getLengthAtHatching() {
return lengthAtHatching;
} }
public double getdMaxDisp() {
return dMaxDisp;
}
public NutrientRoutine getNutrientRoutine() { public NutrientRoutine getNutrientRoutine() {
return nutrientRoutine; return nutrientRoutine;
} }
......
...@@ -49,26 +49,26 @@ public class DisperseAndMigrateToRiver extends DisperseAndMigrateToRiverBasic { ...@@ -49,26 +49,26 @@ public class DisperseAndMigrateToRiver extends DisperseAndMigrateToRiverBasic {
if (fish.isMature()) { if (fish.isMature()) {
// fish with homing // fish with homing
amountWithHoming = Miscellaneous.binomialForSuperIndividual(group.getPilot(), fish.getAmount(), pHoming); // seuil par dfaut fix 50 amountWithHoming = Miscellaneous.binomialForSuperIndividual(group.getPilot(), fish.getAmount(), pHoming); // seuil par dfaut fix� � 50
// strayed fish // strayed fish
strayedAmount = fish.getAmount() - amountWithHoming; strayedAmount = fish.getAmount() - amountWithHoming;
if (strayedAmount != 0) { if (strayedAmount != 0) {
// On rcupre les info du poids des bassin par rapport la position du poisson // On rcupre les info du poids des bassin par rapport la position du poisson
Map<Basin,Double> accBasOfFish= new TreeMap<Basin, Double>(accessibleBasinsPerBasin.get(fish.getPosition())); Map<Basin,Double> accBasOfFish= new TreeMap<Basin, Double>(accessibleBasinsPerBasin.get(fish.getPosition()));
//accBasOfFish = accessibleBasinsPerBasin.get(fish.getPosition()); //accBasOfFish = accessibleBasinsPerBasin.get(fish.getPosition());
// On retire certains bassins si on considre une distance max de dispersion // On retire certains bassins si on considre une distance max de dispersion
distBasOfFish = distanceBasinsPerBasin.get(fish.getPosition()); distBasOfFish = distanceBasinsPerBasin.get(fish.getPosition());
if (group.getdMaxDisp() != 0){ if (group.getdMaxDisp() != 0){
// TODO pourquoi distbasoffish peut tre nul ? // TODO pourquoi distbasoffish peut tre nul ?
if (distBasOfFish != null){ if (distBasOfFish != null){
dMaxDispFish = (group.getdMaxDisp()/group.getLinfVonBert())*fish.getLength(); dMaxDispFish = (group.getdMaxDisp()/group.getLinfVonBert(fish))*fish.getLength();
// load accessible basins // load accessible basins
for (Basin surroundingBasin : distBasOfFish.keySet()){ for (Basin surroundingBasin : distBasOfFish.keySet()){
Double distance = distBasOfFish.get(surroundingBasin); Double distance = distBasOfFish.get(surroundingBasin);
//System.out.println("pour le poisson " + fish.hashCode() + " situ dans le bassin " + basin.getName() + " et n dans le bassin " + fish.getBirthBasin().getName()); //System.out.println("pour le poisson " + fish.hashCode() + " situ dans le bassin " + basin.getName() + " et n dans le bassin " + fish.getBirthBasin().getName());
//System.out.println("la distance vaut " + distance + " pour le bassin " + surroundingBasin.getName()); //System.out.println("la distance vaut " + distance + " pour le bassin " + surroundingBasin.getName());
if (distance >= dMaxDispFish) { if (distance >= dMaxDispFish) {
accBasOfFish.remove(surroundingBasin); accBasOfFish.remove(surroundingBasin);
...@@ -81,7 +81,7 @@ public class DisperseAndMigrateToRiver extends DisperseAndMigrateToRiverBasic { ...@@ -81,7 +81,7 @@ public class DisperseAndMigrateToRiver extends DisperseAndMigrateToRiverBasic {
double totalWeight = 0.; double totalWeight = 0.;
double probToGo = 0.; double probToGo = 0.;
long amountToGo = 0; long amountToGo = 0;
// TODO Qu'est ce qui se passe si AccBasOfFish est vide... a beug pas mais c'est pas trs clair... donc vrifier // TODO Qu'est ce qui se passe si AccBasOfFish est vide... a beug pas mais c'est pas trs clair... donc vrifier
for (Basin accBasin : accBasOfFish.keySet()){ for (Basin accBasin : accBasOfFish.keySet()){
double accBasinWeightLogit = accBasOfFish.get(accBasin) + alpha2Rep * fish.getLength(); double accBasinWeightLogit = accBasOfFish.get(accBasin) + alpha2Rep * fish.getLength();
double accBasinWeight = 1 / (1 + Math.exp(- accBasinWeightLogit)); double accBasinWeight = 1 / (1 + Math.exp(- accBasinWeightLogit));
...@@ -107,7 +107,7 @@ public class DisperseAndMigrateToRiver extends DisperseAndMigrateToRiverBasic { ...@@ -107,7 +107,7 @@ public class DisperseAndMigrateToRiver extends DisperseAndMigrateToRiverBasic {
if (amountWithHoming > 0){ if (amountWithHoming > 0){
fish.setAmount(amountWithHoming); fish.setAmount(amountWithHoming);
// retour soit dans le bassin de naissance pour les semelpares // retour soit dans le bassin de naissance pour les semelpares
// soit dans le dernier bassin de reproduction pour les itropares // soit dans le dernier bassin de reproduction pour les itropares
fish.moveTo(group.getPilot(), bn.getAssociatedRiverBasin(fish.getPosition()), group); fish.moveTo(group.getPilot(), bn.getAssociatedRiverBasin(fish.getPosition()), group);
} else { } else {
deadFish.add(fish); deadFish.add(fish);
......
...@@ -41,7 +41,7 @@ public class DisperseAndMigrateToRiverStandardization extends AquaNismsGroupProc ...@@ -41,7 +41,7 @@ public class DisperseAndMigrateToRiverStandardization extends AquaNismsGroupProc
public void initTransientParameters(Pilot pilot) { public void initTransientParameters(Pilot pilot) {
super.initTransientParameters(pilot); super.initTransientParameters(pilot);
// calcul les poids des bassins voisins qui ne dpendent pas des poissons pour chaque SeaBassin // calcul les poids des bassins voisins qui ne dpendent pas des poissons pour chaque SeaBassin
BasinNetwork bn = (BasinNetwork) pilot.getAquaticWorld().getEnvironment(); BasinNetwork bn = (BasinNetwork) pilot.getAquaticWorld().getEnvironment();
accessibleBasinsPerBasin = new TreeMap<Basin, Map<Basin,Double>>(); accessibleBasinsPerBasin = new TreeMap<Basin, Map<Basin,Double>>();
distanceBasinsPerBasin = new TreeMap<Basin, Map<Basin,Double>>(); distanceBasinsPerBasin = new TreeMap<Basin, Map<Basin,Double>>();
...@@ -107,26 +107,26 @@ public class DisperseAndMigrateToRiverStandardization extends AquaNismsGroupProc ...@@ -107,26 +107,26 @@ public class DisperseAndMigrateToRiverStandardization extends AquaNismsGroupProc
if (fish.isMature()) { if (fish.isMature()) {
// fish with homing // fish with homing
amountWithHoming = Miscellaneous.binomialForSuperIndividual(group.getPilot(), fish.getAmount(), pHoming); // seuil par dfaut fix 50 amountWithHoming = Miscellaneous.binomialForSuperIndividual(group.getPilot(), fish.getAmount(), pHoming); // seuil par dfaut fix� � 50
// strayed fish // strayed fish
strayedAmount = fish.getAmount() - amountWithHoming; strayedAmount = fish.getAmount() - amountWithHoming;
if (strayedAmount != 0) { if (strayedAmount != 0) {
// On rcupre les info du poids des bassin par rapport la position du poisson // On rcupre les info du poids des bassin par rapport la position du poisson
Map<Basin,Double> accBasOfFish= new TreeMap<Basin, Double>(accessibleBasinsPerBasin.get(fish.getPosition())); Map<Basin,Double> accBasOfFish= new TreeMap<Basin, Double>(accessibleBasinsPerBasin.get(fish.getPosition()));
//accBasOfFish = accessibleBasinsPerBasin.get(fish.getPosition()); //accBasOfFish = accessibleBasinsPerBasin.get(fish.getPosition());
// On retire certains bassins si on considre une distance max de dispersion // On retire certains bassins si on considre une distance max de dispersion
distBasOfFish = distanceBasinsPerBasin.get(fish.getPosition()); distBasOfFish = distanceBasinsPerBasin.get(fish.getPosition());
if (group.getdMaxDisp() != 0){ if (group.getdMaxDisp() != 0){
// TODO pourquoi distbasoffish peut tre nul ? // TODO pourquoi distbasoffish peut tre nul ?
if (distBasOfFish != null){ if (distBasOfFish != null){
dMaxDispFish = (group.getdMaxDisp()/group.getLinfVonBert())*fish.getLength(); dMaxDispFish = (group.getdMaxDisp()/group.getLinfVonBert(fish))*fish.getLength();
// load accessible basins // load accessible basins
for (Basin surroundingBasin : distBasOfFish.keySet()){ for (Basin surroundingBasin : distBasOfFish.keySet()){
Double distance = distBasOfFish.get(surroundingBasin); Double distance = distBasOfFish.get(surroundingBasin);
//System.out.println("pour le poisson " + fish.hashCode() + " situ dans le bassin " + basin.getName() + " et n dans le bassin " + fish.getBirthBasin().getName()); //System.out.println("pour le poisson " + fish.hashCode() + " situ dans le bassin " + basin.getName() + " et n dans le bassin " + fish.getBirthBasin().getName());
//System.out.println("la distance vaut " + distance + " pour le bassin " + surroundingBasin.getName()); //System.out.println("la distance vaut " + distance + " pour le bassin " + surroundingBasin.getName());
if (distance >= dMaxDispFish) { if (distance >= dMaxDispFish) {
accBasOfFish.remove(surroundingBasin); accBasOfFish.remove(surroundingBasin);
...@@ -139,7 +139,7 @@ public class DisperseAndMigrateToRiverStandardization extends AquaNismsGroupProc ...@@ -139,7 +139,7 @@ public class DisperseAndMigrateToRiverStandardization extends AquaNismsGroupProc
double totalWeight = 0.; double totalWeight = 0.;
double probToGo = 0.; double probToGo = 0.;
long amountToGo = 0; long amountToGo = 0;
// TODO Qu'est ce qui se passe si AccBasOfFish est vide... a beug pas mais c'est pas trs clair... donc vrifier // TODO Qu'est ce qui se passe si AccBasOfFish est vide... a beug pas mais c'est pas trs clair... donc vrifier
for (Basin accBasin : accBasOfFish.keySet()){ for (Basin accBasin : accBasOfFish.keySet()){
double accBasinWeightLogit = accBasOfFish.get(accBasin) + alpha2Rep*((fish.getLength() - meanLengthOfMatureFishes) / standardDeviationOfMatureFishesLength); double accBasinWeightLogit = accBasOfFish.get(accBasin) + alpha2Rep*((fish.getLength() - meanLengthOfMatureFishes) / standardDeviationOfMatureFishesLength);
double accBasinWeight = 1 / (1 + Math.exp(- accBasinWeightLogit)); double accBasinWeight = 1 / (1 + Math.exp(- accBasinWeightLogit));
...@@ -165,7 +165,7 @@ public class DisperseAndMigrateToRiverStandardization extends AquaNismsGroupProc ...@@ -165,7 +165,7 @@ public class DisperseAndMigrateToRiverStandardization extends AquaNismsGroupProc
if (amountWithHoming > 0){ if (amountWithHoming > 0){
fish.setAmount(amountWithHoming); fish.setAmount(amountWithHoming);
// retour soit dans le bassin de naissance pour les semelpares // retour soit dans le bassin de naissance pour les semelpares
// soit dans le dernier bassin de reproduction pour les itropares // soit dans le dernier bassin de reproduction pour les itropares
fish.moveTo(group.getPilot(), bn.getAssociatedRiverBasin(fish.getPosition()), group); fish.moveTo(group.getPilot(), bn.getAssociatedRiverBasin(fish.getPosition()), group);
} else { } else {
deadFish.add(fish); deadFish.add(fish);
......
...@@ -94,23 +94,21 @@ public class Grow extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGr ...@@ -94,23 +94,21 @@ public class Grow extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGr
// 2) Update the fish length with a lognormal normal draw of increment // 2) Update the fish length with a lognormal normal draw of increment
// limit the fish length to Linf // limit the fish length to Linf
if (fish.getLength() < group.getLinfVonBert()){ if (fish.getLength() < group.getLinfVonBert(fish)){
muDeltaLVonBert = Math.log((group.getLinfVonBert() - fish.getLength()) * (1 - Math.exp(-kVonBert * Time.getSeasonDuration()))) - (sigmaDeltaLVonBert*sigmaDeltaLVonBert)/2; muDeltaLVonBert = Math.log((group.getLinfVonBert(fish) - fish.getLength()) * (1 - Math.exp(-kVonBert * Time.getSeasonDuration()))) - (sigmaDeltaLVonBert*sigmaDeltaLVonBert)/2;
growthIncrement = Math.exp(genNormal.nextDouble()*sigmaDeltaLVonBert + muDeltaLVonBert); growthIncrement = Math.exp(genNormal.nextDouble()*sigmaDeltaLVonBert + muDeltaLVonBert);
fish.setLength(Math.min(group.getLinfVonBert(), fish.getLength() + growthIncrement)); fish.setLength(Math.min(group.getLinfVonBert(fish), fish.getLength() + growthIncrement));
} }
else { else {
fish.setLength(group.getLinfVonBert()); fish.setLength(group.getLinfVonBert(fish));
} }
//System.out.println(fish.getAge() + " -> "+ fish.getLength() + " ("+fish.getStage()+"): "+ growthIncrement); //System.out.println(fish.getAge() + " -> "+ fish.getLength() + " ("+fish.getStage()+"): "+ growthIncrement);
// test if fish become mature // test if fish become mature
if (fish.getStage() == Stage.IMMATURE){ if (fish.getStage() == Stage.IMMATURE && fish.getLength() > group.getlFirstMaturity(fish)){
if (fish.getLength() > group.getlFirstMaturityForFemale()){
fish.setStage(Stage.MATURE); fish.setStage(Stage.MATURE);
} }
}
//System.out.println("la temp�rature du lieu de vie du poisson est :" + fish.getPosition().getCurrentTemperature() + ", la saison est :" + Time.getSeason() + " et sa nouvelle taille est :" + fish.getLength()); //System.out.println("la temp�rature du lieu de vie du poisson est :" + fish.getPosition().getCurrentTemperature() + ", la saison est :" + Time.getSeason() + " et sa nouvelle taille est :" + fish.getLength());
} }
} }
......
...@@ -44,7 +44,6 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess< ...@@ -44,7 +44,6 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
private double delta_t=0.33; // duration of the mortality considered in the reproduction process (ex.: from eggs to juvenile in estuary for alosa alosa = 0.33) private double delta_t=0.33; // duration of the mortality considered in the reproduction process (ex.: from eggs to juvenile in estuary for alosa alosa = 0.33)
private double survOptRep = 0.0017; private double survOptRep = 0.0017;
private double lambda = 0.00041; private double lambda = 0.00041;
private double initialLength = 2.;
private double sigmaRecruitment = 0.3; private double sigmaRecruitment = 0.3;
private double survivalRateAfterReproduction = 0.1; private double survivalRateAfterReproduction = 0.1;
private double maxNumberOfSuperIndividualPerReproduction = 50.; private double maxNumberOfSuperIndividualPerReproduction = 50.;
...@@ -237,7 +236,7 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess< ...@@ -237,7 +236,7 @@ public class ReproduceAndSurviveAfterReproduction extends AquaNismsGroupProcess<
long effectiveAmount = numberOfRecruit / numberOfsuperIndividual; long effectiveAmount = numberOfRecruit / numberOfsuperIndividual;
for (int i=0; i<numberOfsuperIndividual; i++){ for (int i=0; i<numberOfsuperIndividual; i++){
group.addAquaNism(new DiadromousFish(group.getPilot(), riverBasin, initialLength, effectiveAmount, Gender.UNDIFFERENCIED)); group.addAquaNism(new DiadromousFish(group.getPilot(), riverBasin, group.getLengthAtHatching(), effectiveAmount, Gender.UNDIFFERENCIED));
} }
// stock the first year when recruitment is non nul // stock the first year when recruitment is non nul
......
Markdown is supported
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