Skip to contents

Creates a new R environment populated with all objects from sim_list and binds the SPoRC simulation functions required by run_annual_cycle. Isolating the simulation state in a dedicated environment prevents name collisions with the calling frame and allows with() / <<- assignment patterns used internally by the annual-cycle helpers to modify shared state without polluting the global workspace.

Usage

Setup_sim_env(sim_list)

Arguments

sim_list

Named list returned by Setup_Sim_Rec (or the last upstream setup function called). All elements are copied into the new environment via list2env.

Value

A new environment (parent = calling frame) containing every element of sim_list as a named object, plus bound references to the following SPoRC simulation functions: generate_initial_age_structure, generate_recruitment, apply_pop_dy, generate_fishery_catch_comp_idx, generate_survey_comp_idx, release_conv_tags, generate_fishery_conv_tags_recap, Get_Det_Recruitment, Get_Init_NAA, predict_sim_fish_iss_fmort, rho_trans, simulate_comps, simulate_conv_tag_fish_recaptures.

Examples

if (FALSE) { # \dontrun{
sim_env <- Setup_sim_env(sim_list)
} # }