CSM-MassData-Parameter-Support is an addon for the Communicable State Machine (CSM) framework that enables efficient transfer of large data sets between CSM modules. It addresses the limitations of API String for transferring large data by using a memory-efficient mechanism to reference rather than directly encode large data structures.
In LabVIEW test and measurement applications, handling large data types such as waveforms, 1D/2D arrays is common, especially with high sampling rates and multi-channel systems. Transferring such large data using traditional API String methods would be inefficient due to:
- Increased memory overhead from plaintext encoding
- Performance issues with encoding/decoding large data
- Reduced readability in debug logs due to excessive text
MassData Support operates on a simple but effective principle:
- Encoding: Converts large data into a reference string ("address") instead of directly encoding the data itself
- Transmission: Sends this compact reference string through CSM's "invisible bus"
- Decoding: The receiving CSM module uses the reference string to retrieve the original large data
The encoded result is a string containing three parts: "flag", "start position", and "size", which act as a "door number" to locate the actual data stored in a dedicated memory space.
- Efficient Transmission: Transfers only a compact reference string instead of the entire data set, avoiding memory copies
- Memory Optimization: Large data is stored in a single location regardless of the number of receivers
- Improved Readability: Compact reference strings are easier to display in CSM Log controls without consuming excessive space
- MassData Support uses a circular buffer mechanism internally
- When the buffer is full, new data will overwrite old data from the beginning
- Once overwritten, the original data can no longer be recovered, and decoding will fail
- All CSM modules within the same application share the same MassData buffer space
- Avoid Infinite Lifecycle Data: Do not use MassData to store data that needs to persist indefinitely
- Configure Appropriate Cache Size: Use the "Config MassData Parameter Cache Size.vi" to set an optimal buffer size
- Not too large (to avoid wasting memory)
- Not too small (to prevent frequent overwriting)
- Use Debugging Tools: Utilize the provided debugging tools to monitor cache usage and determine the optimal configuration
Install the addon via VIPM (VI Package Manager). After installation, you can find it in the CSM addons palette.
- Use encoding VIs to convert large data into MassData arguments
- Transfer these arguments between CSM modules via CSM's parameter passing mechanism
- Use decoding VIs on the receiving end to retrieve the original large data
Check the example folder for demonstrations of:
- MassData argument format
- Displaying MassData cache status on the front panel
- Using MassData in non-CSM frameworks
- Integrating MassData with CSM
LabVIEW 2017 or later
This project is licensed under the MIT License - see the LICENSE file for details