+1 vote
140 views
in Test Automation by Milinko Sreckovic (13 points)

Our capture system needs to:

  1. Limit memory to ~50MB

  2. Automatically overwrite oldest data when full (circular buffer behavior)

  3. Currently uses clstub().start_capture() with a Python Queue (pure FIFO)

We need something like

# Python API example hil.set_capture_buffer_size("signal_name", buffer_size=1000)  # 1000 samples

1 Answer

+1 vote
by Aleksandar Lakic (24 points)
Hi,

Currently, HIL API start_capture doesn't support circular buffer behavior or size limiting.

start_capture expects queue.Queue or list object as dataBuffer, so in theory custom container can be created (which implements list or Queue interface), with some additional logic like circular data buffer.
by Milinko Sreckovic (13 points)
+1
Hi Aleksandar,

Thank you for your previous response regarding implementing a circular buffer for start_capture() to limit memory usage. I have a follow-up question about CSV file handling:

If I implement a custom circular buffer (e.g., a Queue or list subclass that overwrites old data), what happens to the CSV file generated by the capture system? Since the buffer only retains the most recent samples, but the CSV might keep growing indefinitely, how can I:

    Limit the CSV file size (e.g., ~50MB) to match the circular buffer behavior?

    Automatically overwrite or rotate CSV files when full (similar to the buffer)?

Is there a built-in way to control CSV writing in the HIL API, or would I need to manage this separately?
by Aleksandar Lakic (24 points)
+1
start_capture currently doesn't allow providing a file-like object as argument for a fileName parameter (it's only a file path string). So, handling of CSV file is not supported at that level. Maybe, it can be accomplished by some third party tools for handling files outside HIL API.
...