RDK – TpcAccess

API for own software development

The Rappid Development Kid (RDK) TpcAccess provides developers of measurement software a simple solution to connect the TraNET devices as well as integrate the TPCE measurement cards into their own application.

The client/server architecture allows the application to run on the same device as the installed DAQ boards (TraNET EPC and PPC) or on a computer connected via Ethernet. It is also possible for multiple applications to access the hardware simultaneously.

For applications in C++ the TpcAccess Library is available under Windows or Linux. For Windows applications in C#, the TpcAccess Library is also available as a C# variant.

For applications in Python a corresponding wrapper of the C++ DLL is provided.

 

TpcAccess Software Architecture

Downloads

PDF Download

TpcAccess API

Documentation

PDF Download

TpcAccess API

RDK Download

Clone API from GitHub github.com/elsysdaq/tpcaccess

Code Example C++

Connect to a Device

int deviceIx;
TPC_ErrorCode err;

// Connecting to one device:
TPC_BeginSystemDefinition();
deviceIx = TPC_AddDevice("192.168.0.107:10010");	// Replace the IP address with your device address
err = TPC_EndSystemDefinition(1000); 		// 1s timeout till connection failed
if(err != tpc_noError) 	return 1;

// Set default parameters
TPC_ResetConfiguration();

Set Parameters

// Set recording mode to scope
TPC_SetParameter(deviceIx, 0, 0, tpc_parOperationMode, tpc_opModeScope);

// Set single shot and turn on auto trigger
TPC_SetParameter(deviceIx, 0, 0, tpc_parScopeAutoTrigger, 1);
TPC_SetParameter(deviceIx, 0, 0, tpc_parScopeSingleShot, 1);

// Set Sampling frequency to 10MHz
TPC_SetParameter(deviceIx, 0, 0, tpc_parSamplingFrequency,10000000);

// Set trigger delay to -50%
TPC_SetParameter(deviceIx, 0, 0, tpc_parScopeTriggerDelay, -50);

// Set Block Size to 16k Samples
TPC_SetParameter(deviceIx, 0, 0, tpc_parScopeBlockLength, 4096);

// Set Board 0, Channel 0, Input Range to 5V, 0% Offset
TPC_SetParameter(deviceIx, 0, 0, tpc_parRange, 5);
TPC_SetParameter(deviceIx, 0, 0, tpc_parOffset, 0);

// Set Trigger Board 0, Channel 0, Positive Slope at 1V, 0.1V hysteris
TPC_SetTrigger(deviceIx,0,0,tpc_etrgSlope,tpc_etrgCompPositive,tpc_etrgNone, 1,0.1);	

Start the Measurement

int measurementNumber = 0;
TPC_MakeMeasurement(2000,&measurementNumber); 	

// readout time meta data
TPC_TMetaData tmetaData;
TPC_GetTMetaData(deviceIx, 0, 0, m_iMeasurementNumber, &tmetaData, sizeof(TPC_TMetaData));
cout << endl << "Meas. Start Time: " << tmetaData.startTime.hour   << ":" 
				<< tmetaData.startTime.minute << ":"
				<< tmetaData.startTime.second << endl;
cout << "Trigger Sample: " << tmetaData.triggerSample << endl;
cout << "Trigger Time:   " << tmetaData.triggerTime   << endl;

// read out y meta data
TPC_YMetaData ymetaData;
TPC_GetYMetaData(deviceIx, 0, 0, m_iMeasurementNumber, &ymetaData, sizeof(TPC_YMetaData));
uint32_t analogMask		= ymetaData.analogMask;
uint32_t markerMask		= ymetaData.markerMask;
double bintoVoltFactor		= ymetaData.binToVoltFactor;
double bintoVoltConstant	= ymetaData.binToVoltConstant;

Data Read-out

// get raw data
int32_t *rawData, *analogData, *markerData;
rawData	   = new int32_t[4096];
analogData = new int32_t[4096];
markerData = new int32_t[4096];
TPC_GetRawData(deviceIx, 0, 0, 0, m_iMeasurementNumber, 0, 4096, rawData);

double* voltageData;
voltageData = new double[4096];
// get analog an marker data
for(int i = 0; i < 4096; i++){
 analogData[i] = rawData[i] & analogMask; // Mask digital marker data from the analog data
 markerData[i] = rawData[i] & markerMask; // Extract the digital marker signals
		
 // scale to voltage (this gives the same data as the TPC_GetData function)
 voltageData[i] = (analogData[i]* bintoVoltFactor) + bintoVoltConstant;
 cout << voltageData[i] << endl;
}