340 likes | 372 Views
Understand the concept of control in embedded real-time systems, including scheduling, execution time analysis, and terminology. Explore examples and applications, such as real-time control in Swedish fighter jets and automotive electronics. Learn about time-triggered and event-triggered implementations in control systems.
E N D
Embedded Real time systems – an Introduction • What’s a ”Real time system”? The concept of control. • Embedded real time control – some examples • Some terminology • ”Scheduling” – determination of actions • ”Execution time analysis” – a prerequisite for scheduling Embedded Real time systems - an Introduction
Embedded systems Wikipedia... ” An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts.” More distinct... ” An embedded system is a special-purpose digital system designed to perform dedicated functions with real-time computing constraints. The digital system hardware is embedded as part of a complete device which might include other hardware such as mechanical, pneumatic or hydraulical parts.” Embedded Real time systems - an Introduction
Digital systems Server applications Embedded systems Personal computing Real-Time Control systems Secure/RobustR-T control Safety-critical R-T control Embedded Real time systems - an Introduction
Swedish fighter JAS 39 GRIPEN In Control ? Embedded Real time systems - an Introduction
but there is control ... In Control ? Embedded Real time systems - an Introduction
In Control ? Control requires feedback A control system is a feedback system Time properties (temporal aspects) is fundamental for a well designed control system. A computer designed for control has to handle REAL-TIME as desired by the controlled object. Embedded Real time systems - an Introduction
Real time control applications Embedded Real time systems - an Introduction
steer ”by-wire” electronic information carrier hydraulic information carrier The “F-8 Digital Fly-By-Wire (DFBW)” validated fundamental concepts still used today. The first “by-wire” flight was in the 25’th of May in 1972. The project lasted for 13 years. Embedded Real time systems - an Introduction
Computers in space… Embedded Real time systems - an Introduction
..and within marine applications. Embedded Real time systems - an Introduction
..development of Automotive electronics Embedded Real time systems - an Introduction
control characteristics in a car • simple reactive (ON/OFF) … climate, windows … • reactive, autonomous … engine- and gear- control, anti-brake-lock, anti-spin, etc. • safety critical airbag ... • others.. navigation, audio-video ... Embedded Real time systems - an Introduction
A real time clock, basic terminology ”Correct time” is an convention ”perfect clock” computer time ”computer clock” correct time Embedded Real time systems - an Introduction
A real time clock, basic terminology Cs(t)>t computer time Ideal : C(t)=t Cs(t) Cs(t)<t t correct time Embedded Real time systems - an Introduction
Definitions Correctness Deviation Monotoni Embedded Real time systems - an Introduction
ct rt Δt rt1 rt0 Clock adjustment Embedded Real time systems - an Introduction
1 oscillator 1 2 2 timer Mechanisms Embedded Real time systems - an Introduction
interval t 0 IRQ IRQ IRQ Y = X / interval Timer interrupt Embedded Real time systems - an Introduction
Real time clock timer interrupt ”TICK” ”TIMESLICE” ”TIMESLICE” ”Timer interrupt routine” – invoked approx each ms, requires low overhead ”TIMESLICE” – systemcheck, task switch, more overhead 100 000 ”TIMESLICE” – clock adjustment Embedded Real time systems - an Introduction
init_timer start_timer stop_timer timer_interrupt SetRealTime SetTime GetTime SetTimeout SetPeriod ... ... Application task GetRealTime ”software” clock hardware clock Clock services Embedded Real time systems - an Introduction
A control system rk Computations control laws r(t) A/D uk D/A yk A/D y(t) u(t) sensor object actuator Embedded Real time systems - an Introduction
Time triggered implementations initiate • Pros Easy to understand, easy to implement. • Cons Time synchronization is tied to underlying hardware. Difficult to anticipate and handle unordered events. Software complexity depends on object . object input calculate output Embedded Real time systems - an Introduction
Event triggered implementations • Pros Easy to understand. Short response times (good feedback performance) • Cons Exteremely complex software when object becomes complex. initiate object wait... activity.. Embedded Real time systems - an Introduction
A software task task 1 task 2 task 3 sensor actuator sample input from sensor compute new values (control laws) update actuators actuator micro computer t Embedded Real time systems - an Introduction
Scheduling strategies Non-preemptive (serial) task switch task 1 task 2 task 3 t Preemptive (parallel) task switch task 3 task 2 task 1 t Embedded Real time systems - an Introduction
Task Execution time analysis Measurements, program under test is executed a number of times. A Worst Case Execution Time is estimated. Code analysis, determine the most time consuming path through the program and determine execution time for this path. Embedded Real time systems - an Introduction
Execution time measure // Example t_start = C(t); P(); t_finish = C(t); t_exec = t_finish – t_start; Embedded Real time systems - an Introduction
Execution time analysis, basic blocks start label: ..instr 1 ..instr 2 ..instr 3 ... ..instr n bra ... BB 1 BB2 BB3 stop Embedded Real time systems - an Introduction
start BB 1 BB 2 start BB 3 ΣBB stop stop Execution time analysis, Control Flow Graphs A Control Flow Graph represents all possible execution paths in a program. Contributions from all basic blocks are summed. Embedded Real time systems - an Introduction
Basic blocks, assignments int a,b; long int la,lb; a = b; la = lb; Each instruction takes 6 processor cycles (from Datasheet). So, for the block: 6+6+6=18 cycles Execution time: 18 * 1/fClock * MC68HCS12 BB: movw _b,_a movw _lb,_la movw 2+_lb,2+_la Embedded Real time systems - an Introduction
Basic blocks, test evaluation BB= [min,max] At the end of the block the ackumulator D should hold 1 (if the expression is true) and 0 otherwise. (Compiler convention) Embedded Real time systems - an Introduction
Combining basic blocks, if/else A program flow graph for: if( c == a ) b = 1; else b = d+e+f+g; test Code for ’test’ is always executed. Exactly one of statements ’S1’ or ’S2’ is always executed. S1 S2 Embedded Real time systems - an Introduction
Combining basic blocks, if/else Inspect the code, identify and annotate the basic blocks: BB0: if( c == a ) BB1: b = 1; else BB2: b = d+e+f+g; From the program flow graph we conclude that: BB(min) = BB0(min) + min ( BB1(min) , BB2(min) ) and BB(max) = BB0(max) + max ( BB1(max) , BB2(max) ) Embedded Real time systems - an Introduction
Summary we have got a brief introduction to • The concept of control. • Embedded real time control • Real Time Systems terminology • Task Scheduling • Execution time analysis Embedded Real time systems - an Introduction