Synchronization

Multiple TRION (DEWE2, DEWE3) enclosures can be synchronized using various synchronization methods. Supported methods are:

  • TRION-SYNC-BUS

  • PTP IEEE1588

  • GPS

  • IRIG A/B

TRION-SYNC-BUS is part of all enclosures. All other options need dedicated enclosures or TRION-TIMING boards in the enclosures first slot.

TRION-SYNC-BUS

Using TRION-SYNC-BUS needs special setup for two different enclosure roles. There has to be one MASTER instrument and one or more SLAVE instruments.

Cabling

Connect the SYNC cable to the sync-out plug at the master instrument to the sync-in plug of the first slave instrument. For further slave instruments follow the pattern and connect the slave’s sync-out plug to the next slaves’ sync-in plug.

Master instrument

The board setup is the same when multiple TRION boards are used. The first board has to be set to Master mode, all others to Slave:

Master board setup “BoardID0”:

DeWeSetParamStruct_str("BoardID0/AcqProp", "OperationMode", "Master");
DeWeSetParamStruct_str("BoardID0/AcqProp", "ExtTrigger", "False");
DeWeSetParamStruct_str("BoardID0/AcqProp", "ExtClk", "False");

Slave board setup “BoardIDX” [for X from 1 to NrOfAvailableBoards]:

DeWeSetParamStruct_str("BoardIDX/AcqProp", "OperationMode", "Slave");
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtTrigger", "PosEdge");
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtClk", "False");

SYNC-OUT has to be configured:

  • Set the trigger line TRIG7, Source to low

  • Set the trigger line TRIG7, Inverted to false

These are the appropriate TRION-API commands:

DeWeSetParamStruct_str("BoardID0/Trig7", "Source", "Low");
DeWeSetParamStruct_str("BoardID0/Trig7", "Inverted", "False");
// Then apply the settings using:
DeWeSetParam_i32(0, CMD_UPDATE_PARAM_ALL, 0);

Slave instrument

On slave devices using TRION-SYNC-BUS has to be configured too. All boards have to be configured to slave mode.

Slave board setup “BoardIDX” [for X from 0 to NrOfAvailableBoards]

DeWeSetParamStruct_str("BoardIDX/AcqProp", "OperationMode", "Slave");
// Usually "PosEdge"
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtTrigger", "PosEdge");
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtClk", "False");

SYNC-OUT has to be configured:

  • Set the trigger line TRIG7, Source to high

  • Set the trigger line TRIG7, Inverted to false

These are the appropriate TRION-API commands:

DeWeSetParamStruct_str("BoardID0/Trig7", "Source", "High");
DeWeSetParamStruct_str("BoardID0/Trig7", "Inverted", "False");
// Then apply the settings using:
DeWeSetParam_i32(0, CMD_UPDATE_PARAM_ALL, 0);

Acquisition on the Master instrument

Acquisition on the master instrument has to be started using:

For each (slave) board of the instrument start:

for (int BoardID = 1; BoardID < NrOfAvailableBoards; ++BoardID)
{
    DeWeSetParam_i32(BoardID, CMD_START_ACQUISITION, 0);
}
// Then start acquisition on the master board
DeWeSetParam_i32(0, CMD_START_ACQUISITION, 0);

Please keep in mind:

  • Acquisition on slave instruments has to be started before starting acquisition on the master instrument.

  • Acquisition on the slave boards has to be started before starting acquisition on the master board.

Acquisition on the Slave instrument

Acquisition on the slave instruments has to be started using:

For each board of the instrument start:

for (int BoardID = 0; BoardID < NrOfAvailableBoards; ++BoardID)
{
    DeWeSetParam_i32(BoardID, CMD_START_ACQUISITION, 0);
}

Sync cabling check

It is possible to check if the sync cables are plugged in correctly.

On each slave instrument use the following commands:

int state = 0;
DeWeGetParam_i32(0, CMD_PXI_LINE_STATE, &state);
if ((state & PXI_LINE_STATE_TRIG6) == 0)
{
    // no TRION-SYNC-BUS plugged in on slave instrument
}

PPS based syncronization methodes

PTP, GPS and IRIG are synchronization methodes, where the actual synchronziation between the instruments or 3rd party instruments is achieved by the PPS signal.

After issuing a start-acquisition command the first subsequent PPS will be used as an internal synchronization signal, and the actual acquisition will start one second after this.

This “one second later” is realized by setting the property “StartCounter” to a value equeal to the “SampleRate” of the TRION-board used as sync-board.

