Inside Lab VIEW Steve Rogers Lab VIEW Software
Inside Lab. VIEW Steve Rogers Lab. VIEW Software Engineer Wed, 10: 15 a, 12: 45 p, and 3: 30 p Mulberry (10 B) 9/9/2020 www. natinst. com
Inside Lab. VIEW – Topics § § § § Virtual instrument organization How VIs are compiled Lab. VIEWs Execution system Single-threaded Lab. VIEW Multithreaded Lab. VIEW RTs remote execution system What happens when indicators display What happens when a sub. VI is called www. natinst. com
The Parts of a VI Loaded when used VI Front Block Panel Diagram Data Space www. natinst. com Always present in memory Compiled Code
VIs are compiled An Example Diagram www. natinst. com
VIs are compiled – “Clumps” Clump 1 Clump 0 Clump 2 Start of diagram • Read controls • Read constants • Schedule Clumps 1 & 2 (for loops) • Sleep. . . www. natinst. com Top for loop • Update indicator • Schedule Clump 0 • Sleep. . . Bottom for loop • Updated indicator • Schedule Clump 0 • Sleep. . . Completion of diagram • Execute divide nodes • Display indicators • Exit VI
The Execution System “Run. Q” head tail “cur. Elem” QElement DS PC ebp (ds register) VI Code instruction www. natinst. com QElement DS PC QElement DSPC prioritized PC VI Data Space
Exec() is a Loop Sleeps on run. Q when multithreaded cur. Elem = Dequeue(run. Q) ebp = cur. Elem DS res = call cur. Elem PC if(res) cur. Elem PC = res Enqueue(run. Q, cur. Elem) cur. Elem = NULL Cooperatively returns when in UI thread www. natinst. com “Rotates” the run. Q cooperative multitasking
Single-Threaded Lab. VIEW Computer User Interface Loop www. natinst. com Thread Co-Routines Exec( )
Multithreaded Lab. VIEW Computer Thread Messages UI Loop co-routines Exec() Thread Exec( ) www. natinst. com Thread Exec( )
Lab. VIEW RT – Target System RT Computer Thread Messages Communication TCP/IP Loop Co-routines Exec() www. natinst. com Thread Exec( )
Lab. VIEW RT – Development System Host Lab. VIEW RT Computer Thread User Interface Loop Communication to target possibly Exec() www. natinst. com Lab. VIEW RT Target Computer TCP/IP Thread -shared memory -Ethernet -other Communic ation to host or client Exec() Thread Exec() Thread Exec()
Lab. VIEW RT – Deployed System Client Lab. VIEW Computer Thread Exec() Thread Exec() www. natinst. com UI Loop and Communications Exec() TCP/IP Lab. VIEW RT Target -Shared memory -Ethernet -Other Computer Thread Communic ation to host or client Exec() Thread Exec() Thread Exec()
Display to an Indicator (Single Thread) Execution Data Operate/ Display Data Running code copies execution data to the operate/display, and calls the display function for the indicator. www. natinst. com
Display to an Indicator (Multithread) Execution Thread UI Thread Execution Data Running code acquires mutex. Copies execution data to transfer data, releases mutex, and posts message to UI thread. www. natinst. com Operate/ Display Data Transfer Data: Mutex “dirty flag” “update flag” Message queue UI thread receives message, acquires mutex, copies transfer data to operate/ display data, releases mutex, and displays indicator.
Sub. VI Calls (Sub. VI Not Busy) Caller Data Space QElement DS PC param. Ptr Params param 0 param 1 Callee Data Space Mutex cur. Elem: NULL wait. Q: empty “top level” QElement DS PC Execution System – cur. Elem www. natinst. com
Sub. VI Calls (Sub. VI Running Caller) Caller data space QElement DS PC param. Ptr Params param 0 param 1 Callee data space Mutex cur. Elem wait. Q: empty “top level” QElement DS PC Execution System – cur. Elem www. natinst. com
Sub. VI Calls (Sub. VI is Busy) Caller data space QElement DS PC param. Ptr Params param 0 param 1 Callee data space other caller Mutex cur. Elem wait. Q “top level” QElement DS PC Execution System – cur. Elem www. natinst. com
- Slides: 17