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. Keeping the simulation state in its own environment lets the annual cycle helpers update shared arrays in place from inside with() blocks, without threading them through every call.

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, compute_biom_y_sim, 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, draw_index_obs, resolve_idx_factor, draw_at_age_sources, collapse_seas_discards, redraw_year_total_comps, seas_agg_season.

Examples

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