Download presentation
Presentation is loading. Please wait.
Published byBarnaby Glenn Modified over 9 years ago
1
Joe Clifton Computer Science and Software Engineering University of Wisconsin – Platteville
2
Course Focus Software-Oriented Hardware Exposure Balance Theory & Hands-on Exposure to a range of Platforms, processor/memory configurations Languages - assembler, high level Testing and debugging methods & tools Analysis, design, process expectations
3
“Overview” Topics Real-time embedded system examples Processors and systems Development languages Development environments Platforms and platform standards RTOSes, RT kernels, tasking shells
4
“Practical” Topics Simulators,Emulators,Monitors,ICE,BDM RAM, ROM, EPROM, EEPROM, flash Timers, counters, interrupts, watch dog I/O: memory-mapped, port, DMA Device drivers, UARTs, PPIs Interfacing and communications
5
“Theoretical” Topics Reliability, fault tolerance, exception handling Concurrent programming, tasks, threads Synchronization and communication Process and resource scheduling Resource control: semaphores, monitors Device inter-processor communications Real-time UML and OOA&D
6
Student Background CS/SE 2630 - Object-Oriented Programming and Data Structures II, CS/SE 3430 - Object-Oriented Analysis and Design, and either EE 3780 - Introduction to Microprocessors, or CS 3230 - Computer Architecture and Operating Systems Senior Year, so usually much more
7
Platforms PIC 16F84, 16F877A Harvard arch: 1/8 KB Flash, 68/368 B SRAM RISC - 35 instructions, 14 bits each (BTFSC) Freeware assembler, simulator, C compiler Infineon C515C – 8051 derivative – 32K Keil uVision, C compiler, RTX51 Tiny RTOS RLC XSCALE – Windows CE Touch Screen, USB, 32MB Flash / 64MB DRAM C# and Visual Studio.NET
8
Control Theory Added in response to Advisory Board Limited time available to cover 1 – 2 days PID Control an appropriate choice Can be comprehended without elaborate theory 8501-lab a natural way to incorporate Simulated devices cheap way to go!
9
Proportional-Integral-Derivative Control some quantity Drive to a desired value error = desired value – current value correction value applied to controlling device Proportional – constant times error Integral – constant times sum of errors Derivative – constant times change error Correction value = P + I + D
10
Theoretically Kc = Controller Gain T I = Integral or Reset Time T D = Derivative or Rate Time From Gopal, Control System: Principles and Design
11
Proportional Constant times error Constant too small Slow rise time Constant too large Overshoot Ringing or Oscillation Overshoot that continues to travel back and forth
12
Integral Constant times the sum of the errors Each term should be multiplied by the time interval Drive at a constant rate, time factor is a constant Smoothing out the error: “History” Longer “below”, larger integration term grows Decreases on overshoot, so smaller overshoot on other side Can eliminate steady state error Can grow large, so often needs to be limited
13
Derivative Constant times the change in error Should be divided by the time interval Drive at a constant rate, time factor is a constant Instantaneous rate of change of error Slope of Error: “Future” As actual moves to desired value from one side, P & I have same sign but D has opposite sign Can decrease overshoot and settling time Can use: Previous Actual – Current Actual
14
Timing Tolerance Integral “Sampling rate should vary by no more than 20% over any 10-sample interval” Derivative “Sampling interval to be consistent to within 1% of the total at all times-the closer the better” From Wescott, “PID Without a PhD”,
15
Algorithm currentError = desiredValue – currentValue pTerm = Kp * currentError iSum = iSum + currentError if iSum > iSumMax then iSum = iSumMax elsif iSum < iSumMin then iSum = iSumMin iTerm = Ki * iSum dTerm = Kd * (currentError – previousError) previousError = currentError controlOutput = pTerm + iTerm + dTerm
16
Tuning the Loop Make a Model and use Tuning Software Use Test equipment, gather data, analyze More time & money than we have allocated for this A Manual Approach Set Kd, Ki = 0, Kp = 1 or less: will be slow or oscillate Set Kd about 100 times Kp Increase until osc, excessive noise or overshoot ○ Inc /Dec by factor 8/10, then 2/4 when closer Back Kd off by a factor of 2 or 4 Increase Kp until excessive overshoot or Osc Back Kp off by a factor of 2 or 4 Increase Ki to reach desired within required time
17
Project Control a simulated analog device Device is simulated using a PIC Output of device Analog signal in the range of 0 to 5 volts Control via two discrete inputs Increase / Decrease Voltage The longer a 1 is written, the faster the rate of inc/dec Multi-tasking environment Tasks: ADC reading, PID loop, Keypad for Desired, and Display, including bit-banged serial for “checking”
18
References Tim Wescott, “PID Without a PhD”, Embedded Systems Programming, October 2000 M. Gopal, Control System: Principles and Design, McGraw Hill, 2008
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.