//Startcounter has to be set equal to Samplerate (eg 2000)
DeWeSetParamStruct_str("BoardID0/AcqProp", "StartCounter", "2000");

All PPS based modes share a couple of characteristics, which will show as a repeted pattern in in the subsequent chapters:

An explicit command is used to force the TRION-board to synchronize itself to the external source.

DeWeSetParam_i32(0, CMD_TIMING_STATE, 0);

Before performing an acquisition start the application has to check, whether the instrument managed to synchronize itself to the external timesource.

int timing_state;
DeWeSetParam_i32(0, CMD_TIMING_STATE, &timing_state);

Starting the acquisition needs to be delayed until timing_state has the value TIMINGSTATE_LOCKED. If any value other than TIMINGSTATE_LOCKED or TIMINGSTATE_NOTRESYNCED is read for multiple times the application should issue another sync-command.

The acquisition start will be on a full second.

PTP IEEE1588

Currently TRION-systems can only operate as PTP slaves.

Cabling

Connect a PTP Master to the PTP-plug on your TRION-system. This can either be on the enclosure, or if the enclosure does not provide a PTP plug on a TRION-TIMING-family board in the first slot of the enclosure.

Slave instrument

The TRION board used for the PTP slave role needs at least one synchronous channel activated. From perspective of the instrument the PTP slave board is considere being a Master board.

PTP slave board setup (instrument master):

DeWeSetParamStruct_str("BoardID0/AcqProp/SyncSettings/SyncIn", "Mode", "PTP");
//Startcounter has to be set equal to Samplerate (eg 2000)
DeWeSetParamStruct_str("BoardID0/AcqProp", "StartCounter", "2000");
DeWeSetParam_i32(0, CMD_UPDATE_PARAM_ALL, 0);

Force synchronisation of TRION-board-internal time to provided PTP time:

DeWeSetParam_i32(0, CMD_TIMING_STATE, 0);

Slave board setup “BoardIDX” [for X from 1 to NrOfAvailableBoards]:

DeWeSetParamStruct_str("BoardIDX/AcqProp", "OperationMode", "Slave");
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtTrigger", "PosEdge");
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtClk", "False");

Preparing for Acquisition start

Before starting the acquisition it is necessary to see, if the TRION-board was already able to synchronize itself with the provided PTP time.

int timing_state;
DeWeSetParam_i32(0, CMD_TIMING_STATE, &timing_state);

When timing_state has the value TIMINGSTATE_LOCKED the system is synchronized to the PTP Master. This may take a couple of seconds.

Acquisition on the instrument

Acquisition on the instrument has to be started using:

For each (slave) board of the instrument start:

for (int BoardID = 1; BoardID < NrOfAvailableBoards; ++BoardID)
{
    DeWeSetParam_i32(BoardID, CMD_START_ACQUISITION, 0);
}
// Then start acquisition on the master board
DeWeSetParam_i32(0, CMD_START_ACQUISITION, 0);

Please keep in mind:

  • Acquisition on the slave boards has to be started before starting acquisition on the master board.

  • When using any PPS based synchronization-method like PTP to synchronize multiple instruments their respective start may be off by 1 second to each other. The application has to take care to detect this and compensate for it.

Property overview

This shows the set of typical properties for PTP-sync-in mode.

Table 5 PTP Property overview

Property Name

Description

CorrectionLimit

Maximum absolute difference between TRION internal generated PPS and the PPS derived from the inputsignal before a deviation will be indicated with a result-value of TIMINGSTATE_LOCKEDOOR or TIMINGSTATE_RELOCKOOR when querying CMD_TIMING_STATE

Protocol

Either ETH for Ethernet or UDP_V4 for IPV4 UDP

DelayMechanism

Either edge-to-edge or peer-to-peer

DefaultSettings

This XML node is no settable property and is used API internally. This element shall be ignored by applications

GPS

Cabling

Connect a GPS antenna to the GPS connector on your TRION-System.. This can either be on the enclosure, or if the enclosure does not provide a GPS connector on a TRION-TIMING-family board in the first slot of the enclosure.

Slave instrument

The TRION board used for the GPS sync-in role needs at least one synchronuos channel activated. From perspective of the instrument the GPS-synced board is considere being a Master board.

GPS board setup (instrument master):

DeWeSetParamStruct_str("BoardID0/AcqProp/SyncSettings/SyncIn", "Mode", "GPS");
DeWeSetParam_i32(0, CMD_UPDATE_PARAM_ALL, 0);

Force synchronisation of TRION-board-internal time to provided GPS time:

DeWeSetParam_i32(0, CMD_TIMING_STATE, 0);

