10
Describing and Controlling Physical Processes using Java (Brainstorm) Wind Turbine Instrumentation Project

Describing and Controlling Physical Processes using Java (Brainstorm)

Embed Size (px)

DESCRIPTION

Describing and Controlling Physical Processes using Java (Brainstorm). Wind Turbine Instrumentation Project. Goals. We need a language the can be used to: Formally describe the input/output of a physical process - PowerPoint PPT Presentation

Citation preview

Page 1: Describing and Controlling Physical Processes using Java (Brainstorm)

Describing and Controlling Physical Processes using Java

(Brainstorm)

Wind Turbine Instrumentation Project

Page 2: Describing and Controlling Physical Processes using Java (Brainstorm)

Goals

• We need a language the can be used to:– Formally describe the input/output of a

physical process– Formally describe a sensor that translates a

physical quantity to a digital quantity.– Formally describe the control of a physical

process.– Formally describe the interaction between

different controls of a physical process.

Page 3: Describing and Controlling Physical Processes using Java (Brainstorm)

Goals

• The language should be able to describe constraints such as – Hard Real Time constraints– Soft Real Time constraints as a probability function.– Accuracy– Power consumption– Communication constraints (rate, delay)– Redundancy– Other parameters….

Page 4: Describing and Controlling Physical Processes using Java (Brainstorm)

Goals

• The language should be flexible enough so verification of the constraints should be possible.

Page 5: Describing and Controlling Physical Processes using Java (Brainstorm)

Language Options

• Invent a new language mixing up existing similar languages– Advantage: Easier to specify models and to write

tools. – Disadvantage: No existing infrastructure. More difficult

learn a new language. • Extend or annotate Java.

– Advantage: Existing infrastructure and experience. Easier to adopt.

– Disadvantage: More difficult to describe models. Tools more difficult to write to extract info. Too general and flexible to be verified for all constraints.

Page 6: Describing and Controlling Physical Processes using Java (Brainstorm)

How Java could be extended

• There are already keywords in Java that add constranits to the execution of a program:atomic: Restrict sthe execution of blocks,

Volatile: Restricts the placement of variables

• We could have new keywords like “restrict”

Page 7: Describing and Controlling Physical Processes using Java (Brainstorm)

Example use of “restrict”

while (true) { restrict (Time=1ms) { FFT fft1 = accelerometer1.read().fft(); FFT fft2 = accelerometer2.read().fft(); FFT fft3 = accelerometer3.read().fft(); if ( fft1.diff(fft2) > MAXFFTDIFF || fft1.diff(fft3) > MAXFFTDIFF ) { administrator.report(); } } // End of restrict}• The block is restricted to run under 1ms.

Page 8: Describing and Controlling Physical Processes using Java (Brainstorm)

Comments

• Read() calls may happen in parallel. We need a way to specify that parallelism.

• RTJava may have already some keywords that do this.• The “restrict” keyword could be checked statically at

compilation time but it is extremely difficult or at runtime that is more practical.

• At runtime the “restrict” can be like an “assertion” that can report a problem.

• We could add this “restrict as part of the language syntax or as a compatible addition of the language.

• Example:

Page 9: Describing and Controlling Physical Processes using Java (Brainstorm)

Using “Restrict” without Language extension

while (true) { // !-- Restrict Time=1ms { FFT fft1 = accelerometer1.read().fft(); FFT fft2 = accelerometer2.read().fft(); FFT fft3 = accelerometer3.read().fft(); if ( fft1.diff(fft2) > MAXFFTDIFF || fft1.diff(fft3) > MAXFFTDIFF ) { administrator.report(); } // !-- } End of restrict}

A preprocessor would extract the info in “//!—” and insert code for verification at runtime or to an static analyzer.

Page 10: Describing and Controlling Physical Processes using Java (Brainstorm)