65
ECE-492/3 Case Study: Pendulum Clock Timer © 2015 Peter W. Pachowicz Department of Electrical and Computer Engineering George Mason University Fairfax, VA Note: This material was developed for GMU ECE492/3 students only. Distribution/use by other entities is not allowed without a written permission from the author.

ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Embed Size (px)

Citation preview

Page 1: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

ECE-492/3 Case Study:

Pendulum Clock Timer

© 2015 Peter W. Pachowicz

Department of Electrical and Computer Engineering

George Mason University

Fairfax, VA

Note: This material was developed for GMU ECE492/3 students only.

Distribution/use by other entities is not allowed without a written

permission from the author.

Page 2: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

2

1. Identification of Need

2. Operational Scenario &

Requirements Specification

3. Conceptual Design

4. Functional

Decomposition

5. System Architecture

6. Behavioral Modeling

7. Background Foundations

8. Early Prototyping

10. Testing Plan

11. Project Management

9. Detailed Design

Design Process

Page 3: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 1:

Identification of Need

Starting point: Faculty suggested topic description

(Issued on January 21, 2015)

“This project will develop a low-cost device for measuring key

parameters of a mechanical pendulum instrument. Measurements

must be of high accuracy and precision. Developed solution

should be transferable into a larger unit dedicated to the control

of the instrument. …….... “

3

Page 4: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Identification of Need(Bulleted Format)

A device to measure key parameters such as period (T) and

quality (Q) of a mechanical pendulum

Measurements taken with a high accuracy and precision

The device must use a low-power optical sensor already

integrated with the pendulum

Developed solution must be low-cost

In the future, developed solution will be modified and

transferred to a pendulum clock control module

4

Page 5: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Answers to Heilmeier’s Questions

1) What are you trying to do? Articulate your goals.

To develop a device and techniques for measuring pendulum

parameters with high precision and accuracy

2) How is it done today, and what are the limitations of

current practice?

There are stand alone precision devices able to measure

pendulum period with very high (up to 2-5 µs) precision and

similar accuracy, but they use sensing techniques taking a lot

of energy

These devices are expensive and cannot be integrated into a

larger system

They do not measure quality factor of a pendulum5

Page 6: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

3) What is new in your approach, and why do you think

it will be successful?

The device will measure both period and quality factor

Measurement data will include confidence information

Developed technology will be transferable

Approach will be based on solid mathematical foundations

The device will be low-cost and low-power

4) Who cares? If you are successful, what difference will

it make?

Developed device is needed for a larger effort

Developed technology will be transferred to a target system

controlling mechanical pendulum clock

The project provides an experience in the development of

highly accurate measurement devices

6

Page 7: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

5) What are the risks and payoffs?

Interfacing with a mechanical pendulum that allows for taking

high precision measurements is no clear at this point and may

cause delays

Pendulum axial vibrations and other effects may greatly

influence measured data

6) How much will it cost? How long will it take?

Estimated budget is in range of $100 to $200 covering electronic

components, including backup components, and components

needed for the development and testing

First semester is dedicated to the design effort, development of a

technique for sensor data processing, and approach simulation

Second semester is dedicated to a full scale implementation

The team will potentially need to work over the spring break

and/or a part of summer

7

Page 8: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

7) What are midterm and final milestones to check for

success?

Mathematical foundations will be developed and simulated

before the implementation phase (1st semester)

Project progress will include demonstrations of sensing

capabilities (1st semester) and data processing (2nd semester)

Final testing of the entire system will be scheduled a week

before the final presentation

8

Page 9: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 2:Requirements Specification

The team members spent time on educating themselves

on the application domain and applicable technology

The team prepared questions for an interview

The interview was completed with the stakeholder

o Notes from the interview were scripted

The team developed an operational scenarios which

were verified by the stakeholder

o Operational scenarios included “Use Cases” illustrating system

operations and interactions with the environment/users

Requirements were defined and verified9

Page 10: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Interview Notes

