Skip to content

Commit 37db2c9

Browse files
add bench SR_curve; cleanup spawn_recr report
1 parent eaba263 commit 37db2c9

5 files changed

Lines changed: 46 additions & 37 deletions

File tree

SS_benchfore.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ FUNCTION void Get_Benchmarks(const int show_MSY)
785785
Recr_unf = mfexp(SRparm_bench(1)); // R0 to be used
786786
Fishon = 0;
787787
SSBpR_Calc(Recr_unf); // this returns SSB_equil using benchmark biology
788-
dvariable SSBpR_bench = SSB_equil / Recr_unf;
788+
SSBpR_bench = SSB_equil / Recr_unf;
789789

790790
report5 << "virgin: " << Recr_virgin << " " << SSB_virgin << endl;
791791
report5 << "bench: " << Recr_unf << " " << SSB_equil << endl;
@@ -855,10 +855,10 @@ FUNCTION void Get_Benchmarks(const int show_MSY)
855855
if (show_MSY == 1)
856856
{
857857
SRparm_bench(N_SRparm2 + 1) = SSB0_4_SRR;
858-
Mgmt_quant(1) = SSB_unf;
858+
Mgmt_quant(1) = SSB0_4_SRR;
859859
Mgmt_quant(2) = totbio; // this is calculated in Do_Equil_Calc
860860
Mgmt_quant(3) = smrybio;
861-
Mgmt_quant(4) = Recr_unf;
861+
Mgmt_quant(4) = R0_4_SRR;
862862
report5 << "SRparms for benchmark: " << SRparm_bench << endl
863863
<< "Benchmark biology averaged over years: " << Bmark_Yr(1) << " " << Bmark_Yr(2) << endl << endl;
864864
Mgmt_quant(19) = SSB_unf; // placeholder for depletion denominator

SS_param.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ PARAMETER_SECTION
167167
number half_sigmaRsq;
168168
number sigmaR;
169169
number SSBpR_virgin;
170+
number SSBpR_bench;
170171
number SSB0_4_SRR;
171172
number R0_4_SRR;
172173
number regime_change;

SS_readcontrol_330.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,7 @@
19711971
19721972
int timevary_SRparm_first; // == 0 means that no relevant parms are timevarying
19731973
int firstSRparm;
1974+
int timevary_SRparm_first_yr; // year
19741975
int timevary_parm_SR_last;
19751976
ivector timevary_SRparm(styr-3,YrMax+1);
19761977
ivector SRparm_timevary(1,N_SRparm2);
@@ -1981,6 +1982,7 @@
19811982
firstSRparm = ParCount;
19821983
timevary_parm_SR_last = 0;
19831984
timevary_SRparm_first = 0;
1985+
timevary_SRparm_first_yr = 0;
19841986
timevary_SRparm.initialize();
19851987
SRparm_timevary.initialize();
19861988
SR_env_link = 0;
@@ -2142,6 +2144,7 @@
21422144
if (timevary_pass(y) > 0 && j != N_SRparm2 - 1)
21432145
{
21442146
timevary_SRparm(y) = timevary_pass(y); // set timevary flag, except for regime parameter
2147+
timevary_SRparm_first_yr = y;
21452148
SRflag = 1; // first change point
21462149
}
21472150
else if(SRflag == 1)

SS_write_report.tpl

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ FUNCTION void write_bigoutput()
7777
SS2out << "Data_File: " << datfilename << endl;
7878
SS2out << "Control_File: " << ctlfilename << endl;
7979
if (readparfile >= 1)
80-
SS2out << "Start_parm_values_from_SS.PAR" << endl;
80+
{SS2out << "Start_parm_values_from_SS.PAR" << endl;}
81+
else
82+
{SS2out << "Start_parm_values_from_control_file" << endl;}
8183
SS2out << endl
8284
<< "Convergence_Level: " << objective_function_value::pobjfun->gmax << " is_final_gradient" << endl;
8385
temp = get_ln_det_value();
@@ -1889,44 +1891,36 @@ FUNCTION void write_bigoutput()
18891891
SS2out << endl;
18901892
}
18911893

