Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lab 3 Real-Time Control of a Hot Air Plant using RTOS µC/OSII Due Date: Week of Nov. 2 nd, 2010.

Similar presentations


Presentation on theme: "Lab 3 Real-Time Control of a Hot Air Plant using RTOS µC/OSII Due Date: Week of Nov. 2 nd, 2010."— Presentation transcript:

1 Lab 3 Real-Time Control of a Hot Air Plant using RTOS µC/OSII Due Date: Week of Nov. 2 nd, 2010

2 Today's Activities  Lab 3 Presentation  Special topic presentation Rate Monotonic Scheduling (RMS)  Lab 2 demos.

3 Lab 1 Development Environment  LabVIEW 2009 software  Nios II IDE  Altera Nios II Embedded Evaluation Kit

4 Simple Hot Air Blower PT 326 Process Trainer

5 Lab 1 Architecture UART WriteSerial Read UART ReadSerial Write LabVIEWAltera Nios II Plant Model Plant Comm. PID Controller Operator Input Feedback Signal Control Signal Input Voltage Measured Voltage

6 Plant/Controller Features

7 Lab Requirements  Plant interface Input from plant Output to plant  PID control system  Operator Interface LCD display Operator input

8 Plant Interface  Input from plant Plant output voltage (from LabVIEW)  Output to plant Heater control (manipulated variable)  Communication implemented using serial communication with termination character.

9 Operator Interface - Inputs  Input from LCD touch screen ON/OFF signal Auto/Manual mode control Setpoint voltage (Auto Mode) Voltage input (Manual Mode)

10 Operator Interface - Outputs  Output to LCD Voltage/Time graph (Lab 1) + voltage setpoint Current sampling time Voltage reference Voltage output (output to plant) Proportional gain (Kc) Integral time (Ti) Derivative Time (Td) Current time (HH:MM:SS)

11 Operator Display

12 PID Control System  m(t) = manipulated variable (output to plant)  r(t) = plant setpoint  c(t) = controlled variable (voltage from LabVIEW)  e(t) = plant error = r(t) – c(t)  K p = Proportional gain  T i = Integral time  T d = Derivative time

13 PID Control Discrete Time Implementation  Where s(n) is the sum of errors  T s = sampling time = ∆t

14 Implementation Requirements  LabVIEW model Two tasks: Plant Model task, communication task. Data communication between tasks using queues. Serial communication using termination character  Altera implementation Must employ at least three tasks PID controller must have a dedicated task Semaphores used for data synchronization  Note that ALL timing requirements discussed in the lab manual MUST be implemented.  Task priorities MUST be discussed and justified in your report  Time delays on time critical tasks MUST be discussed and justified in your report

15 Real-Time System Implementation – pg. 58-59 of lab manual

16 Real-Time Constraints  Control system must operate with a sampling rate of [100-500] ms  ON/OFF buttons Sampled every 2-5 seconds  Auto/Manual controls Sampled every 2-5 seconds  Vinput and Vref buttons Sampled every 1-2 seconds  Clock/Time Must execute every 1 second  Operator display must be updated every 5 seconds

17 Task Priorities  uC/OS II can manage up to 63 tasks  OS has it’s own system tasks It is recommended that you DON’T use priorities 0-5 (Highest priority = 6)  Each task must be assigned a unique priority level.  The lower the priority number the higher the priority of the task  uC/OS II will always execute the highest priority task ready to run.

18 Assigning Task Priorities  Assigning task priorities in complex real- time systems is a difficult job Noncritical tasks should obviously be given low priorities  Most real-time systems have a combination of soft and hard requirements Soft RT systems: tasks are performed as quickly as possible but they don’t have to finish by specific times Hard RT systems: tasks must be performed correctly within the required time

19 Rate Monotonic Scheduling (RMS)  Priorities are assigned based on how often the tasks execute Tasks with the highest rate of execution are given the highest priorities Task Execution Rate (HZ) High Priority Low

20 RMS Theorem– cont…  RMS makes a number of assumptions All tasks are periodic (occur at regular intervals) The CPU must always execute the highest priority task that is ready to run  Given a set of n tasks that are assigned RMS priorities, the basic RMS theorem states that all task hard-real time deadlines are always met if the following inequality holds

21  Where E i = maximum execution time of task i T i = execution period of task i E i /T i = the fraction of CPU time required to execute task i  Note: CPU use of all time-critical tasks should be less than 70% Cont… Number of Tasks 11.000 20.828 30.779 Inf0.693

22 Deadlines and Marking  Lab 3 is worth 12%.  6% for the report, and 6% for the demo  The Demo is due Nov. 2 nd, 2010 in the Lab.  The Report is due Nov. 2 nd, 2010 in the Lab.  A signed group evaluation sheet must be submitted with the lab report


Download ppt "Lab 3 Real-Time Control of a Hot Air Plant using RTOS µC/OSII Due Date: Week of Nov. 2 nd, 2010."

Similar presentations


Ads by Google