Q1: Please, describe the pendulum instrument.

o Free swinging pendulum with T=2sec

o ~1m long

o Motion is small and about ±1.5°

Q2: With what sensors/components must the

measuring device interface?

o Ultra-low-power photo interrupter installed on the

instrument

o Mask with two small windows attached to the

pendulum rod swings between an LED and a

photoreceptor of this sensor

o LCD with a parallel and I2C interface (swappable)10

Page 11: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Q3: What are the physical parameters to be measured?

o Pendulum period T (~2sec)

o Pendulum quality factor, better known as Q

Q4: What is the accuracy, precision, and value ranges for

these measurements?

o For period T:

At least 10µs accuracy

2µs precision

Value range 1.9s to 2.1s

o For quality factor Q:

Expected reasonable range from 10 to 5000 (greatly depends

on suspension spring and attachments to the pendulum)

High accuracy and precision for Q is not critical

11

Page 12: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Q5: How would you like to operate the device?

o First, pendulum is set in motion

o Next, the measurement process is initiated manually by an

operator (using a push button)

o Measurements are displayed on a LCD

o First measured data can be displayed with a delay of up to 15sec

Q6: Which part of the design must be transferable to a

control unit of the pendulum?

o Software shall be developed as a single component with defined

interfaces

o It is assumed that small software modifications will be needed for

software transfer

o Any hardware module must be transferable without modifications

o Use a MCU from the PIC24 family12

Page 13: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Q7: What type of events may negatively influence the

process and how are they to be deal with?

o Variety of external factors difficult to predict, for example:

excessive axial motion, excessive amplitude of the swing,

accidental friction between the mask and sensor, etc.

o Data displayed should include a confidence factor

o Notification of fatal errors/warnings

Q8: Are there any additional specific restrictions on the

size, power, etc. to be considered for the design?

o Low power design

o Power supply in range of 3V to 3.3V

o Easy operation

o Measurements taken on request (not continuous)

o Maximum time of 1min for the measuring process

13

Page 14: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Sample Input/Output Scenario

User Measuring Device Pendulum

Power up

Power up sensor

Receive sensor signal

Feedback Ready

Send sensor signal indicator (cont.)

Request measurements

Request sensor signal

Receive sensor signal

Feedback T and Q

Feedback Confidence

Stand by14

Page 15: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

External Systems’ Diagram

15

Measuring

Device

User

Pendulum

Instrument

Power

Power Up

Power

Status

Sensor Signal

Requests

Displayed Data

Page 16: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Summary of Project Requirements

Mission Requirements

o The device shall measure period T and quality Q of a 2sec pendulum

instrument

Operational Requirements

Input/Output Requirements

o The device shall accept an input from a user through a push button

o The device shall provide power to a photo-interrupter mounted on the

pendulum instrument

o The device shall accept a signal from the photo-interrupter

o The device shall provide readiness status after being powered up

o The device shall display results and messages on a simple LCD

External Interface Requirements

o The device shall receive power from an external source at 3.0-3.3V16

Page 17: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Functional Requirements

– The device shall measure T and Q

– The device shall measure accuracy, precision, and range of T

at:10µs, 2µs, and 1.9 to 2.1s

– The device shall measure Q within 10-5000

– The device will provide a confidence level for measurements

taken

– The device shall take all measurements and perform

calculations within 1 minute time frame

– The device should detect errors and provide visual notification

Technology and System-Wide Requirements

o The device shall have very low-power consumption

o Microcontroller shall belong to the PIC24 family

o The device shall display data on a LCD through a parallel and

I2C interfaces for easier technology transfer

o Hardware and software will have modular structure for easy

technology transfer

o The device should be low-cost17

Page 18: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 3:Conceptual Design

Free sketching was used to develop three separate concepts

o User view was most important at this point

o This sketching was fast – just letting the ideas to flow and record

them on three blank pages

Next, each sketch was refined by adding technology

o This is to bridge user-view with technological ideas