1892-
SS2out << endl << "#New_Expanded_Spawn_Recr_report" << endl << pick_report_name(19) << endl;
1894+
SS2out << endl << "#Expanded_Spawn_Recr_report" << endl << pick_report_name(19) << endl;
18931895
SS2out << SR_fxn << " # SR_Function" << endl;
1894-
SS2out << "# " <<endl << "Flags_for_timevary_biology_and_SR" << endl;
1895-
SS2out << timevary_bio_4SRR << " # timevary_bio_4SRR #_Compatibility_flag_for_legacy_(0)_vs_improved_(1)_impact_of_timevary_biology_on_benchmark_SRR_calcs" << endl;
1896-
SS2out << timevary_MG_firstyr << " # timevary_MG_firstyr ";
1897-
if( timevary_MG_firstyr == YrMax)
1898-
{ SS2out << " #_No_timevary_MGparm " << endl; }
1899-
else
1900-
{ SS2out << " #_some_timevary_MGparm_or_EWAA: " << timevary_MG_firstyr << endl; }
1901-
19021896
SS2out << N_SRparm2 << " # N_SRparms" << endl;
1903-
SS2out << "#" << endl << "#_SRparm parm_label value phase" << endl;
1897+
SS2out << "#" << endl << "#_SRparm parm_label value phase TV_year" << endl;
19041898
for (int j = 1; j <=N_SRparm2; j++)
19051899
{
19061900
SS2out << "# " << j << " " << ParmLabel(firstSRparm + j) << " " << SRparm(j) << " " << SRparm_PH(j);
19071901
if (SRparm_timevary(j) > 0 && j <= 4 ) // timevary SRparm exists
1908-
{SS2out << " #_TV";}
1909-
if (j == (N_SRparm2 - 1) && SRparm_timevary(j) > 0) // timevary regime exists
1910-
{SS2out << " #_Regime_used_to_offset_from_SRR";}
1911-
SS2out << endl;
1902+
{SS2out << " " << timevary_SRparm_first_yr;} else {SS2out << " -";}
1903+
SS2out << endl;
19121904
}
1913-
1914-
if( timevary_SRparm_first == 0)
1915-
{ SS2out << "0 #_No_timevary_SRparms,_other_than_regime " << endl; }
1905+
SS2out << "#" << endl;
1906+
if (SRparm_timevary(N_SRparm2 - 1) > 0) // timevary regime exists
1907+
{SS2out << " #_Regime_used_to_offset_from_SRR";}
1908+
SS2out << timevary_bio_4SRR << " # timevary_bio_4SRR #_Compatibility_flag_for_legacy_(0)_vs_improved_(1)_impact_of_timevary_biology_on_benchmark_SRR_calcs" << endl;
1909+
if( timevary_MG_firstyr == YrMax)
1910+
{ SS2out << " #_No_timevary_MGparm" << endl; }
19161911
else
1917-
{
1918-
for (y = styr; y <= YrMax; y++) if (timevary_SRparm(y) == 1) SS2out << y;
1919-
SS2out << " # timevary_SRparm_begin_year" << endl;
1920-
}
1912+
{ SS2out << timevary_MG_firstyr << " #_first year_timevary_MGparm_(or_any_year_EWAA) " << endl; }
19211913

1922-
SS2out << "#" << endl << "Quantities for MSY and other benchmark calculations " << endl << "Benchmark_years: 1_beg_bio 2_end_bio 3_beg_selex 4_end_selex 5_beg_relF 6_end_relF 7_beg_recr_dist 8_end_recr_dist 9_beg_SRparm 10_end_SRparm" << endl;
1923-
SS2out << "Benchmark_years: " << Bmark_Yr << endl;
1914+
SS2out << "#" << endl << "Quantities for MSY and other benchmark calculations " << endl
1915+
<< "Benchmark_index: 1 2 3 4 5 6 7 8 9 10" << endl
1916+
<< "Benchmark_label: beg_bio end_bio beg_selex end_selex beg_relF end_relF beg_recr_dist end_recr_dist beg_SRparm end_SRparm" << endl
1917+
<< "Benchmark_years: " << Bmark_Yr << endl;
19241918
for ( int k = 1; k <=9; k+=2)
19251919
{ if (Bmark_Yr(k+1) > Bmark_Yr(k))
1926-
{SS2out << "#_range_of_years_is_averaged,_so_reduces_standard_error_of_result;_do_this_only_when_timevarying_makes_necessary: " << k << " "<< k+1 << endl;}
1920+
{SS2out << "#_NOTE:_using_range_of_years_can_reduce_standard_error_of_result;_do_this_only_when_timevarying_makes_necessary: " << k << " " << Bmark_Yr(k) << " " << Bmark_Yr(k+1) << endl;}
19271921
}
1928-
SS2out << "SSBpR0_(virgin): " << SSBpR_virgin << " #_uses_biology_from_start_year: " << styr <<endl;
1929-
SS2out << "SSBpR_unfished_benchmark: " << Mgmt_quant(1) / Mgmt_quant(4) << " #_based_on_averaging_biology_over_benchmark_year_range " << endl;
1922+
SS2out << "SSBpR0_virgin: " << SSBpR_virgin << " #_uses_biology_from_start_year: " << styr <<endl;
1923+
SS2out << "SSBpR_unfished_benchmark: " << SSBpR_bench << " #_uses_biology_over_benchmark_year_range " << endl;
19301924

