Network Data Server Access

Communication Protocol
All shorts and ints are sent as ASCII characters, int is 8 Hex digits and a short here is 4 Hex digits. Floats are sent represeneted as ints.

Command

Server Response

version

int version = 0xb;

revision

int revision = 4;

status channels 3

0000 for OK or an error code in the same format.
The rest of the fields are in ASCII, separated by the new line character. Integers are decimal. String could be up to 255 characters in length.

int num_channels;

for (int i = 0; i < num_channels; i++) {
  char channel_name[];
  int sampling_rate;
  int data_type; // 1-short; 2-int; 3-long; 4-float; 5-double; 6-complex float
  int tp_num;  // Test point number, zero is sent for the DAQ configured channels.
  int channel_group_num; // Almost disused; 1000 -- DMT channel, 1001 - obsolete
  char unit[];
  float gain;
  float slope;
  float offset;
}


Data is requested using 'start net-writer' command variations. In response the server send the data stream which consists of a header, block of data and reconfiguration blocks. All data variables are binary here, big endian.

Data Structure

Representation

header (length,
             seconds,
             gps,
             seq_num)

long length;  // 16 + following data block's length
long seconds; // time series data length for what is following next in the data block
long gps; // GPS time of the first sample in the following data block
long gps_nanoseconds; // GPS time nanosecond fraction of the first sample in the following data block
long seq_num; // Sequencial number of this block; Starts with zero.

data_block

time series data grouped by channel (not by time) at the sampling rate requested in 'start net-writer' command. If requesetd two channels then in this data blocks server sends data for the first channel and then data for the second channel.

signal_conv

float signal_slope;
float signal_offset;
int data_valid; // Data Valid code for the following data

reconfig_block

header(seconds = -1) followed by reconfiguration data in the following format:
signal_conv_t[n], where n = (header length - 16)/16;
Reconfiguration blocks can be inserted in the data stream of blocks at any point and there is normally one reconfiguration block in the beginning of data transmission, in front of the very first data blocks.


Data Request Command

Request Description

Server Response

gps

Get current GPS time

header(length = 16), ie. no data just header with current GPS time

start net-writer {
"H2:LSC-CARM_CTRL" 128
"H2:LSC-MICH_CTRL" 128
"H2:LSC-PRC_CTRL" 128
"H2:LSC-DARM_CTRL" 128
 "H2:LSC-LA_NPTRX" 128
}

Request full resolution online data on the same socket. All channels are wanted at 128 Hz sampling rate. Data is averaged and decimated by the server. Data is not filtered. Requesting data at lower sampling rate is only usefull for display purposes.

header
reconfig_block
data_block[N]

start trend net-writer  775155636 600 { "H2:SUS-SM1_SUSPIT_INMON.min" "H2:SUS-SM1_SUSPIT_INMON.max" "H2:SUS-SM1_SUSPIT_INMON.mean"
}

Request 600 seconds of second trend data.

header
reconfig_block
data_block[N]

start trend 60 net-writer "7001" 775669072 86400 { "H2:IOO-PZT1_PIT_OFFSET.min" "H2:IOO-PZT1_PIT_OFFSET.max" "H2:IOO-PZT1_PIT_OFFSET.mean"
}

Get minute trend data and route to  TCP port 7001 on requestor's host. Time period of data requested is 775669072 upto 775669072 + 86400 (ie. 86400 is the time series data length in seconds). Channel names wanted are specified in double quotes in curly braces.

header
reconfig_block
data_block[N]


Examples

Here is one example of data access client program based on daqc_access.c code. DataViewer is another example. DTT has its own access library.

Data Valid Codes

We have 0xbad status set by either DAQ controller or a frame builder when the DCU is not on time (out of sync). There is also status bit 0x1000 that's added when the data for that block did not check out using the CRC,
ie. checksum mismatch between front-end and frame builder. There is also status bit 0x2000 which gets added when the DCU configuration is different in front-end and frame builder. That is you can change and .ini file an then reload DAQ configuration with Epics button, which reconfigures the front-end, but leaves frame builders with invalid old configuration. They will detect this change and set the status to 0x2000 to indicate this condition. You will have to restart frame builders to pick up new .ini file and set status back to zero for the affected DCU.


DAQ controller only handles out of sync DCU condition and frame builders handle all three error conditions.

Weathered Stuff

Older communication protocol description is available here. It is not entirely correct for the current version of the protocol.

Data acquisition application (a client program) written in Java programming language is available for download. This allows a user to get any of the server's data channels written into a file(s) on the client's machine. Several data formats are supported, including tab separated values format, which can be imported into a spreadsheet or any other analysis or visualization program. JdClient can be used within Triana as a data input unit. Documentation is available online.

Matlab frame file import function is available. This one allows the import of one or several ADC channels from a file containing one or more frames. Requires the FrameL library to compile. Matlab binary MEX file for the Solaris 2 architecture is available for download.

-------
Last modified on 5 August 2004 by Alex