When I send the LabVIEW array in RTI DDS, the array length is a problem. However, I found in the RTI_DDS_Toolkit_GettingStarted. PDF file of RTI DDS that I could solve this problem with sequence, but I don't know which data type the sequence in the file refers to in LabVIEW.
Hi Yugonghui
The toolkit uses DDS internally. DDS supports two kinds of data sets, DDS arrays and DDS sequences. The difference is that DDS sequences can have variable sizes. DDS Arrays are fixed size. If you configure your DataType with a DDS array of five elements but you try to send four you will get an error. Since LabVIEW only have arrays, the toolkit allows choosing if the LabVIEW arrays of your .ctl are internally mapped as DDS sequences or DDS arrays (that is sending or receiving as DDS arrays or DDS sequences). That is done with the option "forceArrayMapping" of the Advanced Create Reader/Writer. It allows you to select between using DDS arrays or DDS sequences.
If you need to send variable size LabVIEW arrays then always use DDS sequences (forceArrayMapping off). Otherwise you can use DDS arrays.
Keep in mind that DDS arrays and DDS sequences don't match between them. If you use DDS sequences in the writer you have to use sequences in the readers as well. Same with DDS arrays.
Hi Ismael Mendez,
So the DDS sequence need to initialize the publisher and subscriber array biggest length. This is a huge waste of memory.
Is there anyway better?
Sequences only allocate the memory required for hosting the number of elements they have. For example, a sequence of a maximum of 50 elements that has only three elements will allocate memory only for three elements. I think you are confusing some terms. LabVIEW arrays must be initialized at the maximum desired size when generating the VIs with Complex Type Generator. This is how Complex Type Generator knows the maximum size.But later, when those VIs are executed, if using sequences only will use memory for the number of elements sent/receive.