PMU Agenda Concurrent Model Real Time Model. Environment (1) public createEvents: () ==> () createEvents () == ( if len inlines > 0 then ( dcl curtime.

Slides:



Advertisements
Similar presentations
PMU TI-VDM2 project. Agenda  Proposed class diagram • Thread Identification • Communication channels • Synchronization • Stimuli • Open issues.
Advertisements

Logic Thread Queue DB Thread Queue ASync …n Sync.
Cash dispenser Function body, pre and post conditions Peter, Raghid og Brian.
Introduction to OCaml Slides prepared by Matt Gruskin Some material borrowed from the CIS 500 lecture notes.
Computer Science 112 Fundamentals of Programming II Queues and Priority Queues.
F28PL1 Programming Languages Lecture 14: Standard ML 4.
Def f(n): if (n == 0): return else: print(“*”) return f(n-1) f(3)
SES Algorithm SES: Schiper-Eggli-Sandoz Algorithm. No need for broadcast messages. Each process maintains a vector V_P of size N - 1, N the number of processes.
Uncoordinated Checkpointing The Global State Recording Algorithm Cristian Solano.
ML: a quasi-functional language with strong typing Conventional syntax: - val x = 5; (*user input *) val x = 5: int (*system response*) - fun len lis =
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Model Checking. Used in studying behaviors of reactive systems Typically involves three steps: Create a finite state model (FSM) of the system design.
ML: a quasi-functional language with strong typing Conventional syntax: - val x = 5; (*user input *) val x = 5: int (*system response*) - fun len lis =
Stacks, Queues & Deques CSC212.
Vienna Development Method SIM5104. one of the longest-established Formal Methods for the development of computer- based systemsFormal Methods Originating.
Crash course on SML Wojciech Moczydłowski SML – functional programming language Complete formal semantics Extremely convenient for writing compilers, interpreters,
COMP104 Linked List Algorithms / Slide 1 Some Simple Algorithms on Linked Lists * Write a function that returns the length of a given list. * Write a boolean.
Unit 17: Communication Technology1 Communication Technology What is it? Provides a transfer of knowledge to people all over the world. Provides a transfer.
Introduction to Data Structure, Fall 2006 Slide- 1 California State University, Fresno Introduction to Data Structure Chapter 8 Ming Li Department of.
GestEnergy48V Energy Autonomy.  How work during the day or with cloudy time The inverter supplie electric power, through the photovoltaic panels and.
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport (1978) Presented by: Yoav Kantor.
11/ VIP Elevator – first model A VDM++ Project Made By: Sune Wolff.
CSE 380 – Computer Game Programming Render Threading Portal, by Valve,
Lecture 5 Searching and Sorting Richard Gesick. The focus Searching - examining the contents of the array to see if an element exists within the array.
15-740/ Oct. 17, 2012 Stefan Muller.  Problem: Software is buggy!  More specific problem: Want to make sure software doesn’t have bad property.
WEB WORKERS 1 Amitesh Madhur (Exceptional Performance, Bangalore)
TIVDM1Modelling ordered collections1 Peter Gorm Larsen.
TIVDM1Modelling ordered collections1 Peter Gorm Larsen.
© 2011 Terma A/S 1 VDM-RT: Distributed Real-time Modeling Industrial PhD Student, Sune Wolff Terma A/S Engineering College of.
TIVDM2Real-Time and Distributed Development in VDM++1 Peter Gorm Larsen
© 2011 Terma A/S 1 VDM-RT: Distributed Real-time Modeling Industrial Postdoc, Sune Wolff Terma A/S Aarhus University, Department.
Personal Medical Unit Lars Sarbæk Kristiansen Kasper J. Nielsen Martin Kjeldsen
1 5. Queues Def. As a data structure, a queue is an ordered collection of data items with the property that items can be removed only at one end, called.
1 Chapter 2.3 : Interprocess Communication Process concept  Process concept  Process scheduling  Process scheduling  Interprocess communication Interprocess.
1 Stacks & Queues CSC Stacks & Queues Stack: Last In First Out (LIFO). –Used in procedure calls, to compute arithmetic expressions etc. Queue: First.
TIVDM1Sortation System, Tray Allocation1 Tray allocation for a sortation system Iteration III TI-VDM1 Project by José Antonio Esparza and Kim Bjerge.
Some Other Collections: Bags, Sets, Queues and Maps COMP T2 Lecture 4 School of Engineering and Computer Science, Victoria University of Wellington.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
1 Modelling using Sequences Sequences The finite sequence constructor Value definitions: enumeration, subsequence Operators on Sequences Case Study: the.
Scientific Method. Ask a question Finding the reason something is happening (e.g. why do the tadpoles have deformed limbs??) Make observations—be accurate!
On Concurrency Idioms and their Effect on Program Analysis Weizmann Institute of Science Guy Katz and David Harel.
 Introduction to Search Algorithms  Linear Search  Binary Search 9-2.
1.SML Docs Standard Basis 2.First-Class Functions Anonymous Style Points Higher-Order 3.Examples Agenda.
MPICH.NT Design of the Windows NT device. Introduction n Port MPICH to NT quickly n Emulate the P4 device.
(c) University of Washington20c-1 CSC 143 Binary Search Trees.
Scala HW5 Part 2 Combine Until Encode Decode. Combine Not sure what a correct test case is Fork(Leaf('d',4),Fork(Leaf('a',2),Leaf('b',3),List('a ', 'b'),5),List('d',
(c) University of Washington20-1 CSC 143 Java Trees.
1 Concurrency Abstractions in C#. Concurrency in C# CS 5204 – Fall, Motivation Concurrency critical factor in behavior/performance affects semantics.
Section06: Sequences Chapter 4 and 5. General Description "Normal" variables x = 19 – The name "x" is associated with a single value Sequence variables:
Behavior trees & The C# programming language for Java programmers
Sort Algorithms.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Data types Data types Basic types
ML: a quasi-functional language with strong typing
Searching Given a collection and an element (key) to find… Output
Binary Search one reason that we care about sorting is that it is much faster to search a sorted list compared to sorting an unsorted list the classic.
COMPUTER 2430 Object Oriented Programming and Data Structures I
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
SYNCHORNIZATION Logical Clocks.
And now for something completely different . . .
Nicholas Shahan Spring 2016
Agenda SML Docs First-Class Functions Examples Standard Basis
Agenda SML Docs First-Class Functions Examples Standard Basis
Default Parameters February 24, 2016
Linear Search Binary Search Tree
B- Trees D. Frey with apologies to Tom Anastasio
Constructors Construct a value of a given type.
CSC 143 Java Trees.
CSC 143 Binary Search Trees.
CSE 486/586 Distributed Systems Logical Time
Presentation transcript:

PMU Agenda Concurrent Model Real Time Model

Environment (1) public createEvents: () ==> () createEvents () == ( if len inlines > 0 then ( dcl curtime : nat := NewWorld`timerRef.GetTime(), done : bool := false; while not done do def mk_(eventtype, theEvent, timestamp) = hd inlines in if timestamp <= curtime then ( cases eventtype: 1 -> ( def mk_(cpr, eventid, datatype, devicedata) = theEvent in for all device in set elems devices do if (device.getCprNr() = cpr and device.getDeviceType() = datatype) then ( device.poll(eventid, datatype, devicedata, timestamp) ), 2 -> ( def mk_(cpr, eventid) = theEvent in for all pmu in set elems pmus do if (pmu.getPMUId() = cpr) then ( pmu.proximity() ), others -> Printer`Out("Env: Something bad happened... crap...") end; inlines := tl inlines; done := len inlines = 0; ) else done := true ) else busy := false);

Environment (2) [mk_(1, mk_( , 1, 1, [mk_(1,0), mk_(1,1), mk_(1,2), mk_(2,3), mk_(3,4)]), 10), mk_(2, mk_(2, ), 20)] EventData = EventType * Event * TimeStamp Event = Data | ProximityEvent Data = CprNr * EventId * DataType * seq of DeviceData DeviceData = nat * TimeStamp ProximityEvent = EventId * CprNr EventType (Data poll event) Event (Data) TimeStamp EventType (Proximity event) Event (Proximity) TimeStamp

MedicalDevice Contains the data the PMU is collecting. The environment instigates the polling on the correct medicaldevice based on the CPR nr and device type. public poll: EventId * DataType * seq of DeviceData * TimeStamp ==> () poll(evid, dtype, devicedata, ts) == ( pmuref.collectDeviceData(evid, dtype, devicedata, ts) );

PMU public collectDeviceData : EventId * DataType * seq of DeviceData * TimeStamp ==> () collectDeviceData(evid, datatype, devicedata, ts) == ( if datatype = 3 then (mdDataPrio3 := mdDataPrio3 ^ [mk_(evid, datatype, devicedata, ts)];) else if datatype = 2 then (mdDataPrio2 := mdDataPrio2 ^ [mk_(evid, datatype, devicedata, ts)];) else if datatype = 1 then (mdDataPrio1 := mdDataPrio1 ^ [mk_(evid, datatype, devicedata, ts)];) ); processData: () ==> () processData() == ( ( for all analyzerId in set dom analyzer do if(analyzerId = HEARTRATE) then def mk_(evid, datatype, devicedata, pt) = getData(mdDataPrio3) in ( while (len mdDataPrio3 > 0) do (analyzer(analyzerId).addData(evid, datatype, devicedata, pt)) ) else if(analyzerId = TAKEMEDICIN) then def mk_(evid, datatype, devicedata, pt) = getData(mdDataPrio2) in ( while (len mdDataPrio3 = 0 and len mdDataPrio2 > 0) do (analyzer(analyzerId).addData(evid, datatype, devicedata, pt)) ) else if(analyzerId = WEIGHT) then def mk_(evid, datatype, devicedata, pt) = getData(mdDataPrio1) in ( while (len mdDataPrio3 = 0 and len mdDataPrio2 = 0 and len mdDataPrio1 > 0) do (analyzer(analyzerId).addData(evid, datatype, devicedata, pt)) ) );

Analyzer public doStuff: () ==> () doStuff() == ( (dcl curData : Data := hd dataBuffer; def mk_(evid, datatype, devicedata, pt) = curData in ( if hasBattery then batMonitor.drain(20); for all value in set elems devicedata ( def mk_(val, timestamp) = value in ( oldValue := curValue; curValue : = val; if(curValue - oldValue > 5) transmitter.send(evid, HEART_RATE_SPIKE, devicedata, NewWorld`timerRef.GetTime()); ); ): dataBuffer := tl dataBuffer; if len dataBuffer = 0 then busy:= false; ) );

Transmitter Sorts messages by priority and transmits the highest priority first. sortByPriority: TransmitData * seq of TransmitData ==> seq of TransmitData sortByPriority(val, sorted) == ( cases true: (len sorted = 0) -> return [val], (val.#2 return [val] ^ sorted, others -> return [hd sorted] ^ sortByPriority(val, tl sorted) end ); private sendMessage: () ==> () sendMessage() == ( if busy then ( dcl msg : TransmitData := hd prioritizedBuffer; prioritizedBuffer := tl prioritizedBuffer; Environment'handleEvent(msg, NewWorld`timerRef.GetTime()); battery.drain(drainVolume(msg.#2)); busy:=len buffer > 0 ) );

BatteryMonitor Symbolizes the battery and the drain on this from different operations. If there’s no battery left, processes are halted in the drain call. public drain: nat ==> () drain(drainVolume) == batteryLife := batteryLife - drainVolume; sync mutex(drain); mutex(drain, getBatteryLife, recharge); per drain => batteryLife > 0

Real Time Overview

Real Time MedicalDevice The analysis algorithm has a cycles added due to the computation. async public poll: EventId * DataType * seq of DeviceData * TimeStamp ==> () poll(evid, dtype, devicedata, ts) == ( pmuref.collectDeviceData(evid, dtype, devicedata, ts) );

Real Time PMU Thread becomes periodic a number of cycles is added to processData. collectDeviceData has a duration added due to communication initialization. thread periodic(500, 0, 0, 0) (processData) processData: () ==> () processData() == cycles(100) ( … ); public collectDeviceData : EventId * DataType * seq of DeviceData * TimeStamp ==> () collectDeviceData(evid, datatype, devicedata, ts) == duration(20) ( … );

Real Time Analyzer thread periodic(500, 100, 0, 0) (doStuff) public doStuff: () ==> () doStuff() == Cycles(5000) ( … );

Real Time Transmitter async public transmit: TransmitData ==> () transmit(data) == ( buffer := sortByPriority(data, buffer); busy:= true; ); thread periodic(500, 10, 0, 0) (sendMessage) private sendMessage: () ==> () sendMessage() == duration(50) ( … );