o But remember, no detailed technical solution is considered at this

point at all. Only an opportunity is considered.

o No judgment was applied

o Considerably more time was spent at this point

See these three sketches:18

Page 19: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

19

Page 20: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

20

Page 21: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

21

Page 22: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Conceptual Design Evaluation

Ideas extracted from:

Sketch #1:

Two switches

Interchangeable LCD + Dual interface

Sketch #2:

System behavior (GetReady, Notify, Measure)

Timing out

Sketch #3:

Two-line LCD

Sequential screens

Display: T, Average T, Mean deviation of T, Q

Moving average of measurements 22

Page 23: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Final Concept Sketch

Judgment, technology review, requirements, and other

constraints were used to formulate the final sketch

Selected ideas were integrated into a single concept

Several additions were introduced, as well

Certain details were moved to sketch notes

Final sketch was drawn 23

Page 24: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

24

Page 25: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 4:

Functional Decomposition

Black-Box Design

While-Box Design

Level-0

Level-1

Level-2

Itemize and decompose system functionality

Use of:

o Final Concept Sketch

o Operational Scenarios

o Requirements Specification

Be able to explain what happens inside the system 25

Page 26: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Top-Level Functions (Level-0)

Power Up

Request

Sensor Signal

System

Status

Electric Power

Data

Request

Sensor Signal

Request

(Electric Power) Accept User’s Requests

Control Pendulum Sensor

Calculate Pendulum

Characteristics

Control DisplayPendulum

Characteristics

26

Page 27: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Functional Decomposition (Level-1)

Accept

User’s

Requests

Sensor

Signal

Acquire

Data

System

Status

Control

Pendulum

Sensor

Calculate

Pendulum

Characteristics

Control

DisplayPendulum

Characteristics

Sensor

Signal

Request

(Elec.Power)

Power

Up

Electric Power

Sensor On

Request

Timing

Data

Acquire Characteristics Request

System Ready/

Error

Pendulum

Data

Reset

Request

27

Page 28: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Functional Decomposition (Level-2)

Function: Accept User’s Requests

Power Up

& Configure

Acquire

Data

Request

Measurement

Process

Initiation

Power Up

Request

Sensor On

Request

Acquire Characteristcs

Request

Ready

Reset Request

28

System

Ready/

Error

Page 29: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Function: Control Pendulum Sensor

Detect Sensor

Signal &

Pendulum

Phase

Acquire

Pendulum

Period Timing

Data

Sensor On Request

Electric Power

System

Ready/Error

Timing

Data

Sensor

Signal

Provide

Sensor

Power

Sensor

Config.

Data

Sensor

Signal

Request

(Elec.Power)ReadyReset Request

29

Page 30: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Function: Calculate Pendulum Characteristics

Calculate

Period &

Confidence

Data

Acquire

Characteristics

Request

System

Ready/

Error

Timing

Data

Timing

Services

Pendulum

Data

Data

Presentation

Period &

Confidence

Data

Start/Stop/Reset

30

Page 31: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Function: Control Display

Screen

Selection

Screen

Presentation

Acquire

Characteristics

Request System Status

Pendulum

Characteristics

Display Ready

System

Ready/

Error

Pendulum Data

Reset Request

31

Page 32: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 5:

System Architecture

For your Proposal Presentation:

System Architecture – Top-level diagram w/ main components

For Proposal Document:

1) Physical Architecture – brief hierarchical model

2) System Architecture – Top-level diagram w/ main

components

32

Page 33: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Generic Physical Architecture

Clock Timer

Power Supply

Module

Power Switch

Power Converter

Sensor Module

Power Verifier

Photo-Interrupt

Sensor

Command Module

Push-Button

Display Module

I2C LCD

Parallel LCD

Processing Module

Hardware

Software

33

Configuration

Detector

Page 34: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

System Architecture

Processing Module

(MCU)

Push

Button

Config

Detector

Power

Switch

Power

Converter

Display Interface

Parallel LCD

I2C LCD

Photo-Int

Sensor

Power

Verifier

4-14

VDC

Data/

Status

Power

Confirm

Sensor signal

On/Off

Request/

Reset

34Programming

Interface

Testing

Interface

Page 35: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 6:

Behavioral Modeling

Since the system is microcontroller-based, the following

models have been developed:

o State diagram

o Flowcharts

You will notice that these models are not copies of functional

decomposition, but they are practical implementation of it (!)

Implementation will progress through the following

phases:

1) Develop and test a top level software shell to switch between

states (as modeled by state diagram)

2) Separately build and debug software modules corresponding to

each state independently (as modeled by data flowcharts)

3) Gradually attach software objects under the software shell35

Page 36: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

State Diagram

36

ConfigureStart

User Request

PowerOn

Sensor

Control

ReadyDisplay

Error

Measure

Display End

Results

>1min

User Request

Done

Done

ErrorError

User Request

Page 37: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Flowcharts

37

Configure MCU

Disable User-INT

Detect Display

Configure State

Enter from

Start

Exit to

Sensor Ctrl

Power Up Sensor

Verify Sensor

Power

Enter from

Display

Sensor Ctrl State

Detect Sensor

Signal

Signal

Take T data

n y

~2secn

y

Exit to Error

Flag signal on

Display

Process

>10sec

y

n

Exit to

Ready

Enter from

Start

Page 38: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

38

Display READY

Enable User-INT

Take T data

Enter from

Sensor Ctrl

Ready State

Display T data

Exit to

Measure

INT on Push

Button

Disable User-INT

Init memory ptrs

Get T data

Enter from

Ready

Measure State

Enable User-INT

Exit to Error

Calculate On-Line

Measurements

~2secn

y

Store in Memory

Process

>60sec

y

n

Exit to

Display

Display

Measurements

Page 39: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

39

Reset Display

Display Error

Message

Enter

Error State

Enable INT

Stay Idle

Exit to

Sensor Ctrl

INT on Push

Button

Calculate T

Calculate Q

Enter from

Measure

Display State

Calculate

Confidence

Exit to

Sensor Ctrl

Display Final

Results

INT on Push

Button

Page 40: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

DESIGN NOTE (!)

Top-down design steps (Step1 to Step5) contributed to the

understanding of system functionality, in/out interactions,

and the development of system architecture

However, Step 6 brings this ‘understanding’ into practical

implementation, where both top-down and bottom-up designs

are combined

You may notice that functional decomposition diagram is not

transferred directly (into the state diagram and flowcharts);

but its components are arranged in such a way that

implementation is more optimal and practical

It is expected that in Step 6, added bottom-up design

influences changes in the design

In summary, top-down design leads towards the final design

but has to accept changes introduced by bottom-up design40

Page 41: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 7:

Background Foundations

“The ability to physically model differentiates engineers; it is not

a commodity,” Dr. K.C. Craig, Design News, Nov. 2012

Keep in mind that straightforward use of physics, math, etc.

frequently does not give the best results

Frequently, background foundations must be used in an innovative

(different) way to achieve modeling goals

Consider this case study:

Mathematical model of pendulum could be applied directly. If so, it

would require additional parameters of questionable accuracy or cause

problems.

Instead, the author went a step further and evolved the foundations

into an interesting method to measure T and Q, as shown in next pages.41

Page 42: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Pendulum as an oscillator

For small angles (<1.5°) pendulum is modeled as a linear system with a mathematical

model identical to a well known torsion spring oscillator

Pendulum:

Torsion spring:

where: g – gravity; l – pendulum length; k – spring constant; m – mass; γ – dumping

coefficient

Solution for underdumped system, where

where: ω – angular frequency; ω0 – resonant angular frequency; A – amplitude

42

0)()2(2

2

l

g

dt

d

dt

d

0)()2(2

2

xm

k

dt

dx

dt

xd

l

mgk with

lg / and 0

2

0

2

)cos()( tAetx t 22

0 and

Page 43: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

How to measure pendulum period T ?Mask with a small window sliding between LED and phototransistor of a proto-interrupter will

generate pulses – But it gives two interpretations with one misaligned to α=0

Mask with two different size windows – Provides a unique solution (similar to quadrature encoder)

43

α=0V

tT

T

α=0V

tT

α=0 α=0 α=0

α=0 α=0 α=0

Mask motion

Mask motion

Page 44: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

How to measure pendulum quality factor Q ?

Background:

Developed approach to measure Q:

1) Using amplitude of wave maxima and potential energy loss calculation (not convenient), or

2) Using speed at α=0 and kinetic energy loss calculation (not convenient), or

3) Estimated by using a difference in kinetic energy at consecutive periods from α=0.

Hence, Q can be estimated using measured ∆t it takes a mask window to travel

through the photo-interrupter (!)

This corresponds to an inverted problem and can be represented as follows:

where: ∆tT0 for the first period and ∆tT1 the next period are measured by the photo-

interrupter

This approach must be confirmed through a simulation (!)44

radian per dissipatedenergy Average

oscillator in the storedEnergy Q

