Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SimAquaLife
GR3D
Commits
95ee5985
Commit
95ee5985
authored
Apr 14, 2021
by
patrick.lambert
Browse files
with logit or no effect in survival after reproduction
parent
0f52a527
Changes
4
Hide whitespace changes
Inline
Side-by-side
data/input/northeastamerica/fishRIOBasin_Sapidissima_Rjava.xml
View file @
95ee5985
...
...
@@ -320,8 +320,14 @@
<species.SurviveAfterReproduction>
<synchronisationMode>
ASYNCHRONOUS
</synchronisationMode>
<afterReproductionSeason>
SPRING
</afterReproductionSeason>
<survivalRateAfterReproduction>
0.1
</survivalRateAfterReproduction>
<afterReproductionSeason>
SUMMER
</afterReproductionSeason>
<maximalSurvivalRate>
0.1
</maximalSurvivalRate>
<!-- <temperatureEffectSurvivalAfterReproduction class="temperatureEffect.LogitEffect"> -->
<!-- <Tref>22</Tref> -->
<!-- <alpha>-.1</alpha> -->
<!-- </temperatureEffectSurvivalAfterReproduction> -->
<temperatureEffectSurvivalAfterReproduction
class=
"temperatureEffect.NoEffect"
>
</temperatureEffectSurvivalAfterReproduction>
</species.SurviveAfterReproduction>
<species.MigrateFromRiverToInshore>
...
...
src/main/java/species/SurviveAfterReproduction.java
View file @
95ee5985
...
...
@@ -18,10 +18,8 @@ import fr.cemagref.simaqualife.kernel.util.TransientParameters.InitTransientPara
import
fr.cemagref.simaqualife.pilot.Pilot
;
import
miscellaneous.BinomialForSuperIndividualGen
;
import
species.DiadromousFish.SpawnerOrigin
;
import
temperatureEffect.
Rosso
;
import
temperatureEffect.
LogitEffect
;
import
temperatureEffect.TemperatureEffect
;
import
umontreal.iro.lecuyer.probdist.NormalDist
;
import
umontreal.iro.lecuyer.randvar.NormalGen
;
@ServiceProvider
(
service
=
AquaNismsGroupProcess
.
class
)
...
...
@@ -29,11 +27,14 @@ public class SurviveAfterReproduction extends AquaNismsGroupProcess<DiadromousFi
private
Season
afterReproductionSeason
=
Season
.
SUMMER
;
private
double
survivalRateAfterReproduction
=
0.1
;
private
TemperatureEffect
temperatureEffect
;
/**
* maximum suvival od spawnser after reproduction
*
* @unit -
*/
private
double
maximalSurvivalRate
=
0.1
;
private
transient
NormalGen
genNormal
;
private
TemperatureEffect
temperatureEffectSurvivalAfterReproduction
;
/**
* the random numbers generator for binomial draws
...
...
@@ -44,7 +45,7 @@ public class SurviveAfterReproduction extends AquaNismsGroupProcess<DiadromousFi
public
static
void
main
(
String
[]
args
)
{
SurviveAfterReproduction
surviveAfterReproduction
=
new
SurviveAfterReproduction
();
surviveAfterReproduction
.
temperatureEffect
=
new
Rosso
(
0
.,
15
.,
22
.
);
surviveAfterReproduction
.
temperatureEffect
SurvivalAfterReproduction
=
new
LogitEffect
(
22
,
-
0.1
);
System
.
out
.
println
((
new
XStream
(
new
DomDriver
())).
toXML
(
surviveAfterReproduction
));
}
...
...
@@ -53,7 +54,6 @@ public class SurviveAfterReproduction extends AquaNismsGroupProcess<DiadromousFi
@InitTransientParameters
public
void
initTransientParameters
(
Pilot
pilot
)
{
super
.
initTransientParameters
(
pilot
);
genNormal
=
new
NormalGen
(
pilot
.
getRandomStream
(),
new
NormalDist
(
0
.,
1
.));
aleaGen
=
new
BinomialForSuperIndividualGen
(
pilot
.
getRandomStream
());
...
...
@@ -83,20 +83,25 @@ public class SurviveAfterReproduction extends AquaNismsGroupProcess<DiadromousFi
totalInputFluxes
.
get
(
origin
).
put
(
"biomass"
,
0
.);
}
// temperature effect in the riverBasin
double
currentTemperature
=
riverBasin
.
getCurrentTemperature
(
group
.
getPilot
());
double
tempEffect
=
temperatureEffectSurvivalAfterReproduction
.
getTemperatureEffect
(
currentTemperature
);
double
survivalProbability
=
maximalSurvivalRate
*
tempEffect
;
// iterate on the fish
ListIterator
<
DiadromousFish
>
fishIterator
=
fishInBasin
.
listIterator
();
while
(
fishIterator
.
hasNext
())
{
DiadromousFish
fish
=
fishIterator
.
next
();
// only on spawners
if
(
fish
.
isMature
())
{
// origin of the spwaner
SpawnerOrigin
spawnerOrigin
=
(
fish
.
getBirthBasin
()
==
riverBasin
?
SpawnerOrigin
.
AUTOCHTONOUS
:
SpawnerOrigin
.
ALLOCHTONOUS
);
// survival amount of fish
double
biomass
=
0
.;
survivalAmount
=
aleaGen
.
getSuccessNumber
(
fish
.
getAmount
(),
survival
RateAfterReproduction
);
survivalAmount
=
aleaGen
.
getSuccessNumber
(
fish
.
getAmount
(),
survival
Probability
);
// at least one fish in the SI survive, the other die
if
(
survivalAmount
>
0
)
{
...
...
src/main/java/temperatureEffect/LogitEffect.java
0 → 100644
View file @
95ee5985
/**
* patrick
* @author Patrick Lambert
* @copyright Copyright (c) 2020, INRAE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
temperatureEffect
;
/**
*
*/
public
class
LogitEffect
implements
TemperatureEffect
{
/**
*
* @unit
*/
private
static
final
long
serialVersionUID
=
3756752294442116413L
;
/**
* temperature reference used to calculate the effect
*
* @unit °C
*/
private
double
Tref
=
20
.;
/**
* parameter used to calculate the effect
*
* @unit °C
*/
private
double
alpha
=
0.1
;
@Override
public
double
getTemperatureEffect
(
double
temperature
)
{
return
1
.
/
(
1
.
+
Math
.
exp
(-
alpha
*
(
temperature
-
Tref
)));
}
public
LogitEffect
(
double
Tref
,
double
alpha
)
{
super
();
this
.
Tref
=
Tref
;
this
.
alpha
=
alpha
;
}
}
src/main/java/temperatureEffect/NoEffect.java
0 → 100644
View file @
95ee5985
/**
* patrick
* @author Patrick Lambert
* @copyright Copyright (c) 2020, INRAE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
temperatureEffect
;
/**
*
*/
public
class
NoEffect
implements
TemperatureEffect
{
/**
*
* @unit
*/
private
static
final
long
serialVersionUID
=
-
7686765011254676763L
;
@Override
public
double
getTemperatureEffect
(
double
temperature
)
{
return
1
.;
}
public
NoEffect
(
double
Tref
,
double
alpha
)
{
super
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment