From 2f14f0c9539c9f1fad36269dd11d9cf4fb35d773 Mon Sep 17 00:00:00 2001 From: minsoo Date: Wed, 23 Sep 2026 16:26:40 -0500 Subject: [PATCH 1/3] TimeTag exceeds latest available data in ring buffer resolution from ramtares_main --- .../buffers/include/tagged_ring_buffer.hh | 29 ++++++++++++++++++- .../SIM_tagged_ring_buffer/RUN_test/input.py | 7 ++++- .../verif_data/RUN_test/log_lookup_data.csv | 5 ++++ .../verif_data/RUN_test/log_test_data.csv | 5 ++++ 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/models/utilities/buffers/include/tagged_ring_buffer.hh b/models/utilities/buffers/include/tagged_ring_buffer.hh index 3db46fe8..562af4cf 100644 --- a/models/utilities/buffers/include/tagged_ring_buffer.hh +++ b/models/utilities/buffers/include/tagged_ring_buffer.hh @@ -9,6 +9,7 @@ PURPOSE: ( PROGRAMMERS: (((Gary Turner) (OSR) (Sep 2023) (ANTARES) (initial)) + ((Dohyeung Kim) (OSR) (Apr 2026) (Update Proximity Case)) ) ASSUMPTIONS: @@ -66,10 +67,26 @@ class CMLTaggedRingBuffer : public CMLSimpleRingBuffer< CMLTaggedRingBufferMembe the specified tag (false, default), or for a data-set with a tag identical to the specified tag (true).*/ + bool proximity_flag; /* (--) + When the model looks for the data-set with a tag closest in value to + the specified tag (require_exact_tag == false), this flag determines + whether the searched closest data-set is within a certain proximity (true) + or simply the absolute closest regardless of time difference (false, + default) */ + + double proximity_th; /* (--) + The maximum allowable time difference between a tag closest and the + specified tag. If the proximity_flag is true, the lookup_tag function + returns the data-set with a tag closest in value to the specified tag + only if the difference is within this threshold; otherwise, it returns + a null pointer with a error message*/ explicit CMLTaggedRingBuffer( const std::string& name) : CMLSimpleRingBuffer>(name) + require_exact_tag(false), + proximity_flag(false), + proximity_th(std::numeric_limits::infinity()) {} ~CMLTaggedRingBuffer() override = default; @@ -222,8 +239,18 @@ Note: tag_delta_min = tag_delta; } } + + if (proximity_flag && tag_delta_min > proximity_th) { + CMLMessage::error( __FILE__,__LINE__, + "In buffer ", name_,", could not find a tag ",t," within the proximity threshold ", + proximity_th,"\n" + "Cannot identify the desired data set.\n" + "Returning NULL.\n"); + return nullptr; + } + // return the data at the index identified with prox_ix. return &data_[prox_ix].data; } }; -#endif \ No newline at end of file +#endif diff --git a/models/utilities/buffers/verif/SIM_tagged_ring_buffer/RUN_test/input.py b/models/utilities/buffers/verif/SIM_tagged_ring_buffer/RUN_test/input.py index ced5d54b..40acecbe 100644 --- a/models/utilities/buffers/verif/SIM_tagged_ring_buffer/RUN_test/input.py +++ b/models/utilities/buffers/verif/SIM_tagged_ring_buffer/RUN_test/input.py @@ -11,4 +11,9 @@ test.sample.lookup_tag = 8.0 trick.add_read(31, "test.sample.lookup_tag =37.75 ") trick.add_read(33, "test.sample.buffer.require_exact_tag = True") -trick.stop(35) +trick.add_read(36, "test.sample.buffer.require_exact_tag = False") +trick.add_read(37, "test.sample.buffer.proximity_th = 0.2") +trick.add_read(38, "test.sample.buffer.proximity_flag = True") +trick.add_read(39, "test.sample.lookup_tag = 32.5 ") +trick.add_read(40, "test.sample.lookup_tag = 36.6 ") +trick.stop(40) \ No newline at end of file diff --git a/models/utilities/buffers/verif/SIM_tagged_ring_buffer/verif_data/RUN_test/log_lookup_data.csv b/models/utilities/buffers/verif/SIM_tagged_ring_buffer/verif_data/RUN_test/log_lookup_data.csv index b2a63cd7..2347745d 100644 --- a/models/utilities/buffers/verif/SIM_tagged_ring_buffer/verif_data/RUN_test/log_lookup_data.csv +++ b/models/utilities/buffers/verif/SIM_tagged_ring_buffer/verif_data/RUN_test/log_lookup_data.csv @@ -35,3 +35,8 @@ sys.exec.out.time {s},test.sample.lookup_tag {1},test.sample.lookup_x {1} 33, 37.75, 34.1 34, 37.75, 36.1 35, 37.75, 36.1 + 36, 37.75, 36.1 + 37, 37.75, 36.1 + 38, 37.75, 36.1 + 39, 32.5, 36.1 + 40, 36.6, 35.1 diff --git a/models/utilities/buffers/verif/SIM_tagged_ring_buffer/verif_data/RUN_test/log_test_data.csv b/models/utilities/buffers/verif/SIM_tagged_ring_buffer/verif_data/RUN_test/log_test_data.csv index c5d0a91e..c89a922f 100644 --- a/models/utilities/buffers/verif/SIM_tagged_ring_buffer/verif_data/RUN_test/log_test_data.csv +++ b/models/utilities/buffers/verif/SIM_tagged_ring_buffer/verif_data/RUN_test/log_test_data.csv @@ -35,3 +35,8 @@ sys.exec.out.time {s},test.sample.buffer_size {1},test.sample.buffer.buffer_ix { 33,5,0, 36.7, 35.1,69, 32.50000000000001, 31.1,61, 33.55000000000001, 32.1,63, 34.60000000000001, 33.1,65, 35.65000000000001, 34.1,67, 0, 0,0, 0, 0,0, 0, 0,0, 0, 0,0, 0, 0,0 34,5,1, 36.7, 35.1,69, 37.75, 36.1,71, 33.55000000000001, 32.1,63, 34.60000000000001, 33.1,65, 35.65000000000001, 34.1,67, 0, 0,0, 0, 0,0, 0, 0,0, 0, 0,0, 0, 0,0 35,10,2, 36.7, 35.1,69, 37.75, 36.1,71, 38.8, 37.1,73, 0, 1.1,1, 0, 1.1,1, 0, 1.1,1, 0, 1.1,1, 33.55000000000001, 32.1,63, 34.60000000000001, 33.1,65, 35.65000000000001, 34.1,67 + 36,10,3, 36.7, 35.1,69, 37.75, 36.1,71, 38.8, 37.1,73, 39.84999999999999, 38.1,75, 0, 1.1,1, 0, 1.1,1, 0, 1.1,1, 33.55000000000001, 32.1,63, 34.60000000000001, 33.1,65, 35.65000000000001, 34.1,67 + 37,10,4, 36.7, 35.1,69, 37.75, 36.1,71, 38.8, 37.1,73, 39.84999999999999, 38.1,75, 40.89999999999999, 39.1,77, 0, 1.1,1, 0, 1.1,1, 33.55000000000001, 32.1,63, 34.60000000000001, 33.1,65, 35.65000000000001, 34.1,67 + 38,10,5, 36.7, 35.1,69, 37.75, 36.1,71, 38.8, 37.1,73, 39.84999999999999, 38.1,75, 40.89999999999999, 39.1,77, 41.94999999999999, 40.1,79, 0, 1.1,1, 33.55000000000001, 32.1,63, 34.60000000000001, 33.1,65, 35.65000000000001, 34.1,67 + 39,10,6, 36.7, 35.1,69, 37.75, 36.1,71, 38.8, 37.1,73, 39.84999999999999, 38.1,75, 40.89999999999999, 39.1,77, 41.94999999999999, 40.1,79, 42.99999999999999, 41.1,81, 33.55000000000001, 32.1,63, 34.60000000000001, 33.1,65, 35.65000000000001, 34.1,67 + 40,10,7, 36.7, 35.1,69, 37.75, 36.1,71, 38.8, 37.1,73, 39.84999999999999, 38.1,75, 40.89999999999999, 39.1,77, 41.94999999999999, 40.1,79, 42.99999999999999, 41.1,81, 44.04999999999998, 42.1,83, 34.60000000000001, 33.1,65, 35.65000000000001, 34.1,67 From e4b70da29c2bbd887b044da918aab9f30aea91e3 Mon Sep 17 00:00:00 2001 From: Minsoo Kang Date: Thu, 1 Oct 2026 17:26:14 -0500 Subject: [PATCH 2/3] Convert constructor initializers to in-class member initializers with their default values --- models/utilities/buffers/include/tagged_ring_buffer.hh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/models/utilities/buffers/include/tagged_ring_buffer.hh b/models/utilities/buffers/include/tagged_ring_buffer.hh index 562af4cf..c861726a 100644 --- a/models/utilities/buffers/include/tagged_ring_buffer.hh +++ b/models/utilities/buffers/include/tagged_ring_buffer.hh @@ -67,14 +67,14 @@ class CMLTaggedRingBuffer : public CMLSimpleRingBuffer< CMLTaggedRingBufferMembe the specified tag (false, default), or for a data-set with a tag identical to the specified tag (true).*/ - bool proximity_flag; /* (--) + bool proximity_flag{false}; /* (--) When the model looks for the data-set with a tag closest in value to the specified tag (require_exact_tag == false), this flag determines whether the searched closest data-set is within a certain proximity (true) or simply the absolute closest regardless of time difference (false, default) */ - double proximity_th; /* (--) + double proximity_th{std::numeric_limits::infinity()}; /* (--) The maximum allowable time difference between a tag closest and the specified tag. If the proximity_flag is true, the lookup_tag function returns the data-set with a tag closest in value to the specified tag @@ -84,10 +84,8 @@ class CMLTaggedRingBuffer : public CMLSimpleRingBuffer< CMLTaggedRingBufferMembe explicit CMLTaggedRingBuffer( const std::string& name) : CMLSimpleRingBuffer>(name) - require_exact_tag(false), - proximity_flag(false), - proximity_th(std::numeric_limits::infinity()) {} + ~CMLTaggedRingBuffer() override = default; From 472c829d77bc3b42993d7cbc388730845c0880ca Mon Sep 17 00:00:00 2001 From: Minsoo Kang <327114246+Minsoo-Kang-space@users.noreply.github.com> Date: Tue, 13 Oct 2026 10:30:05 -0500 Subject: [PATCH 3/3] Add dependent library, fix ambiguous variable --- models/utilities/buffers/include/tagged_ring_buffer.hh | 7 ++++--- .../buffers/verif/SIM_tagged_ring_buffer/RUN_test/input.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/models/utilities/buffers/include/tagged_ring_buffer.hh b/models/utilities/buffers/include/tagged_ring_buffer.hh index c861726a..80df6003 100644 --- a/models/utilities/buffers/include/tagged_ring_buffer.hh +++ b/models/utilities/buffers/include/tagged_ring_buffer.hh @@ -28,6 +28,7 @@ ASSUMPTIONS: #include #include #include +#include /***************************************************************************** CMLTaggedRingBufferMember @@ -74,7 +75,7 @@ class CMLTaggedRingBuffer : public CMLSimpleRingBuffer< CMLTaggedRingBufferMembe or simply the absolute closest regardless of time difference (false, default) */ - double proximity_th{std::numeric_limits::infinity()}; /* (--) + double proximity_threshold{std::numeric_limits::infinity()}; /* (--) The maximum allowable time difference between a tag closest and the specified tag. If the proximity_flag is true, the lookup_tag function returns the data-set with a tag closest in value to the specified tag @@ -238,10 +239,10 @@ Note: } } - if (proximity_flag && tag_delta_min > proximity_th) { + if (proximity_flag && tag_delta_min > proximity_threshold) { CMLMessage::error( __FILE__,__LINE__, "In buffer ", name_,", could not find a tag ",t," within the proximity threshold ", - proximity_th,"\n" + proximity_threshold,"\n" "Cannot identify the desired data set.\n" "Returning NULL.\n"); return nullptr; diff --git a/models/utilities/buffers/verif/SIM_tagged_ring_buffer/RUN_test/input.py b/models/utilities/buffers/verif/SIM_tagged_ring_buffer/RUN_test/input.py index 40acecbe..0e82e162 100644 --- a/models/utilities/buffers/verif/SIM_tagged_ring_buffer/RUN_test/input.py +++ b/models/utilities/buffers/verif/SIM_tagged_ring_buffer/RUN_test/input.py @@ -12,7 +12,7 @@ trick.add_read(31, "test.sample.lookup_tag =37.75 ") trick.add_read(33, "test.sample.buffer.require_exact_tag = True") trick.add_read(36, "test.sample.buffer.require_exact_tag = False") -trick.add_read(37, "test.sample.buffer.proximity_th = 0.2") +trick.add_read(37, "test.sample.buffer.proximity_threshold = 0.2") trick.add_read(38, "test.sample.buffer.proximity_flag = True") trick.add_read(39, "test.sample.lookup_tag = 32.5 ") trick.add_read(40, "test.sample.lookup_tag = 36.6 ")