22 and ; ; )()( :where 02 QEEEetETtE potentialkinetic

T

)()(

)(2

TtEtE

tEQ

)()(

)(2

01

1

TkTk

Tk

tEtE

tEQ

Page 45: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Approach #3 (from previous slide): Calculations needed for Q estimation

Given:

Q is estimated:

and assuming:

Q is can be solved computationally for measurements of ∆t taken every period by the photo-interrupter:

45

)2(sin2

1)(

2

1)( 2222 tAmtmvtEk

)2(sin)2(sin

)2(sin2

0

222

1

2

1

22

1

2

1

22

1

2

teAmtAm

tAmQ

T

)2(sin)2(sin

)2(sin2

00

2

10

2

10

2

00

tet

tQ

Q

T

QQ

0

0 2 and

Page 46: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Or, using Taylor series

Q can be derived as follows:

46

)2(sin)2(sin

))2(sin)2(sin2(

00

2

10

2

00

2

10

2

0

tt

tTtQ

large is Q assuming 1 0 0

Q

Te Q

T

Page 47: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 8:

Early Prototyping

Task #1) Photo-interrupter configuration

o Objective: Tune the sensor for low-power consumption

47

o Schematics

o From spec sheet of TCST1300 we learn:

Sensor aperture is 0.25mm (very small)

Practical minimum forward current IF≥2mA

For smaller current, IF˂2mA, Turn-on/Turn-

off delay is very large

Collector current IC=0.025*IF. For IF=2mA,

collector current is IC=50µA (very small

indeed)

This gives us initial resistor values: R1≈1kΩ;

R2≈60kΩ

Page 48: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

o Final resistor values found through experimentation: R1=1kΩ ;

R2=100kΩ (assuming MCU input impedance RL=[0.5-1MΩ]

o Obtained signal graphs with TCST1300 sensor:

o Conclusions:

1. Conducted experiments determined minimum current levels for

the photo-interrupter and resistor values

2. Size of mask windows can be decreased by a half due to relatively

small Turn-on/Turn-off delay

3. Timing data can be noisy due to axial vibrations of the pendulum –

proper technique for estimation of T and Q values from noisy

timing data must be implemented 48

Page 49: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Task #2) Oscillator modeling through Matlab simulation

o Oscillator function programmed with a very small increments

of time (1x10-6sec)

o Thick line sections are ∆t intervals indicating increasing time

the mask moves through a photo-interrupter

49

QtAetx t

2 and ,5.0 where)2cos()( 0

0

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Time [sec]

Am

plit

ude 0t 1t 2t

Page 50: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Task #3) Simulation based verification of Q estimation

o Developed numerical iterative calculation of Q

For given ω0 and T, and measured ∆t0 , ∆t1, one can estimate Q through an

iterative numerical process over increasing n until a stop condition is met (as an

error threshold on Q calculated at two sequential iterations)

o Results for different values of Q

o Q computed through Taylor series gives faster and similar results

50

1 initialwith 0

0

Q

T

e

)2(sin)2(sin

)2(sin2

00

2

10

2

10

2

0

1

0

tet

tQ

nQ

Tn

Q=20 Q=100 Q=500 Q=2500

Iter n=1 32.94 158.06 768.76 3444.48

Iter n=2 25.68 121.02 594.80 2850.30

Iter n=3 24.20 112.83 555.04 2702.10

Iter n=4 23.82 110.52 543.54 2658.16

Iter n=5 23.71 109.82 540.00 2644.49

Qest Q=20 Q=100 Q=500 Q=2500

23.48 109.28 538.15 2637.93

Page 51: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Task #4) Averaging Q due to substantial noise in ∆t

measurements

o This can be achieved through averaging Q values obtained every

single period

o Or more conveniently, estimating Q for ∆t0 measured at the

beginning of the process and ∆tM measured after M periods:

o Results for different value of Q estimated iteratively

o Q computed through Taylor series gives faster and similar result

51

1 initialwith 0

0

Q

MT

e

)2(sin)2(sin

)2(sin2

00

2

0

2

0

2

1

0

tet

tMQ

nQ

MT

M

Mn

Qest Q=20 Q=100 Q=500 Q=2500

Iter n=1 38.05 162.47 769.95 3451.08

Iter n=2 31.67 126.40 597.65 2857.75

Iter n=3 30.69 118.86 558.71 2710.11

Iter n=4 30.51 116.87 547.61 2666.46

Iter n=5 30.48 116.32 544.25 2652.93

Qest Q=20 Q=100 Q=500 Q=2500

29.96 115.59 541.84 2645.77

Page 52: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 9:Detailed Design

Hardware part

Schematics

Component selection and values

Software part

Software structure definition

Software modules identification

52

Page 53: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Schematics

53

Page 54: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Software Structure

54

Control Layer

Functional Layer

Hardware-Software

Interface Layer

Sys. Config.;

Task Switching

Requests Module;

Sensor Module;

Calculation Module;

Display Module

LCD Driver; Sensor Data Collector; Request Interrupt

Note: Modules contain smaller threads

Page 55: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 10:Testing

Referring to Project Requirements, the following selected

requirements will be validated through four experiments

Mission requirement

o The device shall measure period T and quality Q of a 2sec pendulum

instrument

Operational requirement

o The device shall accept an input from a user through a push button

Functional requirements

A. The device shall take all measurements and perform calculations

within 1 minute time frame

B. The device should detect errors and provide visual notification55

Page 56: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Experimental Plan

Experiment #1 (Mission Requirement evaluation)

Goal: To evaluate taken measurements of T and Q over time

System components: Pendulum, Measuring device, PC

Testing process:

After pendulum is set in motion, the device will continuously

transfer measured T and Q to a PC via a serial link

Data collection on a PC will take 10 minutes

Data collection repeated three times

Data processing and visualization: Raw data will be processed to

calculate mean and standard deviation. Raw data and processed data

will be displayed over time experiment.

Evaluation: Focus on deviation and other irregularities in data

Note: Extra hardware component (serial link) and software (for data

transfer) needs to be implemented to carry this experiment56

Page 57: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Experiment #2 (Operational Requirement evaluation)

Goal: To evaluate human-device operation using a push button

System components: Pendulum, Measuring device

Testing process:

Push button activated when a system is at different states

Logical and illogical activations to be tested

Data collection: State transitions will be recorded. No specific

numerical data will be collected.

Evaluation:

Focus on the detection of state transitions inconsistent with

the model.

Verification of LCD messages/data

57

Page 58: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Experiment #3 (Functional Requirement A evaluation)

Goal: To evaluate measurements of T, Q, and quality over

1min time period

System components: Pendulum, Measuring device, PC

Testing process:

The same process as in Experiment#1, but data collected as

sent to LCD display

There will be 10 sets of data (for a single 10 min

experiment)

Data processing and visualization: Data will be displayed over

1min time period. Deviation from mean will be calculated.

Evaluation: Focus on deviation and other irregularities in data.

Question to be answered: Is the time period of 1min sufficient

to obtain stable data?

Note: See Experiment#1

58

Page 59: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Experiment #4 (Functional Requirement B evaluation)

Goal: To detect errors and exit from them

System components: Pendulum, Measuring device, PC

Testing process:

Pendulum motion to be intentionally interrupted, slowed,

or sped up

T and Q monitored by a PC through a serial link

Push button activated after an error detected to switch to

the Sensor Control state

Data collection: Error messages against disturbance type will

be recorded. Disturbance to be monitored by T, Q and

measurement quality data.

Evaluation:

Focus on the detection of errors of different type.

Verification of LCD messages/data

59

Page 60: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

STEP 11:Work Breakdown Structure

• Refer to system functional decomposition and allocation

• Design major tasks based on functional decomposition

(Level-1), system architecture, user-centered operations,

and software structure

• Add tasks for integration, testing, reporting, etc.

• Allocate task duration to each major task

• Develop a complete list of tasks by decomposing each major

task according to functional decomposition (Level-2) and

interfacing

• Allocate task duration to each subtask and synchronize

subtask timelines into a project plan (in graphical format)60

Page 61: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

List of Major Tasks

1. Hardware development

2. Power supply development

3. Software drivers development

4. Software modules development

5. System integration

6. Testing

7. Reporting

8. Milestones/Demos

61

Page 62: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Complete List of Tasks

1. Hardware development (3 weeks)

1.1 Sensor setup

1.2 PCB design

1.3 PCB assembly

2. Power supply development (4 weeks)

2.1 PCB design

2.2 PCB assembly

2.3 Tuning and testing

3. Software drivers development (5 weeks)

3.1 LCD driver

3.2 Request interrupt

3.3 Sensor data collector

4. Software modules development (6 weeks)

4.1 Request module

4.2 Sensor module

4.3 Calculation module

4.4 Display module62

Page 63: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

5. System integration (11 weeks)

5.1 System configuration module

5.2 Task switching module

5.3 Request functionality

5.4 Sensor functionality

5.5 Calculation functionality

5.6 Display functionality

6. Testing (3 weeks)

6.1 Experiment #1

6.2 Experiment #2

6.3 Experiment #3 and #4

7. Reporting

7.1 Progress report

7.2 In-progress presentation

7.3 Final report

8. Milestones/Demos

8.1 Demo #1

8.2 Demo #2

8.3 Demo #3

63

Page 64: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

Project Plan

64

Using GanttProject software

Page 65: ECE-492/3 Case Study: Pendulum Clock Timerece.gmu.edu/~ppach/ECE492-3/CaseStudy-492.pdf · ECE-492/3 Case Study: Pendulum Clock Timer ... Requirements Specification 3. ... o Software

65

1. Hardware development

1.1 Sensor setup

1.2 PCB design

1.3 PCB assembly

2. Power supply development

2.1 PCB design

2.2 PCB assembly

2.3 Tuning and testing

3. Software drivers development

3.1 LCD driver

3.2 Request interrupt

3.3 Sensor data collector

4. Software modules development

4.1 Request module

4.2 Sensor module

4.3 Calculation module

4.4 Display module

5. System integration

5.1 System configuration module

5.2 Task switching module

5.3 Request functionality

5.4 Sensor functionality

5.5 Calculation functionality

5.6 Display functionality

6. Testing

6.1 Experiment #1

6.2 Experiment #2

6.3 Experiment #3 and #4

7. Reporting

7.1 Progress reporting

7.2 Final report

8. Milestones/Demos

8.1 Functionality demos

Comple-

tion

rateTask

Week

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

0%

Using a simple graphical tool