Presentation on theme: "User Events in LabVIEW RT"— Presentation transcript:
1 User Events in LabVIEW RT Colorado ALARM User Group17 November 2011STEVE SOLGA | ELECTROMECHA LLC
2 Event Structure under LabVIEW RT RT TARGETS ONLY SUPPORT USER EVENTSEvent 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 MECHANISMUser Events in LabVIEW RT are another way to communication between parallel processesMore common communication mechanisms include Queues, RT-FIFO’s, and Shared VariablesRT SOFTWARESTANDARD METHODSALTERNATIVE METHOD
4 Moving from Windows UE’s to RT UE’s MULTIPLE TASK (MULTIPLE CONTROL LOOP) COMMUNICATION METHODIn many applications, the RT controller runs multiple control processes that need to communicate with each otherThis 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 typesWINDOWS CODE QUICKLY PORTS TO RTCode 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 logicGOOD FOR QUICK PROTOTYPINGUsing 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 architectureHost 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 EventsRT HARDWAREHOST INTERFACEModule A UE APISHARED VARIABLESModule 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 ModuleRT CONTROLLER MODULEPoll ‘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 | DataMechanism for sharing the Created User Event to other ModulesUser EventUE Publishing MechanismsGlobalShared VariableCommand Queue for Module State MachineLV2 Functional GlobalNotifierType Defined Main Cluster for data internal to the ModuleSingle Element Queue
8 UE handling in a ModuleA 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 processingNeed to know the original data type in order to convert the variant data back to LV data type properlySpecific States type defined in the Command Enum can be used to handle any number of unique User EventsUse Type Defined Controls for Complex Data TypesConvert Variant to LabVIEW data type and process accordingly
9 Sending a UE to a ModuleModules 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 DataEach Module has an API that provides access to it’s registered user eventsOther 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 ModuleIncorporates 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 MechanismsTCP/IPUDPData SocketNetwork Streams (LV ≥ 2010)Serial 232, 484, CANbus, GPIBReal-time VI to Host VI Communication KnowledgebaseNI’s cRIO DEVELOPER GUIDEhttps://decibel.ni.com/content/groups/large-labview-application-developmentQuestionsThanks!
Your consent to our cookies if you continue to use this website.