Formalization of Oscilloscope - PowerPoint PPT Presentation

About This Presentation
Title:

Formalization of Oscilloscope

Description:

Formalization of Oscilloscope. On Formalism. High-level (implementation ... A Simple Oscilloscope. Overview 'display Pat's ECG from 1:01pm to 1:02pm' ... – PowerPoint PPT presentation

Number of Views:98
Avg rating:3.0/5.0
Slides: 20
Provided by: lawrenc8
Learn more at: https://www.utdallas.edu
Category:

less

Transcript and Presenter's Notes

Title: Formalization of Oscilloscope


1
Formalization of Oscilloscope
2
On Formalism
  • High-level (implementation-independent)
    specification
  • Recall Larch An Algebraic Formal Spec. Lang.
  • Why formal? Precise, consistent, and complete
  • Formal semantics
  • Formal grammar,
  • e.g., syllogism
  • All persons die.
  • Adam is a person
  • ------------------------
  • Adam dies.
  • Semantics?

3
Introduction to Z
  • Based on typed set theory and first order logic
  • Sets
  • oneTwoThree 1, 2, 3
  • Person Adam, Eve
  • S P X 2 X --- S is a set of Xs powerset,
    i.e., the set of all subsets of X
  • oneTwoThreeSet P oneTwoThree P 1, 2, 3
    ?
  • personSet P person P Adam, Eve ?
  • P X ?

4
Introduction to Z
  • Sets (contd)
  • x memberOf S
  • ? 1 memberOf 1, 2, 3
  • ? 1 memberof P 1, 2, 3
  • ? 1 memberof P 1, 2, 3
  • ? Adam memberOf P Person
  • ? Adam memberOf Person
  • ? Adam, Eve memberOf P Person

5
Introduction to Z
  • Sets (contd)
  • S subsetOf S
  • ? 1 subsetOf 1, 2, 3
  • ? 1, 2 subsetOf P 1, 2, 3
  • ? 1, 2 subsetOf P 1, 2, 3
  • ? Adam subsetOf P Person
  • ? Adam subsetOf Person
  • ? Person subsetOf Person
  • ? Person subsetOf P Person

6
Introduction to Z
  • Sets (contd)
  • S X S (cross/cartesian product)
  • oneTwoThree X person 1, 2, 3 X Adam,
    Eve
  • 1, Adam, 1, Eve, 2, Adam, 2, Eve,
    3, Adam, 3, Eve
  • ? 1, 2 subsetOf 1, 2 X 1, 2
  • S U S, S intersect S, S\S, etc. (skip)

7
Introduction to Z
  • Functions
  • dom f --- The set of values x for which f(x) is
    defined
  • f(x) x 2 , dom f n memberOf N 1 lt n lt 5
  • ran f --- The set of values yielded by f(x),
  • where x memberOf dom f
  • ran f ?
  • f X -gt Y --- f is a total function from X to Y
  • i.e., f is defined for all x memberOf
    dom(f), i.e.,
  • dom(f) X
  • f X --gt Y --- f is a partial function from X to
    Y
  • i.e., f is defined for some values in X
  • if f(x) 1/x, ? dom(f) Z
  • ? spouse Person -gt Person

8
Introduction to Z
  • Functions (contd)
  • (lambda x T . t) returns the value of the term t
  • (lambda x N . X 2 ) 5 25
  • (lambda x N . (X 2 , 1/x) ?
  • (lambda x, y N . (X 2 y, y - 1/x) 5 1 ?

9
Introduction to Z
  • First Order Logic
  • Logical connectives AND, OR, NOT, gt, ltgt
  • Quantifiers
  • ? Exists n N . n n 2
  • ? Exists p Person . P father (Adam)
  • ? Forall i N . I 2 gt I
  • ? Forall I, j N . I gt j gt I 2 gt j 2
  • ? Forall x, y Person, x spouse(y) ltgt y
    spouse(x)

10
Introduction to Z
  • Schemas
  • A schema consists of a set of declarations of
    variables and a predicate constraining these
    variables (i.e., state space and operations)
  • ----- BirthdayBook ------------------------------
    ----------
  • known P Person
  • birthday Person --gt Date
  • -------------------------------------------------
    ----------------
  • known dom birthday
  • -------------------------------------------------
    ----------------
  • One possible state
  • known Adam, Caine, Eve
  • birthday Adam -gt Apr/01, Eve -gt Apr/01

11
A Simple Oscilloscope
  • ? What is a waveform?
  • - Engineer 0 a graph
  • - Engineer1 a 1-kbyte array of 8-bit samples
  • - Engineer3 a set of voltage values
  • - Engineer4 a function from time to volts

12
A Simple Oscilloscope
W -gt T
Clip
waveform
(translated) trace
Clipped trace
trace
Scale
Translate
  • Overview
  • display Pats ECG from 101pm to 102pm
  • - Ultimately displaying a trace
  • mapping time to a horizontal distance across
    the screen
  • voltage to a vertical offset on the screen
  • - Scale both horizontal (seconds/meter) and
    vertical (volts/meter) scaling
  • to convert a voltage versus time signal to
  • a point-on-screen versus time display
    of the trace
  • - Translate the trace on the display by
    horizontal and vertical offsets
  • - Clip the trace to fit on the screen

13
waveforms, segments, coordinates, traces
  • A waveform can be modeled as a partial function
    of time
  • Waveform Time --gt Voltage,
  • where Voltage Z X Volt / e.g., (1, Volt),
    (2, Volt)
  • Time N X Second / e.g., (0, Second),
    (1, Sec
  • E.g., wf1 1 Sec -gt 1 Volt, 2 Sec -gt 3
    Volt, 3 Sec -gt 2 Volt
  • wf2 1 Sec -gt 1 Volt, 3 Sec -gt 5 Volt, 4
    Sec -gt 6 Volt
  • wf3 25 -gt 5, 26 -gt 6, 27 -gt 8, 28 -gt
    10, 29 -gt 11, 30 -gt 13
  • A segment corresponds to a waveform over a
    contiguous time interval
  • ? wf1
  • ? wf2
  • ? wf3
  • ? wf3 (25)
  • ? Wf3 (29)

14
waveforms, segments, coordinates, traces
  • A coordinate can be represented by a real and a
    unit of distance
  • Coord R X Meter / (1, Meter), (3.5, Meter)
  • where Voltage Z X Volt / e.g., (1, Volt),
    (2, Volt)
  • A point on the screen by a pair of coordinates
  • Point Coord X Coord / e.g., ((1, Metr), (3,
    Metre)), (1, 3)
  • A trace is a mapping from time to points
  • Trace Time --gt Point
  • ? (0, 2.5), (1, 3), (2, 4), (3, 5), (4, 5.5),
    (5, 6.5) memberOf Trace
  • ? 25 -gt 5, 26 -gt 6, 27 -gt 8, 28 -gt 10, 29
    -gt 11, 30 -gt 13 memberOf Trace
  • ? 25 -gt (0, 2.5), 26 -gt (1, 3), 27 -gt (2, 4),
    28 -gt (3, 5), 29 -gt (4, 5.5), 30 -gt (5, 6.5)

15
Scale
  • takes a segment and scales it both horizontally
    and vertically
  • adjusts it s.t. the start of the segment
    corresponds to a horizontal offset of zero
  • The horizontal scale factor converts the units
    from seconds to metres
  • The vertical scale factor converts from a voltage
    to metres
  • ------- Scale ------------------------------------
    ---------------------------------------------
  • segment Segment / e.g., 25 -gt 5, 26
    -gt 6, 27 -gt 8 28 -gt 10, 29 -gt 11, 30 -gt 13
  • HScale R X Second/Metre / e.g., 1
    Second/Metre
  • VScale R X Volt/Metre / e.g., 2 Volt/Metre
  • scaled Trace
  • --------------------------------------------------
    -----------------------------------------------
  • scaled (lambda t dom segment . (t min (dom
    segment) / HScale,
  • segment (t) / VScale) )
  • --------------------------------------------------
    -----------------------------------------------
  • ? scaled

16
Translate
  • ---- Translate -----------------------------------
    --------------------------------------------------
  • scaled Trace / e.g., 25 -gt (0, 2.5), 26 -gt
    (1, 3), 27 -gt (2, 4), 28 -gt (3, 5), 29 -gt (4,
    5.5), 30 -gt (5, 6.5)
  • HOffset, VOffset Coord / e.g., (1, 1)
  • moved Trace
  • --------------------------------------------------
    --------------------------------------------------
    --
  • moved (lambda t dom scaled . (first (scaled
    (t)) HOffset,
  • second (scaled (t)) VOffset)
    )
  • --------------------------------------------------
    --------------------------------------------------
    --
  • ? moved

17
Clip
  • ----- Clip ---------------------------------------
    -------------------------------------------------
  • moved Trace / e.g., 25 -gt (1, 3.5), 26 -gt
    (2, 4), 27 -gt (3, 5), 28 -gt (4, 6), 29 -gt (5,
    6.5), 30 -gt (6, 7.5)
  • HMax R X Meter / e.g., 4 Metre
  • VMax R X Metre / e.g., 6 Metre
  • clipped Trace
  • --------------------------------------------------
    -------------------------------------------------
  • let screen (x, y) Coord 0 lt x lt HMax
    -VMax lt y lt VMax .
  • clipped moved screen
  • --------------------------------------------------
    -------------------------------------------------
  • Local definitions within predicates are
    introduced by the keyword let
  • The operator is for range restriction
  • R S a -gt b (a -gt b memberOf R) (b
    memberOf S)
  • ? Clipped

18
Trace Display
  • Schema conjunction the three schemas are
    combined using schema conjunction
  • (Scale Translate Clip)
  • Displaying only clipped trace hide scaled and
    moved traces, as they are only used as
    intermediate links keep all the constraints,
    but omit intermediate variables.
  • DisplayTrace (Scale Translate Clip) \
    (scaled, moved)
  • ? fully expanded declaration

19
DisplayKnobs, DisplaySegments
  • (skip)
  • ----- DisplayKnobs -------------------------------
    -------------------------------
  • HScale R X Second/Metre
  • VScale R X Volt/Metre
  • HOffset, VOffset Coord
  • --------------------------------------------------
    --------------------------------------
  • ----- DisplaySegments ----------------------------
    ------------------------------
  • segment Segment
  • DisplayKnobs
  • display P Trace
  • --------------------------------------------------
    --------------------------------------
  • display DisplayTrace dom DisplayTrace
    dom Segment . clipped
  • --------------------------------------------------
    ---------------------------------------
Write a Comment
User Comments (0)
About PowerShow.com