19311925
switch (SR_fxn)
19321926
{
@@ -1998,13 +1992,13 @@ FUNCTION void write_bigoutput()
19981992
write_message (WARN, 0);
19991993
}
20001994
}
2001-
SS2out << endl << "#" << endl << "Initial_equilibrium: " << init_equ_steepness << " # 0/1_to_use_spawner-recruitment_in_initial_equ_recruitment_calculation" << endl << "#" << endl;
2002-
SS2out << "Yr SpawnBio exp_recr with_regime bias_adjusted pred_recr dev biasadjuster era mature_bio mature_num raw_dev SPR0_curr " << endl;
1995+
SS2out << endl << "#" << endl << init_equ_steepness << " # Initial_equilibrium:_0/1_to_use_spawner-recruitment_in_initial_equ_recruitment_calculation" << endl << "#" << endl;
1996+
SS2out << "Yr SpawnBio exp_recr with_regime bias_adjusted pred_recr dev biasadjuster era mature_bio mature_num raw_dev SSBpR(yr) " << endl;
20031997

20041998
y = styr - 2;
2005-
SS2out << "Virg " << SSB_yr(y) << " " << exp_rec(y) << " - " << 0.0 << " Virg " << SSB_B_yr(y) << " " << SSB_N_yr(y) << " 0.0 " << " " << SSBpR_virgin << endl;
1999+
SS2out << "Virg " << SSB_yr(y) << " " << exp_rec(y) << " _ " << 0.0 << " Virg " << SSB_B_yr(y) << " " << SSB_N_yr(y) << " _ " << SSBpR_virgin << endl;
20062000
y = styr - 1;
2007-
SS2out << "Init " << SSB_yr(y) << " " << exp_rec(y) << " - " << 0.0 << " Init " << SSB_B_yr(y) << " " << SSB_N_yr(y) << " " << 0.0 << " " << SSBpR_virgin << endl;
2001+
SS2out << "Init " << SSB_yr(y) << " " << exp_rec(y) << " _ " << 0.0 << " Init " << SSB_B_yr(y) << " " << SSB_N_yr(y) << " _ " << SSBpR_virgin << endl;
20082002

20092003
if (recdev_first < styr)
20102004
{
@@ -2058,16 +2052,27 @@ FUNCTION void write_bigoutput()
20582052
{
20592053
{
20602054
SS2out << endl
2061-
<< pick_report_name(20) << endl;
2055+
<< pick_report_name(20) << endl
2056+
<< "# using_virgin_SR_parameters: " << SRparm_work << endl;
20622057
SS2out << "SSB/SSB_virgin SSB Recruitment" << endl;
2063-
y = styr;
20642058
SRparm_work = SRparm_byyr(styr);
20652059
for (f = 1; f <= 120; f++)
20662060
{
20672061
SSB_current = double(f) / 100. * SSB_virgin;
20682062
temp = Spawn_Recr(SRparm_work, SSB_virgin, Recr_virgin, SSB_current);
20692063
SS2out << SSB_current / SSB_virgin << " " << SSB_current << " " << temp << endl;
20702064
}
2065+
SS2out << endl
2066+
<< "SPAWN_RECR_CURVE report:20 Benchmark" << endl // revise this name per r4ss needs
2067+
<< "# using_benchmark_SR_parameters: " << SRparm_bench << endl;
2068+
SS2out << "SSB/SSB_benchmark SSB Recruitment" << endl;
2069+
for (f = 1; f <= 120; f++)
2070+
{
2071+
SSB_current = double(f) / 100. * SSB0_4_SRR;
2072+
temp = Spawn_Recr(SRparm_bench, SSB0_4_SRR, R0_4_SRR, SSB_current);
2073+
SS2out << SSB_current / SSB0_4_SRR << " " << SSB_current << " " << temp << endl;
2074+
}
2075+
20712076
}
20722077
}
20732078

SS_write_ssnew.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ FUNCTION void write_nucontrol()
21382138
}
21392139

21402140
report4 << "#" << endl;
2141-
report4 << SR_fxn << " #_Spawner-Recruitment; Options: 1=NA; 2=Ricker; 3=std_B-H; 4=SCAA; 5=Hockey; 6=B-H_flattop; 7=survival_3Parm; 8=Shepherd_3Parm; 9=RickerPower_3parm" << endl;
2141+
report4 << SR_fxn << " #_Spawner-Recruitment; Options: 1=NA; 2=Ricker; 3=std_B-H; 4=SCAA; 5=Hockey; 6=B-H_flattop; 7=survival_3Parm; 8=Shepherd_3Parm; 9=RickerPower_3parm; 10=B-H_ab" << endl;
21422142
report4 << init_equ_steepness << " # 0/1 to use steepness in initial equ recruitment calculation" << endl;
21432143
report4 << " 0 # not_used" << endl;
21442144
report4 << "#_ LO HI INIT PRIOR PR_SD PR_type PHASE env-var use_dev dev_mnyr dev_mxyr dev_PH Block Blk_Fxn # parm_name" << endl;

0 commit comments

Comments
 (0)