Title: | VRAP 2nd edition with C++ for RER and Viability Computations |
---|---|
Description: | This is a rewrite of the R version of the VRAP program. The original VRAP R package was a one-to-one translation from the original Visual Basic code. VRAPCpp is the same equations, but completely re-written by Martin Liermann to be more efficient. VRAPCpp does not have all the functionality of VRAP. Many of the rav options in VRAP were not used and are removed. There is a shiny that emulates the VRAP 1.0 shiny app. |
Authors: | Martin Liermann [aut], Eli Holmes [aut, cre], Howard Coleman [ctb] |
Maintainer: | Elizabeth Holmes - NOAA Federal <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.0 |
Built: | 2025-01-31 02:37:09 UTC |
Source: | https://github.com/noaa-nwfsc/VRAPCpp |
This is a rewrite of the R version of the VRAP program. The original VRAP R package was a one-to-one translation from the original Visual Basic code. VRAPCpp is the same equations, but completely re-written by Martin Liermann to be more efficient. VRAPCpp does not have all the functionality of VRAP. Many of the rav options in VRAP were not used and are removed.
Call 'vignette(package = "VRAPS")' to see all the package documentation and examples.
Martin Liermann and Elizabeth Holmes
Maintainer: Elizabeth Holmes <[email protected]>
Returns the statistics (calculated values) needed to produce the summary output files
CompStats(inputs, SimResults)
CompStats(inputs, SimResults)
inputs |
Inputs from .rav file |
SimResults |
A list from RunSims2R or RunSims2C with totEsc and totAEQMort for each ER/Pop value, each sim rep, and each year. |
This function similar but not identical to the original VB function in VRAP
SummaryStats and staticvars list
Read in an input file and assign all the variables
GetInput(InFile)
GetInput(InFile)
InFile |
the name of the input file |
Returns the list of all inputs
Ensure that inputs list can be used in VRAP 1.0 functions
InputsBackwardCompat(inputs)
InputsBackwardCompat(inputs)
inputs |
A list of the necessary input values (can be taken from .rav file). |
The VRAP 2.0 inputs list is very similar to VRAP 1.0 but has a few differences related to how ER and Pop steps are named. This creates entries in inputs that has the same names used in VRAP 1.0 so that the inputs list in VRAP 2.0 can be passed to VRAP 1.0 functions.
Returns the list of all inputs with added values so that list is compatible with VRAP 1.0 functions
Runs VRAP sensu 1.0 with the VRAP 2.0 totEsc engine. Does not use parallel in R code, but has C++ version.
Main.VRAP1(InFile = NULL, OutFileBase = NULL, NRuns = -1, NYears = -1, Title = -1, TargetStart = -1, TargetEnd = -1, TargetStep = -1, ERecovery = -1, QET = -1, ECrit = -1, NewRavFileName = "tmprav.rav", forceNewRav = NULL, silent = FALSE, version = "R", save.output.as.files = TRUE)
Main.VRAP1(InFile = NULL, OutFileBase = NULL, NRuns = -1, NYears = -1, Title = -1, TargetStart = -1, TargetEnd = -1, TargetStep = -1, ERecovery = -1, QET = -1, ECrit = -1, NewRavFileName = "tmprav.rav", forceNewRav = NULL, silent = FALSE, version = "R", save.output.as.files = TRUE)
InFile |
The name of the .rav file. Only .rav since this is to duplicate VRAP 1.0 |
OutFileBase |
The basename for the .sum, .byr, and .esc output files |
NRuns |
Number of runs to use in the simulations if the user wants to use something different than what is in the .rav file |
NYears |
Number of years to project forward in the simulations if the user wants to use something different than what is in the .rav file |
Title |
Title to use for the report if the user wants to use something different than what is in the .rav file |
TargetStart |
Target ER to start simulations at if the user wants to use something different than what is in the .rav file |
TargetEnd |
Target ER to end simulations at if the user wants to use something different than what is in the .rav file |
TargetStep |
Target ER step sizes if the user wants to use something different than what is in the .rav file |
ERecovery |
Recovery target if the user wants to use something different than what is in the .rav file |
QET |
if the user wants to use something different than what is in the .rav file |
ECrit |
if the user wants to use something different than what is in the .rav file |
NewRavFileName |
A new .rav file is saved in case the user has changed any values from what is in the .rav file. |
forceNewRav |
Force use of new rav file. Needed for shiny app. |
silent |
Whether to show progress bar. |
version |
"R" or "C". C is much faster. |
save.output.as.files |
If TRUE (default), then .sum, .byr, .esc and .rav files are saved using OutFileBase. If FALSE, no files are saved and only the list is output. |
list with output list from RunSims() and output time
Read in a VRAP 2.0 .rap input file and assign all the variables needed for VRAP 2.0
ReadRapFile(InFile)
ReadRapFile(InFile)
InFile |
the name of the .rap file |
A .rap file is the input file for VRAP 2.0. VRAP 2.0 uses most but not all the VRAP 1.0 specs and requires that some .rav values have certain values. If illegal values are encountered, an error is returned.
Returns the list of all inputs
## Not run: fpath <- system.file("VRAP", "demofiles/Demo-ER.rap", package="VRAPS") file.show(fpath) ## End(Not run)
## Not run: fpath <- system.file("VRAP", "demofiles/Demo-ER.rap", package="VRAPS") file.show(fpath) ## End(Not run)
Read in a VRAP 1.0 .rav file and assign all the variables need for VRAP 2.0
ReadRavFile(InFile)
ReadRavFile(InFile)
InFile |
the name of the .rav file |
A .rav file is the input file for VRAP 1.0. VRAP 2.0 uses most but not all the VRAP 1.0 specs and requires that some .rav values have certain values. If illegal values are encountered, an error is returned.
Returns the list of all inputs
## Not run: fpath <- system.file("VRAP", "demofiles/Demo-ER.rav", package="VRAPS") file.show(fpath) ## End(Not run)
## Not run: fpath <- system.file("VRAP", "demofiles/Demo-ER.rav", package="VRAPS") file.show(fpath) ## End(Not run)
RunSims.VRAP1 takes the input list, runs the VRAP simulations, and returns the summary statistics used by VRAP 1.0
RunSims.VRAP1(inputs, version = "R")
RunSims.VRAP1(inputs, version = "R")
inputs |
Inputs from .rav file |
version |
R or C++ |
This function is to produce VRAP 1.0 output stats using VRAP 1.0 functions.
list with inputs, SummaryStats, staticvars, comp.time.
Run the VRAP2 simulations in C++ over a specified range of escapement rates (ERs).
RunSims2C(inputs, silent = TRUE)
RunSims2C(inputs, silent = TRUE)
inputs |
A list of the necessary input values (can be taken from .rav file). |
silent |
Whether print progress as the current ER value. |
Calls the C++ function 'simFish' to run the VRAP simulations and returns a 3D array of the total escapement at each exploitation rate (ER) for NRuns over NYears.
A list with the input and the 3D array of total escapment values.
Run the VRAP2 simulations in native R over a specified range of escapement rates (ERs).
RunSims2R(inputs, silent = TRUE)
RunSims2R(inputs, silent = TRUE)
inputs |
A list of the necessary input values (can be taken from .rav file). |
silent |
Whether print progress as the current ER value. |
Runs the simulations and returns an 3D array of the total escapement at each exploitation rate (ER) for NRuns over NYears.
A list with the inputs and the 3D array of total escapment values.
Takes the input list and writes a .rap file.
WriteRapFile(inputs, FileName = "tmp.rav")
WriteRapFile(inputs, FileName = "tmp.rav")
inputs |
A list of the necessary input values for RunSims2R and RunSims2C. |
ravFileName |
Name of the .rav file that data will be written to. |
Takes the inputs list and write a .rap file that can be input into VRAP 2.0 function ReadRapFile or GetInput. Note that in VRAP 2.0, the beginning and ending ER (or Pop) values are given in absolute values not as a fraction of base level as in VRAP 1.0.
Nothing. The data is written to FileName.
Takes the input list and write a .rav file.
WriteRavFile(inputs, FileName = "tmp.rav")
WriteRavFile(inputs, FileName = "tmp.rav")
inputs |
A list of the necessary input values for RunSims2R and RunSims2C. |
FileName |
Name of the .rav file that data will be written to. |
Takes the inputs list and write a .rav file that can be input into the VRAP 1.0 function Main.
Nothing. The data is written to ravFileName.