From 8d84178a728191b8529f5e4fdc2f3dc550a89868 Mon Sep 17 00:00:00 2001 From: Rick-Methot-NOAA Date: Mon, 27 Jul 2026 16:49:35 -0700 Subject: [PATCH 1/2] repair density-dependent parameter functionality --- SS_global.tpl | 15 ++++++++++----- SS_readcontrol_330.tpl | 8 ++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/SS_global.tpl b/SS_global.tpl index c18dc5af..221e7cb6 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -95,6 +95,7 @@ GLOBALS_SECTION adstring onenum2(4); adstring anystring; adstring anystring2; + adstring DD_name; adstring report_sso_filename; adstring MSY_name; // label describing what Do_MSY and MSY_units are being used @@ -716,13 +717,17 @@ GLOBALS_SECTION // if(timevary_setup(7)==97) timevary_setup(7)=-3; // for linking to rel_smrybio // if(timevary_setup(7)==96) timevary_setup(7)=-4; // for linking to rel_smry_num echoinput << "env link_type: " << k << " env_var: " << timevary_setup(7) << endl; + if (timevary_setup(7) >= 0) + {DD_name = "X";} + else + {DD_name = "_DD";} switch (k) { case 1: // multiplicative { echoinput << " do env mult for parm: " << j << " " << ParmLabel(j) << endl; ParCount++; - ParmLabel += ParmLabel(j) + "_ENV_mult"; + ParmLabel += ParmLabel(j) + "_ENV_mult" + DD_name; timevary_parm_cnt++; dvector tempvec(1, 7); tempvec.initialize(); @@ -741,7 +746,7 @@ GLOBALS_SECTION { echoinput << " do env additive " << endl; ParCount++; - ParmLabel += ParmLabel(j) + "_ENV_add"; + ParmLabel += ParmLabel(j) + "_ENV_add" + DD_name; timevary_parm_cnt++; dvector tempvec(1, 7); tempvec.initialize(); @@ -760,7 +765,7 @@ GLOBALS_SECTION { echoinput << " do env constrained " << endl; ParCount++; - ParmLabel += ParmLabel(j) + "_ENV_add_constr"; + ParmLabel += ParmLabel(j) + "_ENV_add_constr" + DD_name; timevary_parm_cnt++; dvector tempvec(1, 7); tempvec.initialize(); @@ -778,7 +783,7 @@ GLOBALS_SECTION case 4: // logistic with offset { ParCount++; - ParmLabel += ParmLabel(j) + "_ENV_offset"; + ParmLabel += ParmLabel(j) + "_ENV_offset" + DD_name; timevary_parm_cnt++; dvector tempvec(1, 7); tempvec.initialize(); @@ -792,7 +797,7 @@ GLOBALS_SECTION } timevary_parm_rd.push_back(tempvec(1, 7)); ParCount++; - ParmLabel += ParmLabel(j) + "_ENV_lgst_slope"; + ParmLabel += ParmLabel(j) + "_ENV_lgst_slope" + DD_name; timevary_parm_cnt++; tempvec.initialize(); if (autogen_timevary >= 1) // read diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index e51c74b9..8e11b43e 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -1812,7 +1812,7 @@ env_data_pass(1) = env_data_minyr(k); env_data_pass(2) = env_data_maxyr(k); } - else if (abs(MGparm_1(j, 8) > 0)) // density-dependence + else if (abs(MGparm_1(j, 8)) > 0) // density-dependence { timevary_setup(7) = -int(abs(MGparm_1(j, 8)) - k * 100); do_densitydependent = 1; @@ -2191,7 +2191,7 @@ env_data_pass(1) = env_data_minyr(k); env_data_pass(2) = env_data_maxyr(k); } - else if (abs(SRparm_1(j, 8) > 0)) // density-dependence + else if (abs(SRparm_1(j, 8)) > 0) // density-dependence { timevary_setup(7) = -int(abs(SRparm_1(j, 8)) - k * 100); do_densitydependent = 1; @@ -3340,7 +3340,7 @@ env_data_pass(1) = env_data_minyr(k); env_data_pass(2) = env_data_maxyr(k); } - else if (abs(Q_parm_1(j, 8) > 0)) // density-dependence + else if (abs(Q_parm_1(j, 8)) > 0) // density-dependence { timevary_setup(7) = -int(abs(Q_parm_1(j, 8)) - k * 100); do_densitydependent = 1; @@ -4603,7 +4603,7 @@ env_data_pass(1) = env_data_minyr(k); env_data_pass(2) = env_data_maxyr(k); } - else if (abs(selparm_1(j, 8) > 0)) // density-dependence + else if (abs(selparm_1(j, 8)) > 0) // density-dependence { timevary_setup(7) = -int(abs(selparm_1(j, 8)) - k * 100); do_densitydependent = 1; From 45ab11fc3f498ef64723d675a2290f1b2fb6792b Mon Sep 17 00:00:00 2001 From: Rick-Methot-NOAA Date: Tue, 28 Jul 2026 10:11:31 -0700 Subject: [PATCH 2/2] addressing review comments --- SS_global.tpl | 2 +- SS_write_report.tpl | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/SS_global.tpl b/SS_global.tpl index 221e7cb6..618cfde3 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -718,7 +718,7 @@ GLOBALS_SECTION // if(timevary_setup(7)==96) timevary_setup(7)=-4; // for linking to rel_smry_num echoinput << "env link_type: " << k << " env_var: " << timevary_setup(7) << endl; if (timevary_setup(7) >= 0) - {DD_name = "X";} + {DD_name = "";} else {DD_name = "_DD";} switch (k) diff --git a/SS_write_report.tpl b/SS_write_report.tpl index d604b0be..43f9c2e9 100644 --- a/SS_write_report.tpl +++ b/SS_write_report.tpl @@ -153,6 +153,8 @@ FUNCTION void write_bigoutput() pick_report_use(29) = "N"; if (N_envvar == 0) pick_report_use(33) = "N"; + if (do_densitydependent == 1) + pick_report_use(33) = "Y"; if (Do_TG == 0) pick_report_use(34) = "N"; if (Grow_type < 3 || Grow_type > 6) @@ -3082,11 +3084,14 @@ FUNCTION void write_bigoutput() } // REPORT_KEYWORD 33 ENVIRONMENTAL_DATA - if (pick_report_use(33) == "Y" && N_envvar > 0) + if (pick_report_use(33) == "Y" && (N_envvar > 0 || do_densitydependent == 1) ) { SS2out << endl << pick_report_name(33) << endl; - SS2out << "#_Begins.in.startyr-1.which.for.model.generated.columns.shows.the.base.value.to.which.other.years.are.scaled" << endl; + SS2out << "#_Begins.in.startyr-1= " << styr - 1 << endl; + if (do_densitydependent == 1) + { SS2out << "#_some.parameter.is.density-dependent.relative.to.log(X(yr)/X(startyr-1))" << endl; + } SS2out << "#_Ninput.vectors " << N_envvar << endl; SS2out << "#_statistics.for.each.inout.env.vector.where.mc.is.to.meancenter.and.Zscore.also.divides.by.stdev" << endl; SS2out << "Index N minyr maxyr mean stdev mc Zscore" << endl;