« Close

Datasheets and User Guides

App Notes

Software & Driver

 

LJM_STREAM_TRANSFERS_PER_SECOND

Summary

LJM_STREAM_TRANSFERS_PER_SECOND is a numerical readable and writable LJM library configuration which sets how many times per second LJM's stream thread attempts to receive stream packet(s) from the device.

The constant LJM_STREAM_TRANSFERS_PER_SECOND can be used interchangeably with the string "LJM_STREAM_TRANSFERS_PER_SECOND".

Details

LJM_STREAM_TRANSFERS_PER_SECOND is an advanced configuration. Modifying it is not recommended for most users.

Increasing LJM_STREAM_TRANSFERS_PER_SECOND to a higher value will allow for less latency in receiving stream data, since LJM will receive data from the device more often (in smaller quantities). Increasing the LJM_STREAM_TRANSFERS_PER_SECOND too much will cause the data contained in each packet to decrease, which will cause unnecessary overhead and potentially cause scans to be missed.

You can enable debug logging with LJM_TRACE as the LJM_DEBUG_LOG_LEVEL to see how stream is set up. After running a test stream, search the log file for the term "streaming initialized" to see what effects LJM_STREAM_TRANSFERS_PER_SECOND has on stream setup. Make sure to disable debug logging for your real stream sessions after finding settings for stream setup that looks reasonable, since debug logging consumes a significant amount of processing. LJM's stream setup is deterministic, so given the same parameters to LJM_eStreamStart and the same stream configurations, stream will be set up the same way every time.

Decreasing LJM_STREAM_TRANSFERS_PER_SECOND to a lower value will theoretically cause less overhead in stream, since LJM will receive data from the device less often (in larger quantities), but may have little to no effect. When decreasing LJM_STREAM_TRANSFERS_PER_SECOND, it is recommended to increase the size of the stream buffer on the device. See the Modbus register STREAM_BUFFER_SIZE_BYTES (address: 4012).

Setting a new LJM_STREAM_TRANSFERS_PER_SECOND value will not affect stream threads that are already in progress.

Relevant Functions

To read LJM_STREAM_TRANSFERS_PER_SECOND, use LJM_ReadLibraryConfigS.

To write LJM_STREAM_TRANSFERS_PER_SECOND, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.

Example

[C/C++] Read LJM_STREAM_TRANSFERS_PER_SECOND then set it to 100.

char ErrorString[LJM_MAX_NAME_SIZE];
double value;

int LJMError = LJM_ReadLibraryConfigS(LJM_STREAM_TRANSFERS_PER_SECOND, &value);
if (LJMError != 0) {
    LJM_ErrorToString(LJMError, ErrorString);
    printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
}
printf("The default for LJM_STREAM_TRANSFERS_PER_SECOND is %.00f\n", value);

value = 100;
printf("Setting LJM_STREAM_TRANSFERS_PER_SECOND to %.00f\n", value);
LJMError = LJM_WriteLibraryConfigS(LJM_STREAM_TRANSFERS_PER_SECOND, value);
if (LJMError != 0) {
    LJM_ErrorToString(LJMError, ErrorString);
    printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString);
}

Possible output:

The default for LJM_STREAM_TRANSFERS_PER_SECOND is 25
Setting LJM_STREAM_TRANSFERS_PER_SECOND to 100

 

For more LJM configurations, see Library Configuration Functions.