390 likes | 403 Views
This lab introduces students to real-time system design and focuses on modeling the PT 326 Process Trainer using LabVIEW and the Nios II Embedded Evaluation Kit.
E N D
ENGG*4420Real Time System DesignLabs Introduction TA: Aws Abu-Khudhair(aabukhud@uoguelph.ca) Tuesday 11:30 - 2:20 Thursday 12:30 - 3:20 ENGG*4420 Lab 1
Today’s Activities General Introduction Lab 1 Introduction Fill in swipe card form Make groups (min 2 students, max 3) Start work on Lab 1 ENGG*4420 Lab 1
General Introduction Course consists of 4 labs: Modeling the PT 326 Process Trainer. Real-Time Automotive Suspension Simulator. Real-Time Control of a Hot Air Plant using RTOS uC/OSII Multi-Core Real-Time Suspension Control using LabVIEW Real-Time OS ENGG*4420 Lab 1
Deadlines Demos and reports are due at the same time. Lab 1: Tuesday, Sep. 28th Lab 2: Tuesday, Oct. 12th Lab 3: Tuesday, Nov. 2nd Lab 4: Tuesday, Nov. 30th ENGG*4420 Lab 1
Marking Labs 1 and 2 - 8% each. 4% for the demo, 4% for the report. Labs 3 and 4 - 12% each. 6% for the demo, 6% for the report. A group work evaluation form MUST be submitted with every lab report. http://www.soe.uoguelph.ca/webfiles/rmuresan/ENG3490-W06.htm ENGG*4420 Lab 1
Lab 1 Modeling the PT 326 Process Trainer Due Date: Tuesday Sep. 28th, 2009 ENGG*4420 Lab 1
Lab 1 Development Environment LabVIEW 2009 software Nios II IDE Altera Nios II Embedded Evaluation Kit ENGG*4420 Lab 1
Lab 1 – Simple Hot Air BlowerPT 326 Process Trainer ENGG*4420 Lab 1
Lab 1 Architecture ENGG*4420 Lab 1
Control of a Thermal System LabVIEW Altera
Plant Model Equation (6)
LabVIEW Plant Implementation • The Plant system is defined in LV using transfer function VIs. Setup Plant Transfer Function Execute Plant System
Control System • PID-based control system • Proportional • Integral • Derivative • Control is based on an Error signal • Implemented in LabVIEW using the PID VI Set Point Output Process Variable
Lab 1 Requirements/Steps Step 1: Study and understand the implementation files provided: Hot Air Plant Model CD Vis Lab1.vi. Engg4420_example.c Engg4420_example.h C:\C:\engg4420_lab1_labview C:\engg4420_lab1 ENGG*4420 Lab 1
Lab 1 Requirements/Steps Step 2: Tune the PID controller using the Ziegler and Nichols method. Perform BOTHopen loop, and closed loop tuning procedures (pg.12). Step 3: Establish communication between LabVIEW and Altera board Step 4: Graph the plant output on the Altera LCD. ENGG*4420 Lab 1 15
Introduction to LabVIEW ENGG*4420 Lab 1
LabVIEW Graphical development environment. Used for measurements, data acquisition, measurement analysis, report generation, plant modeling, control systems, Embedded Design, Signal Processing etc… Dataflow Language www.ni.com/labview ENGG*4420 Lab 1
LabVIEW Virtual Instruments (VIs) Built in functions used to create any application • Each VI requires a specific number of inputs. • Select a VI and press “ctrl+H” for information regarding the VI ENGG*4420 Lab 1
Front Panel Contains the user interface ENGG*4420 Lab 1
Block Diagram Contains the VIs and the necessary connections. Execution Control (loops, case structures, formula node, etc…) ENGG*4420 Lab 1
Altera Nios II Embedded Evaluation Kit ENGG*4420 Lab 1
Altera Nios II Board Devices 16 MB of Intel P30/P33 flash. 32 MB of DDR SDRAM. Color LCD touch-screen display. USB connector. Serial connector. 10/100 Ethernet physical layer/media access control (PHY/MAC). Six push buttons total. Seven LEDs total. Embedded FPGA board. ENGG*4420 Lab 1
Altera Nios II IDE Altera -> Nios II EDS 8.0 -> Nios II IDE 8.0 Examples are located at ‘C:\Altera\80\nios2eds\examples’ Follow ‘ENGG4420_example.c’ for relevant operations. LCD + Multitasking + Serial Comm. ENGG*4420 Lab 1
uC/OS-II is a highly portable, very scalable, preemptive real-time, deterministic, multitasking kernel. It can manage up to 64 tasks It has connectivity with uC/GUI and uC/FS. It is ported to more than 100 microprocessors and microcontrollers. It supports all type of processors from 8 to 64 bits ENGG*4420 Lab 1
How to implement Lab1? Read chapter 1 of the lab manual. Preparation 1- Review the Implementation of the Plant System. Hot Air Blower.VI Preparation 2 – Review and Analyze the implementation of the uC/OSII tasks ENGG4420_example.c ENGG4420_example.h Preparation 3 – Establish connection between LabVIEW and Altera board ENGG*4420 Lab 1
How to implement Lab1? Cont. Tuning (Lab Manual section 1.3 – pg. 12) Perform Open and Closed loop tuning methods to derive a set of workable PID constants. Talk to your TA if you are not familiar with PID control ENGG*4420 Lab 1
How to implement Lab1? Cont. Implement the communication Tasks in LabVIEW and Nios II. Do the following first: Make a folder at “H:\RTLabs\your-project-name” In Nios IDE setup the project path at --- ENGG*4420 Lab 1
How to implement Lab1? Cont. Cont. LabVIEW-> Transmit the plant output value to the Altera board using serial communication. Altera-> Receive the transmitted value and graph it on the LCD in RT. Altera-> Send the output value back to LabVIEW. LabVIEW -> Read the plant value from serial IO and process it (PID). ENGG*4420 Lab 1 28
Implementation Suggestions • Use synchronization semaphores to organize the communication process. • Create a new RxTx_uart on the Altera board. Set a delay on the task that matches the LabVIEW sample interval. • Create a separate task on the Altera board for graphing the voltage values
Notes - How to set up Hyper Terminal? Start All Programs Accessories Communication Hyper Terminal Assign a name to your hyper terminal select COM1 select 115200, 8, None, 1, None. ENGG*4420 Lab 1
Notes - LabVIEW Occasionally, you may need to convert data for interconnectivity. This can be done using the conversion blocks (Mathematics Numeric Conversion) ENGG*4420 Lab 1 31
Notes - LabVIEW Local Variables can be used to give inputs to controls. They can be found in the “Structures” section of the function palette. You can configure them to be either read or write depending the required operation. ENGG*4420 Lab 1 32
Notes - LabVIEW When setting up a feedback node, you need to wire in a constant from outside the loop for initialization ENGG*4420 Lab 1 33
Notes - LabVIEW To easily locate VIs use the search tool in the functions and controls panels. ENGG*4420 Lab 1 34
Note – LabVIEW examples • LabVIEW examples can be found in the ‘Help’ Menu under ‘Find Examples’.
Note – LabVIEW examples • Examples using specific VIs can be found through the ‘context help’
Notes – Serial Communication LV serial comm. is performed using NI VISA. Perform the serial port write operation using a termination char See the “Advanced Serial Write and Read.vi” example Setup serial comm. Write to serial port Read from serial port ENGG*4420 Lab 1 37
Note – Serial Communication Cont. • Order of operations: • Configure serial port: • Enable read on termination char. • Set termination char. • Set timeout. • Define VISA resource (COM1 or COM2). • Define Baud rate …. • Define ‘write’ termination char. • Define input buffer size. • Write string (data must be in char not float). • Close session at end.
Deadlines and Marking Lab 1 is worth 8%. 4% for the report, and 4% for the demo The Demo is due Sep. 28th, 2010 in the Lab. The Report is due Sep. 28th, 2010 in the Lab. A signed group evaluation sheet must be submitted with the lab report ENGG*4420 Lab 1