Slave board setup “BoardIDX” [for X from 1 to NrOfAvailableBoards]:

DeWeSetParamStruct_str("BoardIDX/AcqProp", "OperationMode", "Slave");
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtTrigger", "PosEdge");
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtClk", "False");

Preparing for Acquisition start

Before starting the acquisition it is necessary to see, if the TRION-board was already able to synchronize itself with the provided GPS time.

int timing_state;
DeWeSetParam_i32(0, CMD_TIMING_STATE, &timing_state);

When timing_state has the value TIMINGSTATE_LOCKED the system is synchronized to the GPS time. This may take a couple of seconds.

Acquisition on the instrument

Acquisition on the instrument has to be started using:

For each (slave) board of the instrument start:

for (int BoardID = 1; BoardID < NrOfAvailableBoards; ++BoardID)
{
    DeWeSetParam_i32(BoardID, CMD_START_ACQUISITION, 0);
}
// Then start acquisition on the master board
DeWeSetParam_i32(0, CMD_START_ACQUISITION, 0);

Please keep in mind:

  • Acquisition on the slave boards has to be started before starting acquisition on the master board.

  • When using any PPS based synchronization-method like GPS to synchronize multiple instruments their respective start may be off by 1 second to each other. The application has to take care to detect this and compensate for it.

Property overview

This shows the set of typical properties for GPS-sync-in mode.

Table 6 GPS Property overview

Property Name

Description

CorrectionLimit

Maximum absolute difference between TRION internal generated PPS and the PPS derived from the inputsignal before a deviation will be indicated with a result-value of TIMINGSTATE_LOCKEDOOR or TIMINGSTATE_RELOCKOOR when querying CMD_TIMING_STATE

CableLengthCompensation

This property can be used to compensate for signal propagation times on long cables between the GPS. antenna and the TRION system. For reasonable short cables this value can be left at 0ms.

PropCoeff

This is an internally used parameter of the pi- controller and should be left alone by applications.

IntCoeff

This is an internally used parameter of the pi- controller and should be left alone by applications.

ControlValue

This is an internally used parameter of the pi- controller and should be left alone by applications.

DefaultSettings

This XML node is no settable property and is used API internally. This element shall be ignored by applications

IRIG

Cabling

Connect an IRIG-Signal to the IRIG-connector (typically BNC) on the TRION-system. This can either be on the enclosure, or if the enclosure does not provide an IRIG connector on a TRION-TIMING-family board in the first slot of the enclosure.

Slave instrument

The TRION board used for the IRIG sync-in role needs at least one synchronuos channel activated. From perspective of the instrument the IRIG-synced board is considere being a Master board.

IRIG board setup (instrument master):

//Set mode
DeWeSetParamStruct_str("BoardID0/AcqProp/SyncSettings/SyncIn", "Mode", "IRIG");
//Select the format
DeWeSetParamStruct_str("BoardID0/AcqProp/SyncSettings/SyncIn", "IRIGFormat", "IRIG_B_DC");
DeWeSetParam_i32(0, CMD_UPDATE_PARAM_ALL, 0);

Force synchronisation of TRION-board-internal time to provided IRIG time:

DeWeSetParam_i32(0, CMD_TIMING_STATE, 0);

Slave board setup “BoardIDX” [for X from 1 to NrOfAvailableBoards]:

DeWeSetParamStruct_str("BoardIDX/AcqProp", "OperationMode", "Slave");
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtTrigger", "PosEdge");
DeWeSetParamStruct_str("BoardIDX/AcqProp", "ExtClk", "False");

Preparing for Acquisition start

Before starting the acquisition it is necessary to see, if the TRION-board was already able to synchronize itself with the provided IRIG time.

int timing_state;
DeWeSetParam_i32(0, CMD_TIMING_STATE, &timing_state);

When timing_state has the value TIMINGSTATE_LOCKED the system is synchronized to the IRIG source. This may take a couple of seconds.

Acquisition on the instrument

Acquisition on the instrument has to be started using:

For each (slave) board of the instrument start:

for (int BoardID = 1; BoardID < NrOfAvailableBoards; ++BoardID)
{
    DeWeSetParam_i32(BoardID, CMD_START_ACQUISITION, 0);
}
// Then start acquisition on the master board
DeWeSetParam_i32(0, CMD_START_ACQUISITION, 0);

Please keep in mind:

  • Acquisition on the slave boards has to be started before starting acquisition on the master board.

  • When using any PPS based synchronization-method like IRIG to synchronize multiple instruments their respective start may be off by 1 second to each other. The application has to take care to detect this and compensate for it.

