Installing and Launching the Application
- Place the app file (HBKLANXIDAQ.mlapp) and all function files (.m extension) in the same directory
- Create the following sub-directories (names must match these exactly, including case, for code to work)
- Generator Input Files
- Generator Setup Table Files
- Input Channel Setup Table Files
- Measurement Files
- In MATLAB navigate to the directory that contains the app file
- In the command window type ‘HBKLANXIDAQ’ and then hit enter
Running the Application
Module IP Setup Tab
- Type in a numeric value for Number of Modules
- Select Switch or Frame for Hardware if Number of Modules > 1
- Enter IP addresses for each module in the setup, noting that the app forces the command module to be Module Number 1 the same as a B&K Frame would
- Click Connect, all selections will be grayed out while the connection sequence executes
DAQ Setup Tab
- Select a Frequency Range from the drop-down menu
- Edit the properties of each channel as needed or load a previously saved input channel setup by clicking ‘Load Input Channel Setup Table’
- Save input channel setup by clicking ‘Save Input Channel Setup Table’
- Run TEDS detect as needed
- TEDS detect occurs automatically during connection sequence and it is only necessary to rerun it if you change, add, or remove transducers after the connection sequence
- Note that running TEDS detect will over-write manually entered data for TEDS transducers
Generator Setup Tab
- Edit the properties of each generator channel as needed or load a previously saved generator channel setup by clicking ‘Load Generator Setup Table’
- In the ‘Specify File Path for Inputs’ field
- Enter the full file path to the generator waveform .mat file, e.g. ‘C:\HBK LAN-XI Open API\MATLAB Simple Recorder GUI\Generator Input Files\SineWave100Hz.mat’
- Alternatively, click on ‘Load Generator Input Files’ and select a folder that contains generator waveform .mat files to create a drop-down menu of file options in the ‘Specify File Path for Inputs’ field
- In the ‘Specify File Path for Inputs’ field
- Save generator channel setup by clicking ‘Save Generator Setup Table’
Collecting Data
- When setup is complete return to DAQ Setup tab and click ‘Arm DAQ’
- Click ‘Save Directory’ to choose a folder to save measurement files in
- Enter a recording name
- No extension, the app will save in .mat format automatically
- All MATLAB standard file naming rules apply, e.g. no spaces in filename
- Click ‘Start DAQ’ when ready
- Click Stop DAQ when you wish to end data collection
- At this point you are free to make further recordings by specifying new filenames and/or directories
Disarming, Disconnecting, and Rebooting
- To disarm the system click the ‘Disarm DAQ’ button. Note that you must disarm the system to change the sample rate and/or modify the input or generator channel properties.
- To disconnect the system go to the Module IP Setup tab and click ‘Disconnect’. Note that disconnecting will reboot all modules in the setup.
- Closing the app at any point will result in all modules being rebooted. Allow adequate time for module to display an IP address on the green information panel before attempting to reconnect to module.
Formatting Generator Waveform .mat Files
- In MATLAB create a cell named ‘Inputs1and2’ using the following command: >>Inputs1and2 = {};
- Within the cell create two 1x1 structs:
- Inputs1and2{1,1} contains the properties for Input 1 of the mixer
- Inputs1and2{2,1} contains the properties for Input 2 of the mixer
- The result of mixing the two structs, or the cell Inputs1and2, is the waveform for the output channel
- Refer to the LAN-XI Open API User Guide for available waveforms and their associated properties and please note that these properties will be different depending on the type of waveform generated
- Check the formatting of waveforms using the MATLAB function ‘jsonencode’ to convert the Inputs1and2 cell to a jsonstring: >>jsonencode(Inputs1and2)
- Several simple waveforms are included with the code as examples
REST Command Chronology
Connecting Sequence (Idle → Connected)
- Read module information using GET command - /rest/rec/module/info
- Set module time using PUT command - /rest/rec/module/time
- Send to command module first then service modules
- Set synchronization mode using PUT command - /rest/rec/syncmode
- Send to command module first then service modules
- Wait for ptpStatus of “Locked” using GET command - /rest/rec/onchange
- Open recorder application using PUT command - /rest/rec/open
- Send to service modules first then command module
- Wait for moduleState to be “RecorderOpened” using GET command - /rest/rec/onchange
- Prepare signal generators using PUT command - /rest/rec/generator/prepare
- Send to service modules first then command module
- Get default set-up for all input channels using GET command - /rest/rec/channels/input/default
- Get default set-up for all signal generators using GET command - /rest/rec/generator/output
TEDS Detection (module must be in ‘Connected’ state)
- Run TEDS detection using POST command - /rest/rec/channels/input/all/transducers/detect
- Send to service modules first then command module
- Wait for transducerDetectionActive to be “false” using GET command - /rest/rec/onchange
- Obtain transducer information using GET command - /rest/rec/channels/input/all/transducers
- Send to service modules first then command module
Arming Sequence (Connected → Armed)
- Configure generator using PUT command - /rest/rec/generator/output
- Send to service modules first then command module
- Start generator using PUT command - /rest/rec/generator/start
- Send to service modules first then command module
- Synchronize generators using PUT command (this step required only for multi-module systems) - /rest/rec/apply
- Send only to command module
- Create new configuration using PUT command - rest/rec/create
- Send to service modules first then command module
- Wait for moduleState to be “RecorderConfiguring” using GET command - /rest/rec/onchange
- Apply desired input channel configuration to module using PUT command - rest/rec/channels/input
- Wait for inputStatus to be “Settled” using GET command (this step required only for multi-module systems) - /rest/rec/onchange
- Synchronize modules using PUT command (this step required only for multi-module systems) - /rest/rec/synchronize
- Send to service modules first then command module
- Wait for inputStatus to be “Synchronized” using GET command - /rest/rec/onchange
- Start internal streaming (multi-module systems only) using PUT command – rest/rec/startstreaming
- Send to service modules first then command module
- Get streaming socket using GET command - /rest/rec/destination/socket
Measuring (Armed → Recording)
- Start streaming using POST command - /rest/rec/measurements
- Send to service modules first then command module
- Wait for moduleState to be “RecorderRecording” using GET command - /rest/rec/onchange
- Subscribe to binary data stream then run while loop and decode messages until data collection is finished → LAN-XI TCP/IP streaming sequence is as follows
- Message format is header then payload
- Header contains
- Message type
- Time
- Length of message content
- Message data
- Depending on the value received for message type in the header the message is either an interpretation message or a signal data message
- Interpretation messages contain a scale factor to apply to signal data, each channel has its own separate interpretation message
- Signal data messages contain signal data that needs to be scaled
- Example chronology of messages received for DAQ using three channels
- Interpretation message Channel 1
- Interpretation message Channel 2
- Interpretation message Channel 3
- Signal data message Channel 1
- Signal data message Channel 2
- Signal data message Channel 3
- Signal data message Channel 1
- Signal data message Channel 2
- Signal data message Channel 3
- and so on...
Stop Measuring (Recording → Armed)
- Stop streaming using PUT command - /rest/rec/measurements/stop
- Wait for moduleState to be “RecorderStreaming” using GET command - /rest/rec/onchange
Disarming Sequence (Armed → Connected)
- Stop generator using PUT command - rest/rec/generator/stop
- End current recording session using PUT command - rest/rec/finish
- Wait for moduleState to be “RecorderOpened” using GET command - /rest/rec/onchange
Disconnecting Sequence (Connected → Idle)
- Close recorder application using PUT command - /rest/rec/close
- Send to service modules first then command module
- Wait for moduleState to be “Idle” using GET command - /rest/rec/onchange
- Set synchronization mode back to defaults using PUT command - /rest/rec/syncmode
- Send to service modules first then command module
Rebooting
- Reboot module using PUT command - rest/rec/reboot
- Send to service modules first then command module