diff --git a/DESCRIPTION b/DESCRIPTION index a858ebe..420f395 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: mse Title: Tools for Running Management Strategy Evaluations using FLR -Version: 2.2.3.9246 +Version: 2.2.3.9248 Authors@R: c(person(given = "Iago", family = "Mosqueira", role = c("aut", "cre"), email = "iago.mosqueira@wur.nl"), person("Ernesto", "Jardim", email = "ernesto.jardim@msc.org", diff --git a/R/hcr.R b/R/hcr.R index e585a16..27d4ad6 100644 --- a/R/hcr.R +++ b/R/hcr.R @@ -103,6 +103,7 @@ hockeystick.hcr <- function(stk, ind, lim, trigger, target, min=0, drop=0, # EXTRACT args ay <- args$ay + iy <- args$iy data_lag <- args$data_lag man_lag <- args$management_lag frq <- args$frq @@ -139,10 +140,13 @@ hockeystick.hcr <- function(stk, ind, lim, trigger, target, min=0, drop=0, track(tracking, "decision.hcr", ay) <- ifelse(met < drop, 0, ifelse(met <= lim, 1, ifelse(met < trigger, 2, 3))) - # LIMITS over previous output - pre <- unitSums(seasonSums(window(do.call(output, list(stk)), - start=ay - man_lag, end=ay - man_lag))) - + # GET TAC dy / ay - 1 + if(ay == iy) + pre <- areaSums(unitSums(seasonSums(window(do.call(output, list(stk)), + start=ay - man_lag, end=ay - man_lag)))) + else + pre <- c(tracking[[1]]["hcr", ac(ay)]) + # IF NA, set to previous value if(any(is.na(out))) { out[is.na(out)] <- pre[is.na(out)] diff --git a/R/mp.R b/R/mp.R index f989122..2e5dbfc 100644 --- a/R/mp.R +++ b/R/mp.R @@ -839,7 +839,7 @@ setMethod("goFish", signature(om="FLombf"), # BUG: DROP getCtrl ctrl <- getCtrl(yearMeans(fbar(stk0)[,sqy]), "f", ay + args$management_lag, it) } - + track(tracking, "hcr", mys) <- ctrl #----------------------------------------------------------