access point event simulator apes for legacy software systems less n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Access Point Event Simulator (APES) for Legacy Software Systems (LESS) PowerPoint Presentation
Download Presentation
Access Point Event Simulator (APES) for Legacy Software Systems (LESS)

Loading in 2 Seconds...

play fullscreen
1 / 28

Access Point Event Simulator (APES) for Legacy Software Systems (LESS) - PowerPoint PPT Presentation


  • 78 Views
  • Uploaded on

Access Point Event Simulator (APES) for Legacy Software Systems (LESS). Stefan Resmerita Joint work with Patricia Derler and Edward Lee February 17, 2009. Contents. Goals and motivation Approach Ptolemy II components Further work Demos. Contents. Main Goals. Short-term:

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Access Point Event Simulator (APES) for Legacy Software Systems (LESS)' - keisha


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
access point event simulator apes for legacy software systems less

Access Point Event Simulator (APES) for Legacy Software Systems (LESS)

Stefan Resmerita

Joint work with Patricia Derler and Edward Lee

February 17, 2009

contents
Contents
  • Goals and motivation
  • Approach
  • Ptolemy II components
  • Further work
  • Demos

Contents

2

main goals
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

3

software in the loop testing
Software in the Loop Testing

Plant Model

User Input

Actuator models

Sensor Models

Simulation of original application code

+

Error

Simulation of modified application code

Goals and Motivation

4

classical problem

Simulation

write(angle)

read(angle)

S-function

dC

mC

time

Execution on the ECU

preemption

read(angle)

write(angle)

dC

mC

time

Classical Problem

MotorController.c

void mC_step() {

read(angle);

}

Memory

0023456 12

0023457 0

0023459 6

0023460 23

0023461 0

0023463 0

DynamicsController.c

void dC_step() {

write(angle);

}

Goals and Motivation

5

simulation engine based on ptolemy ii
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

6

model structure

Request

Response

Model Structure
  • Functionality actors
  • OSEK actors
  • Actor execution
  • Actor interaction
  • Java-C bridge

Ptolemy II components

7

event based approach

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();

}

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

Approach

8

execution control at access points

T2

T1

t1 t2 t2 + 2 t1 + 1 + 2

activate(T1) activate(T2)AGET2AGET1

APET1(1)APET2(2)terminate(T2)APET(1’)

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

9

example

CCodeLibrary

MotorController.c

void mC_step() {

aPCallback(12);

tmp_angle = angle;

aPCallback(42);

WaitEvent(evMask);

}

2. start

6. resume

3. callback

(stop)

1. Trigger

5. AGE

4. APE

a. system call

b. change task state, reschedule

Example

CTask.java

Thread cCodeThread;

void fire() {

notify();

}

void aPCallback(time) {

requestExecTime(time);

sleep();

}

Approach

10

functionality actor ctask
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

11

multithreaded de simulation problem

APE1

t1 + 1

CT1 callback(t1)

Generate APE1 withtimestamp t1 + 1

1

Process ev3

Process ev1

Trigger task 1

Wake up threadof C task 1 (CT1)

Process ev2

Multithreaded DE Simulation: Problem

ev1

ev2

ev3

t2

t3

model time

t1

CT2

CT1

real time

Ptolemy II components

12

multithreaded de simulation solution

APE1

ev´1

t1 + 1

t1 + 1

CT1 callback(1, 2)

Resume DE thread

Suspend C thread

1, 1

ProcessAPE1

Process ev1

Trigger task 1

Wake up threadof C task 1 (CT1)

Ask to be re-fired at t1 + 1

Process ev2

Process ev´1

Suspend execution

of DE thread

Multithreaded DE Simulation: Solution

ev1

ev2

ev3

t2

t3

model time

t1

CT2

CT1

real time

Generate APE1

Finish ev´1

processing

Ptolemy II components

13

osek actor taskscheduler

ready

event/resource

received

trigger

waiting

suspended

AGE

preemption

termiate task

wait for event

resource blocked

running

OSEK Actor: TaskScheduler
  • Fixed priority preemptive scheduling
  • Receives APEs from CTask actors
  • Maintains task status information
  • Implements task system services
    • ActivateTask, TerminateTask
  • Receives task status notifications from other OSEK actors
  • Sends AGEs to functionality actors

Ptolemy II components

14

osek actor eventmanager
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

15

source sensor actor formattedlinereader
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

16

infrastructure element multicastioport
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

17

monitoring
Monitoring
  • Task execution: Visualization of task states in time
  • Global variables

Ptolemy II components

18

java c bridge
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

19

next steps the simulator
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

20

application performance evaluation
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

21

modeling of legacy applications
Modeling of Legacy Applications
  • Task Model
  • Functional Model
  • Timing Model
  • Modal Model

Further work

22

demo 1 building a basic apes model
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

24

demo 2 apes model with plant actor in c
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

26