Presentation is loading. Please wait.

Presentation is loading. Please wait.

User Events in LabVIEW RT

Similar presentations

Presentation on theme: "User Events in LabVIEW RT"— Presentation transcript:

1 User Events in LabVIEW RT
Colorado ALARM User Group 17 November 2011 STEVE SOLGA | ELECTROMECHA LLC

2 Event Structure under LabVIEW RT
RT TARGETS ONLY SUPPORT USER EVENTS Event structures on RT targets do not support events associated with user interface objects, such as VI panels or controls (i.e. no Value Change or Mouse Down type events) The options for associating the Value Change event with a control still exist in LabVIEW RT but they have no effect

3 Inter-Process Communication Mechanism
AN ALTERNATIVE RT COMMUNICATION MECHANISM User Events in LabVIEW RT are another way to communication between parallel processes More common communication mechanisms include Queues, RT-FIFO’s, and Shared Variables RT SOFTWARE STANDARD METHODS ALTERNATIVE METHOD

4 Moving from Windows UE’s to RT UE’s
MULTIPLE TASK (MULTIPLE CONTROL LOOP) COMMUNICATION METHOD In many applications, the RT controller runs multiple control processes that need to communicate with each other This presentation demonstrates a general state machine architecture which uses a Cluster of State Command Enum and Variant for the State Queue, User Event [UE], and Notifier data types WINDOWS CODE QUICKLY PORTS TO RT Code transfers nicely from Windows to LabVIEW RT when control Value Change Events are converted to User Events. Each User Event can then have a dedicated State to handle required logic GOOD FOR QUICK PROTOTYPING Using Networked Shared Variables (NSV) to communicate between the Host PC and the RT simplifies basic communication and utilizes existing communication methods (User Events) already existing in software architecture Host modules (Touch Panels, Tables, Windows PC Hosts) can fire User Events on the RT in a round-about way using Network Shared Variables

5 SYSTEM ARCHITECTURE Host Communicates with RT Hardware via Networked Shared Variables RT Asynchronous Processes Communicate via RT User Events RT HARDWARE HOST INTERFACE Module A UE API SHARED VARIABLES Module B UE API

6 RT CONTROLLER MODULE Low priority loop in RT Controller Module polls Network Shared Variable for State and Data Commands from Host. New State Commands fire User Events on the RT Controller Module RT CONTROLLER MODULE Poll ‘RT Cmd’ NSV for States other than ‘Idle’. Fire associated State | Data Command as RT User Event

7 Fundamentals Components of a Module
The general state machine architecture uses a State Command Enum and a Variant data for both the State Queue and User Event [UE] data types. Type Defined Cluster of Command | Data Mechanism for sharing the Created User Event to other Modules User Event UE Publishing Mechanisms Global Shared Variable Command Queue for Module State Machine LV2 Functional Global Notifier Type Defined Main Cluster for data internal to the Module Single Element Queue

8 UE handling in a Module A Module’s State Machine handles the specific State Command sent to the Module via the User Event. Variant Data is converted back to the LabVIEW data type for further processing Need to know the original data type in order to convert the variant data back to LV data type properly Specific States type defined in the Command Enum can be used to handle any number of unique User Events Use Type Defined Controls for Complex Data Types Convert Variant to LabVIEW data type and process accordingly

9 Sending a UE to a Module Modules are ideally standalone processes that are often required to be command remotely or may need to patched into a higher level controller using sub panels. Only sending one type of Registered User Event, a cluster of Command Enum and Variant Data Each Module has an API that provides access to it’s registered user events Other modules can use the API to send User Events to the specific Module

10 User Event API for a Module
Provides access to the Dynamic Event registered for a Module Incorporates a Notifier that can be used for confirmation of commanded User Event

11 Run Demo Run Demo code on cRIO-9075 embedded controller
Run Host Module and send commands to RT Controller Module which in turns commands Modules A and B via RT User Events

12 More Potentially Useful Information
Alternative Host – RT Communication Mechanisms TCP/IP UDP Data Socket Network Streams (LV ≥ 2010) Serial 232, 484, CANbus, GPIB Real-time VI to Host VI Communication Knowledgebase NI’s cRIO DEVELOPER GUIDE Questions Thanks!

Download ppt "User Events in LabVIEW RT"

Similar presentations

Ads by Google