Commit e099100a authored by Poulet Camille's avatar Poulet Camille
Browse files

G3RD functions corrections for global variables

Coorection to avoid use of global variables in function
parent 0b811ba7
......@@ -96,10 +96,10 @@ strayerSurvival = function(distance, m ){
# Spwaner survival before reproduction
# Dome-shape curve with temperature effect
#-------------------------------------------------------
spawnerSurvivalPreReproduction <- function(Triver,Tmin, Topt, Tmax){
spawnerSurvivalPreReproduction <- function(Triver,Tmin, Topt, Tmax, parSurv){
#River survival
survProbOptRiver = survivePar$survProbOptRiver
survProbOptRiver = parSurv$survProbOptRiver
spRiver = survProbOptRiver * temperatureEffect(Triver, Tmin, Topt, Tmax)
......@@ -114,16 +114,16 @@ spawnerSurvivalPreReproduction <- function(Triver,Tmin, Topt, Tmax){
#See Rougier et al, 2014; 2015 and Jatteau et al., 2017
#----------------------------------------------
#survival of larvae 14dph from Jatteau et al, 2017
stockRecruitementRelationship <- function(Triver,Tmin, Topt, Tmax, survivalStock) {
surfaceWatershed = 84810 #Surface de la Garonne
lambda = reproducePar$lambda
deltaT = reproducePar$deltaT
survOptRep = reproducePar$survOptRep
n = reproducePar$eta #simule l'effet allee
ratioS95_S50 = reproducePar$ratioS95_S50
alpha = reproducePar$a #species fecundity
survProbOptRiver = survivePar$survProbOptRiver
stockRecruitementRelationship <- function(Triver,Tmin, Topt, Tmax, survivalStock, parRep, parSurv, surfaceWatershed = 84810) {
#surfaceWatershed = 84810 Surface de la Garonne
lambda = parRep$lambda
deltaT = parRep$deltaT
survOptRep = parRep$survOptRep
eta = parRep$eta #simule l'effet allee
ratioS95_S50 = parRep$ratioS95_S50
alpha = parRep$a #species fecundity
survProbOptRiver = parSurv$survProbOptRiver
periodAtSea = 5 - deltaT
###--------------------- SR relationship -----------------
......@@ -147,7 +147,7 @@ stockRecruitementRelationship <- function(Triver,Tmin, Topt, Tmax, survivalStock
#p = proportion de g?niteurs participant ? la reproduction en focntion de la quantit? de g?niteur total
#p = 1/(1+exp(-log(19)*(S-n)/(Ratio*surfaceWatershed)))
S95 = n * surfaceWatershed
S95 = eta * surfaceWatershed
S50 = S95/ratioS95_S50
p = 1/(1 + exp(-log(19)*(survivalStock - S50)/(S95 - S50)))
......@@ -156,7 +156,7 @@ stockRecruitementRelationship <- function(Triver,Tmin, Topt, Tmax, survivalStock
#R0 = aj * S * p
alleeEffect = 1/(1 + exp(-log(19)*(survivalStock - n/ratioS95_S50*surfaceWatershed)/(n*surfaceWatershed - n/ratioS95_S50*surfaceWatershed)))
alleeEffect = 1/(1 + exp(-log(19)*(survivalStock - eta/ratioS95_S50*surfaceWatershed)/(eta*surfaceWatershed - eta/ratioS95_S50*surfaceWatershed)))
Rj = (alphaj * survivalStock * alleeEffect)/(betaj + survivalStock * alleeEffect)
......@@ -194,7 +194,7 @@ spawnerSurvivalPostReproductionWithBellCurve <- function(Triver, Tmin, Topt, Tma
#P3:
spRiverPostSpawn = coeffb * temperatureEffect(Triver, Tmin, Topt, Tmax)
stockAfterSpawn = S * spRiverPostSpawn
#stockAfterSpawn = S * spRiverPostSpawn
return(spRiverPostSpawn)
}
......
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