210 likes | 392 Views
Upgrade to Real Time Linux Target: A MATLAB-Based Graphical Control Environment. Thesis Defense by Hai Xu. Department of Electrical and Computer Engineering. CLEMSON U N I V E R S I T Y. Presentation Overview. Introduction Technical Approach: Memory Allocation Shared Memory Pool
E N D
Upgrade to Real Time Linux Target: A MATLAB-Based Graphical Control Environment Thesis Defense by Hai Xu Department of Electrical and Computer Engineering CLEMSON U N I V E R S I T Y
Presentation Overview • Introduction • Technical Approach: • Memory Allocation • Shared Memory Pool • Log Buffer • RTLT Hardware Interface • Hardware Client-Server Architecture in RTLT • How does RTLT work with SIMULINK ? • What’s new in the upgraded version of RTLT ? • LMotor (GUI) • Conclusions
Introduction • RTLT (Real-Time Linux Target) is a software package that gives the user the ability to implement a SIMULINK block diagram on a standard Intel PC in hard real-time. • RTLT provides a Graphical Environment for the implementation and execution of control algorithms. • RTLT combines the superior computation power of MATLAB engine with the block diagram capabilities of SIMULINK. • RTLT has been successfully used in many control experiments at Clemson. • LMotor is a Graphic User Interface (GUI) for RTLT. LMotor provides visual modeling capabilities to help users understand complex systems.
Introduction (Cont’d) • MATLAB is a software environment that allows a user to easily integrate computation and visualization tasks. • SIMULINK is a software package for modeling, simulating, and analyzing dynamic systems in the MATLAB environment. • Real-Time Workshop (RTW) is an automatic C language code generator for SIMULINK.
Technical Approach • Memory Allocation: • Shared Memory Pool • Log Buffer • RTLT Hardware Interface • Hardware Client-Server Architecture in RTLT • How does RTLT work with SIMULINK ?
Process 1 Process 2 Read/Write Data Shared Memory Pool Shared Memory Pool • What is Shared Memory? • Shared Memory is a fast, no-blocking Inter-Process Communication (IPC) method. • 2 or more processes can access a single chunk of memory. • Communication is achieved by reading and writing to this block of memory.
Shared Memory Pool (Cont’d) • What is Shared Memory Pool? • Shared Memory Pool is a block of physical memory that is reserved during boot up. • Shared Memory Pool is allocated in Kernel space. • Shared Memory Pool can be used in User space by using the Shared Memory Management APIs (Application Program Interface) of RTLT. • RTLT uses a shared memory pool to facilitate the implementation of hardware client-server architecture. • The maximum size of the Shared Memory Pool is 4 MB in Intel- • Pentium class machines and above. On earlier machines, it is 1 MB.
Log Buffer • Why we have to use Log Buffer? • To save large amounts of data, Shared Memory Pool is not big enough. • What is Log Buffer? • Created in the Kernel address space (controlled by Linux Kernel) and mapped to User space. • The created log buffer is not in the Shared Memory Pool. • At present, we can create onlyone log buffer in RTLT.
Log Buffer Shared Memory Pool Log Buffer (cont’d) • How to use Log Buffer? • The base address and the size of the log buffer are initialized in Kernel space and then mapped to the User space. • Both Kernel and User processes can access the big "shared" log buffer. User Space Kernel Space
Hardware Client-Server Architecture in RTLT • I/O Board Servers (Device Drivers): - read input data from I/O Board through A/D channels or digital lines, etc. Write the data to the Shared Memory Pool. - write output data from the Shared Memory Pool to the I/O Board. • I/O Board Clients (Real-Time targets): - read input data from the Shared Memory Pool. - write the processed data to Shared Memory Pool.
Hardware Interface for RTLT • Supported Inexpensive Motion Control Board: • - MultiQ2, MultiQ3, ServoToGo, PCL812, Pmac and AtiFT • Supported Interfaces: • - A/D • - D/A • - Encoder • - Digital I/O
How does RTLT work with SIMULINK ? • Create the Control Program with the SIMULINK block diagram and RTLT SIMULINK Library blocks:
How does RTLT work with SIMULINK? (Cont’d) • Digital To Analog Converter: Redirects the Input Signal to the Converter Block to the Specified D/A channel • Analog To Digital Converter: Reads Input Signal from the A/D channel • Digital Output: Outputs TTL Level Signal to Specified Line (bit) • Digital Input: Reads TTL Level Signal from Specified Line (bit) • Read Encoder: Reads the Quadrature Encoder Signal and Converts to a Number (Representing, for example, Angular Displacement of a Rotor) • Set Encoder: Allows User to Set the Encoder Reading to a Pre- Determined Value (Used to commutate, for example, SR, Stepper and BLDC motors) • Reset FT: The Reset FT block allows the user to reset the bias array of the ATI Force/Torque sensor system. (for ATI FT board only) • Hardware Adapter: Special Block that Provides a Reference to a Particular I/O Board
How does RTLT work with SIMULINK? (Cont’d) • A Control Program Example:
How does RTLT work with SIMULINK? (Cont’d) • Initialize Simulation Parameters: I/O Board Simulation Parameters
How does RTLT work with SIMULINK? (Cont’d) • Build Real-Time Target and Execute: External Model Control Panel
How does RTLT work with SIMULINK? (Cont’d) • Some Optional Simulation Parameters:
What’s new ? • Newer stable Linux Kernel • From version 2.2.13 to 2.2.18 • Newer MATLAB • From version 5.3 to 6.0 • Newer RTLinux • From version 2.0 to 3.0 • Newer RedHat Linux • From version 6.x to 7.0 • LMotor
LMotor • What is LMotor ? • LMotor is a Graphic User Interface (GUI) for RTLT • LMotor features include : • on-line parameter tuning without recompiling the MATLAB model • allowing users to watch the Real-Time values of selected log variables • monitoring of logged variables during control execution in the form of real-time plot windows • superior real-time plotting capabilities in conjunction with MATLAB compatible data logging • exporting logged data to MATLAB compatible data format (M-files).
Conclusions • Salient Features of the Real-Time Linux Target • Utilizes the Computational Power of MATLAB • Block Diagram- based Approach (SIMULINK) • Online Data Plotting • Online Parameter Tuning • MATLAB Compatible Data Export (M- Files) • Multiple I/O Boards Support • Data Sharing • Future Work • Upgrade the RTLT to newer Linux Kernel and RTLinux. • More I/O board drivers support • Optimize the LMotor