Property overview

This shows the set of typical properties for IRIG-sync-in mode.

Table 7 IRIG Property overview

Property Name

Description

IRIGFormat

This is a composite of the IRIG code and the used modulation. eg IRIG_B_DC, IRIG_A_AC

CorrectionLimit

Maximum absolute difference between TRION internal generated PPS and the PPS derived from the inputsignal before a deviation will be indicated with a result-value of TIMINGSTATE_LOCKEDOOR or TIMINGSTATE_RELOCKOOR when querying CMD_TIMING_STATE

CableLengthCompensation

This property can be used to compensate for signal propagation times on long cables between the GPS. antenna and the TRION system. For reasonable short cables this value can be left at 0ms.

PropCoeff

This is an internally used parameter of the pi- controller and should be left alone by applications.

IntCoeff

This is an internally used parameter of the pi- controller and should be left alone by applications.

ControlValue

This is an internally used parameter of the pi- controller and should be left alone by applications.

DefaultSettings

This XML node is no settable property and is used API internally. This element shall be ignored by applications

Exmple

PTP, GPS and IRIG are similar to setup.

The follwing exmample covers the basic setup and acquisition start sequence.

Listing 11 PTP slave setup example
 1#include "dewepxi_load.h"
 2#include "dewepxi_apicore.h"
 3#include "dewepxi_apiutil.h"
 4
 5
 6int main(int argc, char* argv[])
 7{
 8    int boards = 0;
 9    int avail_samples = 0;
10
11    // Step 1 : Basic SDK Initialization
12    DeWePxiLoad();
13
14    // boards is negative for simulation
15    DeWeDriverInit(&boards);
16
17    // Step 2: Open boards
18    // 0: chassis controller
19    // 1: TRION3-1850-MULTI
20    DeWeSetParam_i32(0, CMD_OPEN_BOARD, 0);
21    DeWeSetParam_i32(0, CMD_RESET_BOARD, 0);
22    DeWeSetParam_i32(1, CMD_OPEN_BOARD, 0);
23    DeWeSetParam_i32(1, CMD_RESET_BOARD, 0);
24
25    // Step 3: Enable board-counter channel on board 0
26    DeWeSetParamStruct_str("BoardID0/BoardCnt0", "Used", "True");
27
28    // Step 4: Configure acquisition properties
29    DeWeSetParam_i32(1, CMD_BUFFER_0_BLOCK_SIZE, 200);
30    DeWeSetParam_i32(1, CMD_BUFFER_0_BLOCK_COUNT, 50);
31    DeWeSetParamStruct_str("BoardID0/AcqProp", "SampleRate", "2000");
32
33    // Step 5: Configure sync-in propoerties
34    DeWeSetParamStruct_str("BoardID0/AcqProp/SyncSettings/SyncIn", "Mode", "PTP");
35    //Startcounter has to be set equal to Samplerate (eg 2000)
36    DeWeSetParamStruct_str("BoardID0/AcqProp", "StartCounter", "2000");
37
38    // Step 6: Apply settings
39    DeWeSetParam_i32(0, CMD_UPDATE_PARAM_ALL, 0);
40
41    // Step 7: Issue resync
42    DeWeSetParam_i32(0, CMD_TIMING_STATE, 0);
43
44    // Step 8: Wait until the board indicates a good sync-state
45    {
46        sint32 timing_state;
47        // Break with success or CTRL+C only
48        do
49        {
50            Sleep(100);
51            DeWeGetParam_i32(0, CMD_TIMING_STATE, &timing_state);
52        } while (timing_state != TIMINGSTATE_LOCKED);
53    }
54
55    // Step 9: Start acquisition
56    DeWeSetParam_i32(0, CMD_START_ACQUISITION, 0);
57
58    // This example is only shows howto get the number of samples available
59    // and howto free them:
60
61    // sleep for a short period, then:
62    DeWeGetParam_i32(0, CMD_BUFFER_0_AVAIL_NO_SAMPLE, &avail_samples);
63    DeWeSetParam_i32(0, CMD_BUFFER_0_FREE_NO_SAMPLE, avail_samples);
64
65    // Step 10: Stop acquisition
66    DeWeSetParam_i32(0, CMD_STOP_ACQUISITION, 0);
67
68    // Step 11: Free boards and unload SDK
69    DeWeSetParam_i32(0, CMD_CLOSE_BOARD, 0);
70    DeWeSetParam_i32(1, CMD_CLOSE_BOARD, 0);
71    DeWeDriverDeInit();
72    DeWePxiUnload();
73    return 0;
74}