Access Point Event Simulator (APES) for Legacy Software Systems (LESS) Stefan Resmerita Joint work with Patricia Derler and Edward Lee February 17, 2009.

Slides:



Advertisements
Similar presentations
Network II.5 simulator ..
Advertisements

Simulation of Feedback Scheduling Dan Henriksson, Anton Cervin and Karl-Erik Årzén Department of Automatic Control.
ECE 495: Integrated System Design I
Computer Architecture
Flexible Scheduling of Software with Logical Execution Time Constraints* Stefan Resmerita and Patricia Derler University of Salzburg, Austria *UC Berkeley,
Using an FPGA to Control the Protection of National Security and Sailor Lives at Sea Brenda G. Martinez, Undergraduate Student K.L. Butler-Purry, Ph.D.,
MotoHawk Training Model-Based Design of Embedded Systems.
Event Driven Real-Time Programming CHESS Review University of California, Berkeley, USA May 10, 2004 Arkadeb Ghosal Joint work with Marco A. Sanvido, Christoph.
Introduction Designing cost-sensitive real-time control systems for safety-critical applications requires a careful analysis of the cost/fault-coverage.
Manage Run Activities Cognos 8 BI. Objectives  At the end of this course, you should be able to:  manage current, upcoming and past activities  manage.
Page 1 Building Reliable Component-based Systems Chapter 13 -Components in Real-Time Systems Chapter 13 Components in Real-Time Systems.
Component Technologies for Embedded Systems Johan Eker.
Integrated Design and Analysis Tools for Software-Based Control Systems Shankar Sastry (PI) Tom Henzinger Edward Lee University of California, Berkeley.
February 12, 2009 Center for Hybrid and Embedded Software Systems Encapsulated Model Transformation Rule A transformation.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
3.5 Interprocess Communication
Chapter 13 Embedded Systems
Mixing Models of Computation Jie Liu Palo Alto Research Center (PARC) 3333 Coyote Hill Rd., Palo Alto, CA joint work with Prof. Edward.
Design of Fault Tolerant Data Flow in Ptolemy II Mark McKelvin EE290 N, Fall 2004 Final Project.
Design Realization lecture 23
SEC PI Meeting Annapolis, May 8-9, 2001 Component-Based Design of Embedded Control Systems Edward A. Lee & Jie Liu UC Berkeley with thanks to the entire.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for Threads.
February 12, 2009 Center for Hybrid and Embedded Software Systems Model Transformation Using ERG Controller Thomas H. Feng.
MoBIES Working group meeting, September 2001, Dearborn Ptolemy II The automotive challenge problems version 4.1 Johan Eker Edward Lee with thanks.
November 18, 2004 Embedded System Design Flow Arkadeb Ghosal Alessandro Pinto Daniele Gasperini Alberto Sangiovanni-Vincentelli
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
MOBIES Project Progress Report Engine Throttle Controller Design Using Multiple Models of Computation Edward Lee Haiyang Zheng with thanks to Ptolemy Group.
Using Two Queues. Using Multiple Queues Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Processor is faster.
Parallel Processing (CS526) Spring 2012(Week 8).  Thread Status.  Synchronization in Shared Memory Programming(Java threads ) ◦ Locks ◦ Barriars.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Institut für Computertechnik ICT Institute of Computer Technology Interaction of SystemC AMS Extensions with TLM 2.0 Markus Damm, Christoph.
Self Adaptivity in Grid Computing Reporter : Po - Jen Lo Sathish S. Vadhiyar and Jack J. Dongarra.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Magnetic Field Measurement System as Part of a Software Family Jerzy M. Nogiec Joe DiMarco Fermilab.
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
Lecture 2 Foundations and Definitions Processes/Threads.
Accelerating Scientific Exploration Using Workflow Automation Systems Terence Critchlow (LLNL) Ilkay Altintas (SDSC) Scott Klasky(ORNL) Mladen Vouk (NCSU)
Today’s Agenda  Quick Review  Finish Java Threads  The CS Problem Advanced Topics in Software Engineering 1.
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Lab 2 Parallel processing using NIOS II processors
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
MicroC/OS-II S O T R.  MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2.  It.
1 BBN Technologies Quality Objects (QuO): Adaptive Management and Control Middleware for End-to-End QoS Craig Rodrigues, Joseph P. Loyall, Richard E. Schantz.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Incremental Checkpointing with Application to Distributed Discrete Event Simulation Thomas Huining Feng and Edward A. Lee {tfeng,
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
What is a Process ? A program in execution.
Fall 2000M.B. Ibáñez Lecture 26 I/O Systems II. Fall 2000M.B. Ibáñez Application I/O Interface I/O system calls encapsulate device behaviors in generic.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
 Operating system.  Functions and components of OS.  Types of OS.  Process and a program.  Real time operating system (RTOS).
9/30/2016 Distributed System Exploration Mirabilis Design Inc.
Chapter 4 – Thread Concepts
Module 12: I/O Systems I/O hardware Application I/O Interface
TrueTime.
Managing The Internet of Things
Topics Covered What is Real Time Operating System (RTOS)
Chapter 4 – Thread Concepts
Real-time Software Design
Shanna-Shaye Forbes Ben Lickly Man-Kit Leung
Kellen Oleksak, Kevin Tomsovic, Hantao Cui
Operating System Concepts
Multithreading.
NETWORK PROGRAMMING CNET 441
Foundations and Definitions
Chapter 3: Process Management
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

Access Point Event Simulator (APES) for Legacy Software Systems (LESS) Stefan Resmerita Joint work with Patricia Derler and Edward Lee February 17, 2009

APES-LESS: February 17, Contents 1.Goals and motivation 2.Approach 3.Ptolemy II components 4.Further work 5.Demos Contents

APES-LESS: February 17, Main Goals Short-term: –Simulate (on a host computer) execution of embedded software written in C for OSEK-compliant OS and given platform model –Achieve fast Software-in-the-Loop testing Medium to long term: –Enable modeling of legacy applications –Apply MBD principles to legacy software Goals and Motivation

APES-LESS: February 17, Software in the Loop Testing Plant Model Actuator models Sensor Models Simulation of original application code Simulation of modified application code + – User Input Error Goals and Motivation

APES-LESS: February 17, Classical Problem DynamicsController.c void dC_step() { … write(angle); … } … … Memory MotorController.c void mC_step() { … read(angle); … } write(angle)read(angle) dC mC time Simulation dC mC time Execution on the ECU write(angle) read(angle) preemption S-function Goals and Motivation

APES-LESS: February 17, Simulation Engine Based on Ptolemy II Fast prototyping –Discrete event simulation –Java threads Component-based design Visual modeling Portability Enables execution of legacy code under different models of computation Approach

APES-LESS: February 17, Request Response Model Structure Functionality actors OSEK actors Actor execution Actor interaction Java-C bridge Ptolemy II components

APES-LESS: February 17, Event-Based Approach Access Point Event (APE) An access point is a line of source code with an I/O access or a system call In a run of the software, an access point event occurs whenever the code of an access point starts executing Access Point Event (APE) An access point is a line of source code with an I/O access or a system call In a run of the software, an access point event occurs whenever the code of an access point starts executing void dC_step() { … angle = t1*s1; … } void mC_step() { … tmp_a = angle; … } void dC_step() { … SendMessage(m_a, angle); … } void mC_step() { … ReceiveMessage(m_a,angle); … } void appDispatcher(){ while (appRunning){ WaitEvent(appDispatcherEvent); ClearEvent(appDispatcherEvent); if(simStep%5 == 0){ ActivateTask(dC_Task); } SetEvent(mC_Task, mC_Event); simStep++; } TerminateTask(); } Approach

APES-LESS: February 17, Execution Control at Access Points Insert a callback to the simulation engine at every access point –Determine the execution time since the previous APE –Send the timestamped APE to the task scheduler –Pause the execution of the task The task scheduler generates an Access Granted Event (AGE) The execution of the task is resumed upon receiving the AGE Approach activate(T 1 ) activate(T 2 ) AGE T 2 AGE T 1 APE T 1 (  1 ) APE T 2 (  2 ) terminate(T 2 ) APE T (  1 ’) T1T1 T2T2 t 1 t 2 t 2 +  2 t 1 +  1 +  2

APES-LESS: February 17, Example MotorController.c void mC_step() { … aPCallback(12); tmp_angle = angle; … aPCallback(42); WaitEvent(evMask); … } Thread cCodeThread; void fire() { notify(); } void aPCallback(time) { requestExecTime(time); sleep(); } CTask.java 2. start 6. resume 3. callback (stop) b. change task state, reschedule 1. Trigger 4. APE a. system call  CCodeLibrary 5. AGE Approach

APES-LESS: February 17, Functionality Actor: CTask Executes a C function mapped to an OSEK task in a dedicated thread Implements two callback methods: –accessPointCallback(executionTime, minimumDelay); before every access point where no monitoring is needed –accessPointCallback(executionTime, minimumDelay, varName, value); Inserted in the C code after the line where varName is updated Parameters: –The name of a C function mapped to an OSEK task –The priority of the task Ports: –Multicast output port, used to send APEs –Multicast input port, used to receive AGEs –Regular I/O ports for global variables Ptolemy II components

APES-LESS: February 17, Multithreaded DE Simulation: Problem Ptolemy II components t1t1 t2t2 t3t3 model time real time Process ev 1 Trigger task 1 Wake up thread of C task 1 (CT1) Process ev 2 Process ev 3 CT1 callback(  t 1 ) Generate APE 1 with timestamp t 1 +  1 ev 1 ev 2 t 1 +  1 APE 1 ev 3 CT2 CT1 11

APES-LESS: February 17, Multithreaded DE Simulation: Solution Ptolemy II components t1t1 t2t2 t3t3 model time real time Process ev 1 Trigger task 1 Wake up thread of C task 1 (CT1) Ask to be re-fired at t 1 +  1 Process ev 2 Process APE 1 CT1 callback(  1,  2 ) Resume DE thread Suspend C thread ev 1 ev 2 t 1 +  1 APE 1 ev 3 CT2 CT1  1,  1 t 1 +  1 ev´ 1 Process ev´ 1 Suspend execution of DE thread Generate APE 1 Finish ev´ 1 processing

APES-LESS: February 17, OSEK Actor: TaskScheduler Maintains task status information Implements task system services –ActivateTask, TerminateTask Receives task status notifications from other OSEK actors Sends AGEs to functionality actors Fixed priority preemptive scheduling Receives APEs from CTask actors ready running waiting suspended trigger AGE preemption event/resource received wait for event resource blocked termiate task Ptolemy II components

APES-LESS: February 17, OSEK Actor: EventManager Implements event OSEK services –SendEvent –GetEvent –ClearEvent Notifies the TaskScheduler to change task status –If a task needs to wait for an event –If a waiting task receives an event Ptolemy II components

APES-LESS: February 17, Source (sensor) Actor: FormattedLineReader Reads data from an input file –At each iteration, data from one line is send to the output ports Assumes input text in tabular format –A column is a sampled signal –A line contains the values of all signals at a sample time Maps port names and types to named columns Buffered reading –All the file is processed at initialization, when all tokens are created and stored in memory Ptolemy II components

APES-LESS: February 17, Infrastructure Element: MultiCastIOPort Provides line-free connectivity between actors Output port: –Destination actors are specified at runtime in each send action –Static filter for eligible destinations given as a parameter Input: –Static filter for source actors specified as a parameter Can help in modeling service oriented applications Ptolemy II components

APES-LESS: February 17, Monitoring Task execution: Visualization of task states in time Global variables Ptolemy II components

APES-LESS: February 17, Java-C bridge Java classes –OSEKEntryPoint: Receives all system calls from C tasks and routes them to the appropriate OSEK actors –AccessPointCallbackDispatcher: Routes the callbacks from C to the appropriate functionality actors C wrapping code –APES layer –OS layer –Application layer Ptolemy II components

APES-LESS: February 17, Next Steps: The Simulator Methods –Refine source line granularity –Adapt and use existing methods for estimation of execution time Automatization tools –Code instrumentation –Generation of the APES model Visualization tools Performance evaluation Further work

APES-LESS: February 17, Application Performance Evaluation Simulation of closed-loop control applications –Bridging different simulation environments –Tool support Testing with code coverage Stability analysis/validation with regard to execution times Further work

APES-LESS: February 17, Modeling of Legacy Applications Task Model Functional Model Timing Model Modal Model Further work

APES-LESS: February 17, Demos: Active Rear Steering Control Simulink model: Demos

APES-LESS: February 17, Demo 1: Building a Basic APES model C code is generated from the Simulink model for each of the three subsystems Both controllers and the plant model are compiled in the same native library Input is read in the C part from a file CTask actors are used only for execution control No connections necessary at the Ptolemy level Demos

APES-LESS: February 17, The ARS Model for Demo 1

APES-LESS: February 17, Demo 2: APES model with plant actor in C The two controllers are compiled in the same native library Speed input is provided by a Ptolemy DE actor, and front angle input from a file at the Ptolemy level The plant is wrapped in an EmbeddedCActor Connections are needed between controllers and their environment Demos

APES-LESS: February 17, The ARS Model for Demo 2 Demos

Thank you for your attention!