interactive cara simulation prof. insup lee. hierarchical efsm specification for cara

27
Interactive CARA Simulation Prof. Insup Lee

Upload: amberlynn-spencer

Post on 03-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Interactive CARA Simulation

Prof. Insup Lee

Page 2: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Hierarchical EFSM Specification for CARA

CARA

Pump Monitor

Blood PressueMonitor

Algorithms

CaregiverInterfaces

BP Detector

BP Handler

BP Checker

Cuff Detector

AL Detecotr

PW Detector

Valid BP Handler

Cuff Source Handler

AL Source Handler

PW Source Handler

BP Slope Checker

BP Falling Checker

Mode ControlAlgorithm

Polling AlgorithmStart AC I/O

Change Setpoint I/O

Override I/O

Terminate I/O

Alarm I/O

Mode Display

Polling Display

BP Display

Button Display

Notation Display

Alarm Display

Monitor PlugIn

Monitor Continuity

Monitor OccOk

Monitor AirOk

Monitor backEMF

Monitor Impedance

Initial AC Handler

Set Point Checker

Hierarchical Structure

Page 3: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Interactive Simulation• CHARON simulator

– CHARON is able to simulate state flows– Each state machine can be simulated in an agent– Agents can work concurrently

• Java-based GUI– Allow user to change the CARA environment online– Display soft button– Display dialog windows– Display run-time pumping mode and pump status– Display the dynamic data and notation

• How to fill the gap between CHARON Simulation and GUI– File sim.dat is written by CHARON simulation, and will be read by GUI

during running– File gui.dat is written by GUI and will be read by Environment agent in

CHARON simulation

Page 4: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

CARA Simulation in CHARON

• CHARON Features– Architectural Hierarchy

• simulate the hierarchical EFSM structure• Each state machine in the EFSM is corresponding to an

agent in CHARON

– Behavior Hierarchy• Allow to simulate the mode control and state transaction

– Discrete & Continuous Variable Updates• Make it possible for time-triggered transaction in CARA

Page 5: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

CARA Implementation in CHARON

• CARA System– Pump Monitor

• Monitor Plug-In• Monitor Continuity• Monitor AirOk• Monitor OccOk• Monitor backEMF• Monitor Impedance

– BP monitor• BP Detector

– Cuff Detector– AL Detector– PW Detector

• BP Handler– Initial Auto-control– Valid BP Handler– Cuff Handler in AC– AL Handler in AC– PW Handler in AC

• BP Checker– Control Algorithm

• Mode control algorithm• Polling algorithm

• Additional simulation– Environment

• To catch the changes and setting in GUI

– Propaq Platform• To simulate the hardware propaq,

buffering the BP values and detecting time

– System Clock• To create a system-scale timer

Page 6: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

• Cuff (AL, PW) Detector– Detect BP data stream from Propaq, update cuff (AL, PW) value

if new arrival, and calculate the average cuff value every minute

• Cuff (AL, PW) Handler in AC– In Auto-control, handle cuff (AL, PW) value to decide whether it

is lost, whether it can be as the control BP source, whether it is required to be corroborated, and determine the driven voltage for pump to control the infusion speed

Explanations (1)

Page 7: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Explanations (2)

• Initial Auto-Control– Decide the initial control BP source and value during initial Auto-

control stage

• Valid BP Handler– keep trace whether the control BP source is valid during Auto-

control mode

• Mode Control Algorithm– Keep trace the pump mode: unknown, wait, manual, initial auto-

control, and auto-control

• Polling Algorithm– Keep trace of the back EMF and impedance value to decide the

polling status, and get the current flow rate, accumulated infusion volume, and average flow rate every minute

Page 8: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Java-Based GUI

By clicking the “Change Conditions” button, users can change the environment setting for CARA (as following figure)

Page 9: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Run-time Dialog Windows

• Start Ok Window– When CHARON simulation

satisfies the conditions to trigger initial Auto-control mode, it will send a signal to GUI. So, GUI will pop up the “Start Ok Window”.

• Set Point Window– After the above ok button is

clicked, GUI shows the “change set point” button, if it is pressed, a dialog window will be pop up.

Page 10: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

• Override Window– During corroboration,

CARA allows user to decide whether to override or not. At that time, GUI will pop up such dialog window.

• Terminate Window– During Auto-Control mode,

a “Terminate AC” button is visible. When it is clicked, another dialog window is available.

Page 11: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Run-Time GUI• During simulation, GUI will display messages and show/hide

some buttons corresponding to different mode

Initial state of GUI After click “start ok” button Running in Auto-Control mode

Page 12: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

M100 Infusion Pump

Experiment Design

Page 13: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Motivation

We have been modeling an abstract system

Physical setup allows us to understand system better, test code against the real hardware.

Page 14: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Hardware Simulation of CARA

The Penn Team has developed a hardware platform to simulate the functions of the CARA system and assist in evaluating the simulation software.

Page 15: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Hardware Simulation Components

The hardware consists of four components:

•M100 Infusion Pump•2 1000mL flasks•Pressure Sensor•A/D interface

Page 16: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

M100 Infusion Pump

The M100 Infusion Pump interfaces with the controlling computer via the gold connector on the right. This allows computer control of the pump’s functions.

Page 17: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Pressure Sensor

We built a simple pressure sensor which detects 0 – 6 psi and outputs 0 – 5 volts. It is compatible with our d/a converter and the pressure ranges we wish to experiment with.

Page 18: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Operation of the System

• Normal operation consists of running the pump until the pressure in the top flask reaches the desired level.

• ‘Since the flask is sealed, pumping fluid into it raises the pressure, and this is detected by the pressure sensor.

• The system can also detect and react to faults.

Page 19: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Swing

Pressure Sensor

Quanser MultiQ

Luer Connector

1/8” PP Tubing

Data

Starting Condition

Page 20: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Swing

Pressure Sensor

Quanser MultiQ

Luer Connector

1/8” PP Tubing

Data

Pump is Primed

Page 21: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Swing

Pressure Sensor

Quanser MultiQ

Luer Connector

1/8” PP Tubing

Data

Pumping Starts

Page 22: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Luer Connector

1/8” PP Tubing

Swing

Data

Pressure Sensor

Quanser MultiQ

Normal Operation

Page 23: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Swing

Pressure Sensor

Quanser MultiQ

Luer Connector

1/8” PP Tubing

Data

Bleeding

Page 24: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Hardware Prototype

• We connected the Simulation and GUI to the hardware setup.

• This allowed us to write a CHARON specification and quickly see it run on the actual hardware.

Page 25: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA
Page 26: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA
Page 27: Interactive CARA Simulation Prof. Insup Lee. Hierarchical EFSM Specification for CARA

Future Work

• Perfect Charon / Gui / Hardware interaction

• Build a general purpose prototyping platform based on Charon