资源预览内容
第1页 / 共70页
第2页 / 共70页
第3页 / 共70页
第4页 / 共70页
第5页 / 共70页
第6页 / 共70页
第7页 / 共70页
第8页 / 共70页
第9页 / 共70页
第10页 / 共70页
亲,该文档总共70页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
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 Variables 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 Data Communication Define Communication Types Identify Scope of CommunicationInter-processInter-target Next Stepsni.com/largeapps5Demonstration 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 each 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 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 latency 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: monitoring 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 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 SetpointFundamental 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-CountConfigurationN 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-process 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 asynchronouslyACQLOGHighLowMed16Inter-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 critical 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 result 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 Global 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 handle 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
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号