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