@@ -792,13 +792,19 @@ class Simulation : public BaseT
792792
793793 if (t + delay_npi_implementation < direc_end) {
794794 auto t_start = SimulationTime<FP>(t + delay_npi_implementation);
795- // set the end to the minimum of start+delay and the end of the directive
795+ // set the end to the minimum of start+duration and the end of the directive
796796 auto t_end = SimulationTime<FP>(min<FP>(direc_end, FP (t_start + dyn_npis.get_duration ())));
797797 this ->get_model ().parameters .get_start_commuter_detection () = (FP)t_start;
798798 this ->get_model ().parameters .get_end_commuter_detection () = (FP)t_end;
799799 m_dynamic_npi = std::make_pair (exceeded_threshold->first , t_end);
800+ // For t_start > 0: shift dampings by +1 so the smooth transition window
801+ // [t_start, t_start+1] lies in the future, consistent with predefined dampings.
802+ // For t_start = 0: window [-1, 0] is in the past, so keep as is.
803+ auto t_start_damping =
804+ (FP (t_start) > FP (0 )) ? SimulationTime<FP>(FP (t_start) + FP (1 )) : t_start;
805+ auto t_end_damping = (FP (t_start) > FP (0 )) ? SimulationTime<FP>(FP (t_end) + FP (1 )) : t_end;
800806 implement_dynamic_npis (contact_patterns.get_cont_freq_mat (), exceeded_threshold->second ,
801- t_start, t_end , [](auto & g) {
807+ t_start_damping, t_end_damping , [](auto & g) {
802808 return make_contact_damping_matrix (g);
803809 });
804810 }
0 commit comments