Developing an
Embedded Data-Logging
Reference Architecture
for CompactRIO
TS 1721 – NIWeek 2007
Christian Loew
NI Systems Engineering
Agenda
• Data Logging Overview
• Reference Architecture/Designs
• Reference Architecture for Data Logging on
cRIO
National Instruments Confidential 2
NI Data L ogging Options
• NI LabVIEW SignalExpress
• CompactDAQ
• Compact FieldPoint
Pre-installed datalogging application
• CompactRIO
National Instruments Confidential 3
Compact FieldPoint Embedded Data Logger
• Stand-alone, easy to use, data logger example
• Configurable with any cFP module
• Startup executable
• Remote front panel
• Live data graphs
• FTP saved log files
National Instruments Confidential 4
Reference Architecture/Design
Reference design refers to a technical blueprint of
a system that is intended for others to copy. It
contains the essential elements of the system;
however, third parties may enhance or modify
the design as required.
Source: Wikipedia
National Instruments Confidential 5
Reference Architecture
• Template for application development
• Targeted at systems integrators and
experienced developers
• LabVIEW competence required
• Based on standard LV features and tools and
additional SW components
• Customized for specific applications
National Instruments Confidential 6
A Reference Architecture is not …
• a turn-key application.
• an application wizard to configure an application
LabVIEW experience, as well as application
design and development experience are
required to successfully use a reference
application.
National Instruments Confidential 7
cRIO Embedded Datalogger Overview
• Stream data from cRIO input modules to local
non-volatile memory
• Standalone design
Datalogger runs deployed without a host
• Datalogger is configured from a host system
Configuration is stored on the datalogger
• Host will retrieve data files from cRIO over
Ethernet
National Instruments Confidential 8
Possible Features
Acquisition
• Support different AI and DI modules
Specific sensors: TC, bridges, strain, current, DSA, etc.
• Support GPS module for location data
• Support CAN module
• Time stamping support
• Multi-rate scanning
• Configurable scan rate(s)
• Triggering
Continuous
Fixed sample size, retriggerable
External trigger
Analog trigger
Data Storage
• TDM/TDMS/binary data file format?
• USB memory support
• DIAdem compatible
National Instruments Confidential 9
Possible Features (cont.)
Control/Configuration
• Configurable channel list/scanrate(s) based on hardware configuration
• Allow for different cRIO module configurations
RT code can detect cRIO module configuration and select FPGA VI accordingly
• Interactive acquisition mode
Stream data directly to host to check and verify I/O and sensors
No Logging
• Support for multiple hardware configurations
Autodetect
• Flexible to handle new configurations
Limited changes needed for new configurations
Data Retrieval
• API to read back file
Read file back using FTP
National Instruments Confidential 10
cRIO Datalogger Architecture
Host
Configure
Control View Status
Channels
RT FPGA
Host Interface Acquisition
Monitor Data I/O
Process Stream to To Host Scaling/ Collector/
Commands Host DMA I/O
Stream Cal Pre-
To Disk processor I/O
Config Log
File Files
Flash Memory
National Instruments Confidential 11
Design Patterns
• Code designs used over and over again to
implement common functionality in a range of
application
• “Every time I need to … I use this code.”
National Instruments Confidential 12
Acquisition and Logging Data
• Configure HW channels to acquire and log
Retrieve calibration data
Acquire input data and stream to the RT host
Select channels and log to file
Design Patterns
• Separate FPGA VI to load calibration constants
Provide HW configuration to automate RT data
parsing
National Instruments Confidential 13
LV FPGA Calibration Constants
National Instruments Confidential 14
Acquisition and Logging Data
Design Patterns
• Separate FPGA VI to load calibration constants
Provide HW configuration to automate RT data
parsing
• Data streaming from I/O to RT using DMA
Acquisition timing
Start and stop conditions
Parse channels based on configuration
National Instruments Confidential 15
Acquire and stream data to RT
National Instruments Confidential 16
Acquisition and Logging Data
Design Pattern
• Use channel list to select channels to be logged
Simple slot and channel address scheme
Configuration file
• Parse input data based on module configuration
and selected channels
National Instruments Confidential 17
Configured acquisition and parsing
National Instruments Confidential 18
RT Datalogger - Standalone
• Datalogging SW runs autonomously when
system is turned on
• Can be controlled and configured from host
when connected
Add Start, Stop, Configure and Logging to basic
DAQ code
National Instruments Confidential 19
RT Datalogger - Standalone
National Instruments Confidential 20
Datalogger Modes/States
HW Initialization Start Start
Load SW
Configuration Standby
Run
Reset
Stop Stop
Shutdown
Shutdown
National Instruments Confidential 21
RT Datalogger - Standalone
• Datalogging SW runs autonomously when
system is turned on
• Can be controlled and configured from host
when connected
Add Start, Stop, Configure and Logging to basic
DAQ code
Design Pattern
State Machine
National Instruments Confidential 22
Datalogger State Machine
National Instruments Confidential 23
Host-Datalogger Communication
• Connect to the datalogger from a host application
• Send commands: Start, Stop, Reset
• Retrieve HW configuration
• Download configuration file
• Retrieve status
• Retrieve data files
Design Pattern
• Command-Based Communication
National Instruments Confidential 24
Command-Based Communication
Available in the Simple TCP Messaging (STM) component on Developer Zone
National Instruments Confidential 25
Host Application
• Display datalogger status
• Interactive control
• Configuration of channels based on available HW
Download new configuration file
• Retrieve and display data files
Design Pattern
• Event-driven user interface
• FTP communication with datalogger
National Instruments Confidential 26
Event-Driven User Interface
National Instruments Confidential 27
cRIO Datalogger Architecture
Host
Configure
Channels
Event-Driven
Control UIView Status/
Live Data
Command-BasedRT FPGA
Host Interface Acquisition
Communication
Monitor Data I/O
Process Stream to
State
To Host Machine
Scaling/ Collector/
Cal cRIO Input Streaming
Commands Host DMA I/O
Stream Pre-
To Disk processor I/O
Config Log
File Files
Flash Memory
National Instruments Confidential 28
Design Patterns used in the Datalogger
• FPGA streaming data input
• State Machine
DevZone articles
• Command-based communication
DevZone: Simple TCP Messaging (STM) Protocol
• Event-driven host UI
cRIO Embedded Datalogger >> community.ni.com
National Instruments Confidential 29
Think
Reference Designs
and
Design Patterns
National Instruments Confidential 30