《Data Communication in LabVIEW》由会员分享,可在线阅读,更多相关《Data Communication in LabVIEW(70页珍藏版)》请在金锄头文库上搜索。
1、An Overview of Data Communication in LabVIEWElijah Kerry LabVIEW Product Manager Certified LabVIEW Architect (CLA)2Data Communication Options in LabVIEW1.TCP and UDP 2.Network Streams 3.Shared Variables 4.DMAs 5.Web Services 6.Peer-to-Peer Streaming 7.Queues 8.Dynamic Events 9.Functional Global Vari
2、ables 10. RT FIFOs 11. Datasocket12. Local Variables 13. Programmatic Front Panel Interface 14. Target-scoped FIFOs 15. Notifier 16. Simple TCP/IP Messaging (STM) 17. AMC 18. HTTP 19. FTP 20. Global variables just to name a few 3WindowsReal-TimeFPGACommunication is Important4Agenda Introduction of D
3、ata Communication Define Communication Types Identify Scope of CommunicationInter-processInter-target Next S The pitfalls of local variables6Common Pitfalls of Data CommunicationRace conditions- two requests made to the same shared resourceDeadlock- two or more depended processes are waiting for eac
4、h other to release the same resourceData loss- gaps or discontinuities when transferring dataPerformance degradation- poor processing speed due to dependencies on shared resourcesBuffer overflows- writing to a buffer faster than it is read from the bufferStale data- reading the same data point more
5、than once7The Dining Philosophers8Communication Types Message/Command“Get me a soda!” Update/Monitor“The current time is” Stream/Buffer“the day the music died” Variable/Tag“Set Point = 72F”9Message/Command Commander (Host) and Worker (Target) Systems Must be lossless* (can be buffered) Minimal laten
6、cy Typically processed one at a time Reads are destructive Example: stop button, alarm, error*some commands may need to pre-empt other commands based on priority10Update/Monitor Periodic transfer of latest value Often used for HMIs or GUIs N Targets: 1 Host Can be lossy Non-bufferedExample: monitori
7、ng current engine temperature11Stream/Buffer Continuous transfer, but not deterministic High throughput No data loss, buffered 1 Target: 1 Host; UnidirectionalExample: High speed acquisition on target, sent to host PC for data logging12Variable/Tag Set Points and PID Constants Initial configuration
8、data Can be updated during run-time Only latest value is of interest 1 Host: N TargetsExample: reading/writing the set-point of a thermostat, .ini configuration files13Choosing Transfer TypesMessageUpdateStreamVariable (Tag) Examples Exec Action Error Heartbeat Movie Waveform Image SetpointFundament
9、al Features Buffering Blocking (Timeout) Single-Read Nonhistorical Blocking (Timeout) Buffering Blocking (Timeout) NonhistoricalOptional Features Ack Broadcast Multi-layer Buffering Dynamic Lookup Group Mgmt LatchingPerformance Low-Latency Low-Latency High- Throughput Low-Latency High-CountConfigura
10、tionN Targets: 1 HostN Targets:1 Host1 Target:1 Host UnidirectionalN Targets: 1 Host14Scope of CommunicationInter-process: the exchange of data takes place within a single application contextInter-target: communication between multiple physical targets, often over a network layer15Defining Inter-pro
11、cess Communication Communication on same PC or Target Communicate between parallel processes or loops Offload data logging or processing to another CPU/Core/Thread within same VI/executable Loops can vary in processing priority Used to communicate synchronously and asynchronouslyACQLOGHighLowMed16In
12、ter-process Communication OptionsShared Variables Update GUI loop with latest valueQueues Stream continuous data between loops on a non-deterministic targetDynamic Events Register Dynamic Events to execute sections of codeFunctional Global Variables (FGV) Use a non-reentrant subVI to protect critica
13、l dataRT FIFOs Stream continuous data between time critical loops on a single RT target 17Basic Actions Set the value of the shift registerINITIALIZEINITIALIZE18Basic Actions Get the value currently stored in the shift registerGETGET19Action Engine Perform an operation upon stored value and save res
14、ult You can also output the new valueACTIONACTION20How It Works1.Functional Global Variable is a Non-Reentrant SubVI 2.Actions can be performed upon data 3.Enumerator selects action 4.Stores result in uninitialized shift register 5.Loop only executes once21Demonstration Introduction to Functional Gl
15、obal Variables22Benefits: ComparisonGlobal and Local Variables Can cause race conditions Create copies of data in memory Cannot perform actions on data Cannot handle error wires Drag and dropFunctional Global Variables Prevent race conditions No copies of data Can behave like action engines Can hand
16、le error wires Take time to make23Understanding Data Dependency Code in a VI is organized into diagrams Diagrams are executed in order based on data dependency Objects within the diagrams are executed in order based on data dependency Data dependency is dictated by the flow of wires24Understanding Dataflow