Commit f0b9e4b7 authored by patrick.lambert's avatar patrick.lambert
Browse files

bugs at excution fixed

parent 8d3b1696
...@@ -283,6 +283,12 @@ ...@@ -283,6 +283,12 @@
<!--<species.WriteEffectiveAndBiomassImportFluxes> <synchronisationMode>ASYNCHRONOUS</synchronisationMode> <exportSeason>SPRING</exportSeason> <!--<species.WriteEffectiveAndBiomassImportFluxes> <synchronisationMode>ASYNCHRONOUS</synchronisationMode> <exportSeason>SPRING</exportSeason>
<fileNameOutput>effectiveBiomassFluxesBeforeReproduction</fileNameOutput> </species.WriteEffectiveAndBiomassImportFluxes> --> <fileNameOutput>effectiveBiomassFluxesBeforeReproduction</fileNameOutput> </species.WriteEffectiveAndBiomassImportFluxes> -->
<species.AnalyseSpawnerFeatures>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<analysisSeason>SPRING</analysisSeason>
<memorySize>30</memorySize>
</species.AnalyseSpawnerFeatures>
<species.ReproduceAndSurviveAfterReproductionWithDiagnose> <species.ReproduceAndSurviveAfterReproductionWithDiagnose>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode> <synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<reproductionSeason>SPRING</reproductionSeason> <reproductionSeason>SPRING</reproductionSeason>
...@@ -307,9 +313,7 @@ ...@@ -307,9 +313,7 @@
<species.AnalyseFishDistribution> <species.AnalyseFishDistribution>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode> <synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<fishDistributionAnalysisSeason>SPRING</fishDistributionAnalysisSeason> <analysisSeason>SPRING</analysisSeason>
<fishDistributionAnalysisStartYear>1820</fishDistributionAnalysisStartYear>
<fishDistributionAnalysisEndYear>1850</fishDistributionAnalysisEndYear>
<minimumRecruitsForPopulatedBasin>50</minimumRecruitsForPopulatedBasin> <minimumRecruitsForPopulatedBasin>50</minimumRecruitsForPopulatedBasin>
</species.AnalyseFishDistribution> </species.AnalyseFishDistribution>
......
...@@ -81,14 +81,19 @@ public class EasyRun { ...@@ -81,14 +81,19 @@ public class EasyRun {
+ "-env data/input/northeastamerica/RIOBNneaBasins_Rjava.xml " + "-env data/input/northeastamerica/RIOBNneaBasins_Rjava.xml "
+ "-observers data/input/northeastamerica/RIO_obs_empty.xml").split("\\ "); + "-observers data/input/northeastamerica/RIO_obs_empty.xml").split("\\ ");
String[] parameterNames = new String[] { "processes.processesEachStep.8.tempMinRep", String[] parameterNames = new String[] { "processes.processesEachStep.9.tempMinRep",
"processes.processesEachStep.8.ratioS95_S50", "processes.processesEachStep.6.pHomingAfterEquil" }; "processes.processesEachStep.9.ratioS95_S50", "processes.processesEachStep.6.pHomingAfterEquil" };
double[] parameterValues = new double[] { 10, 2, 0.7 }; double[] parameterValues = new double[] { 10, 2, 0.7 };
runSimulation(batchArguments, "tsointsoin", parameterNames, parameterValues); runSimulation(batchArguments, "tsointsoin", parameterNames, parameterValues);
double[][] distributionResults = getValuesFromAquanismGroupProcess("processes.processesEachStep.9.exportToR"); double[][] spawnerRunResults = getValuesFromAquanismGroupProcess("processes.processesEachStep.8.exportToR");
for (double[] result : spawnerRunResults) {
System.out.println(Arrays.toString(result));
}
double[][] distributionResults = getValuesFromAquanismGroupProcess("processes.processesEachStep.10.exportToR");
for (double[] result : distributionResults) { for (double[] result : distributionResults) {
System.out.println(Arrays.toString(result)); System.out.println(Arrays.toString(result));
} }
......
...@@ -27,6 +27,7 @@ import com.thoughtworks.xstream.io.xml.DomDriver; ...@@ -27,6 +27,7 @@ import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.RIOBasinNetwork; import environment.RIOBasinNetwork;
import environment.RiverBasin; import environment.RiverBasin;
import environment.Time.Season;
import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess; import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
import fr.cemagref.simaqualife.pilot.Pilot; import fr.cemagref.simaqualife.pilot.Pilot;
import miscellaneous.TreeMapForCentile; import miscellaneous.TreeMapForCentile;
...@@ -37,6 +38,8 @@ import observer.ObservableRecord; ...@@ -37,6 +38,8 @@ import observer.ObservableRecord;
*/ */
public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGroup> { public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGroup> {
private Season analysisSeason = Season.SPRING;
/** /**
* The minimum number of recruits to consider a basin as populated * The minimum number of recruits to consider a basin as populated
* *
...@@ -71,6 +74,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis ...@@ -71,6 +74,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
if (records == null) if (records == null)
initTransientParameters(group.getPilot()); initTransientParameters(group.getPilot());
if (group.getEnvironment().getTime().getSeason(group.getPilot()) == analysisSeason) {
// initialise the distribution range // initialise the distribution range
double southernEdge = northernLimit; double southernEdge = northernLimit;
double northernEdge = southernLimit; double northernEdge = southernLimit;
...@@ -128,6 +132,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis ...@@ -128,6 +132,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
records.add(record); records.add(record);
} }
}
public double[][] exportToR() { public double[][] exportToR() {
......
...@@ -27,6 +27,7 @@ import com.thoughtworks.xstream.XStream; ...@@ -27,6 +27,7 @@ import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver; import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.RiverBasin; import environment.RiverBasin;
import environment.Time.Season;
import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess; import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
import fr.cemagref.simaqualife.pilot.Pilot; import fr.cemagref.simaqualife.pilot.Pilot;
import miscellaneous.QueueMemory; import miscellaneous.QueueMemory;
...@@ -38,6 +39,7 @@ import species.DiadromousFish.Gender; ...@@ -38,6 +39,7 @@ import species.DiadromousFish.Gender;
public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGroup> { public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGroup> {
private int memorySize = 30; private int memorySize = 30;
private Season analysisSeason = Season.SPRING;
private transient Map<Integer, QueueMemory<Double>> femaleAgeMemories; private transient Map<Integer, QueueMemory<Double>> femaleAgeMemories;
private transient Map<Integer, QueueMemory<Double>> maleAgeMemories; private transient Map<Integer, QueueMemory<Double>> maleAgeMemories;
...@@ -56,12 +58,17 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish ...@@ -56,12 +58,17 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
// first passage // first passage
if (femaleAgeMemories == null) { if (femaleAgeMemories == null) {
femaleAgeMemories = new HashMap<Integer, QueueMemory<Double>>(); femaleAgeMemories = new HashMap<Integer, QueueMemory<Double>>();
maleAgeMemories = new HashMap<Integer, QueueMemory<Double>>();
primiparousMemories = new HashMap<Integer, QueueMemory<Double>>();
for (RiverBasin riverBasin : group.getEnvironment().getRiverBasins()) { for (RiverBasin riverBasin : group.getEnvironment().getRiverBasins()) {
femaleAgeMemories.put(riverBasin.getId(), new QueueMemory<>(memorySize)); femaleAgeMemories.put(riverBasin.getBasin_id(), new QueueMemory<>(memorySize));
maleAgeMemories.put(riverBasin.getBasin_id(), new QueueMemory<>(memorySize));
primiparousMemories.put(riverBasin.getBasin_id(), new QueueMemory<>(memorySize));
} }
} }
if (group.getEnvironment().getTime().getSeason(group.getPilot()) == analysisSeason) {
for (RiverBasin riverBasin : group.getEnvironment().getRiverBasins()) { for (RiverBasin riverBasin : group.getEnvironment().getRiverBasins()) {
if (riverBasin.getFishs(group) != null) { if (riverBasin.getFishs(group) != null) {
...@@ -93,10 +100,20 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish ...@@ -93,10 +100,20 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
nbOfPrimiparous += fish.getAmount(); nbOfPrimiparous += fish.getAmount();
} }
} }
// add value in the quues // add value in the queues
femaleAgeMemories.get(riverBasin.getBasin_id()).add(meanAgeForFemale / nbAgeForFemale); if (nbAgeForFemale > 0.)
maleAgeMemories.get(riverBasin.getBasin_id()).add(meanAgeForMale / nbAgeForMale); femaleAgeMemories.get(riverBasin.getBasin_id()).push(meanAgeForFemale / nbAgeForFemale);
primiparousMemories.get(riverBasin.getBasin_id()).add(nbOfPrimiparous / nbOfSpawners); else
femaleAgeMemories.get(riverBasin.getBasin_id()).push(Double.NaN);
if (nbAgeForMale > 0.)
maleAgeMemories.get(riverBasin.getBasin_id()).push(meanAgeForMale / nbAgeForMale);
else
maleAgeMemories.get(riverBasin.getBasin_id()).push(Double.NaN);
if (nbOfSpawners > 0.)
primiparousMemories.get(riverBasin.getBasin_id()).push(nbOfPrimiparous / nbOfSpawners);
else
primiparousMemories.get(riverBasin.getBasin_id()).push(Double.NaN);
}
} }
} }
} }
......
...@@ -126,7 +126,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG ...@@ -126,7 +126,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// before the party !!!! // before the party !!!!
double fluxBefore = riverBasin.getSpawnerNumberPerGroup(group); double fluxBefore = riverBasin.getSpawnerNumberPerGroup(group);
riverBasin.getLastSpawnerNumbersBeforeReproduction().add(fluxBefore); riverBasin.getLastSpawnerNumbersBeforeReproduction().push(fluxBefore);
double b, c, alpha, beta, amountPerSuperIndividual, S95, S50; double b, c, alpha, beta, amountPerSuperIndividual, S95, S50;
double numberOfFemaleSpawners = 0.; double numberOfFemaleSpawners = 0.;
......
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