It contains the type of data, the timestamp when data was collected and the “Variant”. This variant could then be filled with anything, for example the voltage data, which is a cluster that contains 4 floating point numbers of BMS voltage measurements.
The DAQ Frame cluster is a nice single object that can be placed in the “write queue”. The items in this queue are passed to a different thread that writes the data to a file, asynchronously. Writing a frame to the file boils down to the following Block Diagram:
This (very simplified) block diagram seems to work very programmer friendly, as it is able to write any type of data to a file.
The main idea behind this implementation was that every measurement type that needs to be stored gets its own DAQ Type (which is an enum) and also its own cluster to be placed inside the variant of the DAQ Frame. This turned out to be actually very annoying to work with, mainly because the measurement cluster needs to be known and implemented both at the writing stage and when reading out the stored data file. This resulted in a lot of work to be done for each measurement type that was added. Also, when the measurement type was not yet implemented on the readout-side of the program, the amount of bytes to be read could not be determined. Well, LabVIEW probably could, but because variants and the Write to Binary File functions are really just black boxes, it was difficult to know what bytes were written exactly.
An additional disadvantage of this implementation was that the CAN messages (containing 64 bits at most) were converted on-board to floating point data (32 or 64 bits per number), for example when measuring the BMS voltages. This increased the file size without increasing the information carried by the file.
Here, the variant was replaced by a simple byte array. The byte array can be of any size. The DAQ Type property lets the readout software know how to interpret the bytes. Here the bytes will be inflated to, for example, floating point data that is more easily understandable by the user.
An advantage to this system is that it is actually easier to process CAN messages. All that needs to be done is to match a specific CAN identifier with the right DAQ Type and just store the bytes of the CAN frame into the DAQ Frame.
For other measurements that are not communicated over the CAN bus, it is a bit less straightforward to store them. Fortunately LabVIEW has a neat Type Cast function, that does a direct reinterpretation of data. For example the Acceleration measurement that simply uses the accelerometer built into the myRIO, as shown below. I have encircled the Type Cast function. In this case, the 64-bit floating point array is first converted into a 32-bit floating point array, whose binary data is then reinterpreted as a byte array.