library(stockassessment)
setwd("run")
load("data.RData")
conf<-loadConf(dat,"../conf/model.cfg", patch=TRUE)
par<-defpar(dat,conf)
par$logFpar[]<-0 # remove annoying warning in 2023
#par$logSdLogFsta <- -1 # solve problem of internal convergence in 2022
fit<-sam.fit(dat,conf,par)
if(fit$opt$convergence!=0) stop("Model did not converge.")
save(fit, file="model.RData") 
